Small fixes to the icon entry code

svn path=/trunk/; revision=21939
This commit is contained in:
Matthias Clasen
2008-12-27 02:25:15 +00:00
parent fbada98059
commit 3276458c7b
3 changed files with 29 additions and 26 deletions

View File

@ -1,3 +1,9 @@
2008-12-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c: Emit ::icon-pressed regardless which button was
pressed. Also make it explicit in the signal signature that the
position parameter is a GtkEntryIconPosition.
2008-12-26 Matthias Clasen <mclasen@redhat.com> 2008-12-26 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkentry.c: Emit property notification for the text-length * gtk/gtkentry.c: Emit property notification for the text-length

View File

@ -1038,7 +1038,7 @@ gtk_entry_class_init (GtkEntryClass *class)
* Whether the primary icon is sensitive. * Whether the primary icon is sensitive.
* *
* An insensitive icon will appear grayed out, it will not emit * An insensitive icon will appear grayed out, it will not emit
* #GtkEntry::icon-pressed signal and not change the cursor. * #GtkEntry::icon-pressed signal, not allow DND and not change the cursor.
* *
* Since: 2.16 * Since: 2.16
*/ */
@ -1056,7 +1056,7 @@ gtk_entry_class_init (GtkEntryClass *class)
* Whether the secondary icon is sensitive. * Whether the secondary icon is sensitive.
* *
* An insensitive icon will appear grayed out, it will not emit * An insensitive icon will appear grayed out, it will not emit
* #GtkEntry::icon-pressed signal and not change the cursor. * #GtkEntry::icon-pressed signal, not allow DND and not change the cursor.
* *
* Since: 2.16 * Since: 2.16
*/ */
@ -1199,9 +1199,9 @@ gtk_entry_class_init (GtkEntryClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0, 0,
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__INT_BOXED, _gtk_marshal_VOID__ENUM_BOXED,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_INT, GTK_TYPE_ENTRY_ICON_POSITION,
GDK_TYPE_EVENT); GDK_TYPE_EVENT);
/** /**
@ -1221,9 +1221,9 @@ gtk_entry_class_init (GtkEntryClass *class)
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0, 0,
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__INT_BOXED, _gtk_marshal_VOID__ENUM_BOXED,
G_TYPE_NONE, 2, G_TYPE_NONE, 2,
G_TYPE_INT, GTK_TYPE_ENTRY_ICON_POSITION,
GDK_TYPE_EVENT); GDK_TYPE_EVENT);
@ -2703,7 +2703,7 @@ should_prelight (GtkEntry *entry,
if (icon_info->nonactivatable && icon_info->target_list == NULL) if (icon_info->nonactivatable && icon_info->target_list == NULL)
return FALSE; return FALSE;
if (icon_info->pressed == TRUE) if (icon_info->pressed)
return FALSE; return FALSE;
gtk_widget_style_get (GTK_WIDGET (entry), gtk_widget_style_get (GTK_WIDGET (entry),
@ -3106,26 +3106,23 @@ gtk_entry_button_press (GtkWidget *widget,
if (event->window == icon_info->window) if (event->window == icon_info->window)
{ {
if (event->button == 1) if (should_prelight (entry, i))
{ {
if (should_prelight (entry, i)) icon_info->prelight = FALSE;
{ gtk_widget_queue_draw (widget);
icon_info->prelight = FALSE;
gtk_widget_queue_draw (widget);
}
if (icon_info->target_list != NULL)
{
priv->start_x = event->x;
priv->start_y = event->y;
icon_info->pressed = TRUE;
}
g_signal_emit (entry, signals[ICON_PRESSED], 0, i, event);
return TRUE;
} }
if (icon_info->target_list != NULL)
{
priv->start_x = event->x;
priv->start_y = event->y;
icon_info->pressed = TRUE;
}
g_signal_emit (entry, signals[ICON_PRESSED], 0, i, event);
return TRUE;
} }
} }

View File

@ -68,8 +68,8 @@ VOID:ENUM,FLOAT
VOID:ENUM,FLOAT,BOOLEAN VOID:ENUM,FLOAT,BOOLEAN
VOID:ENUM,INT VOID:ENUM,INT
VOID:ENUM,INT,BOOLEAN VOID:ENUM,INT,BOOLEAN
VOID:ENUM,BOXED
VOID:INT VOID:INT
VOID:INT,BOXED
VOID:INT,BOOLEAN VOID:INT,BOOLEAN
VOID:INT,INT VOID:INT,INT
VOID:INT,INT,BOXED VOID:INT,INT,BOXED