gtk+ r22023 - in trunk: . demos/gtk-demo docs/reference docs/reference/gtk docs/reference/gtk/tmpl gtk tests
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r22023 - in trunk: . demos/gtk-demo docs/reference docs/reference/gtk docs/reference/gtk/tmpl gtk tests
- Date: Wed, 31 Dec 2008 07:29:24 +0000 (UTC)
Author: matthiasc
Date: Wed Dec 31 07:29:23 2008
New Revision: 22023
URL: http://svn.gnome.org/viewvc/gtk+?rev=22023&view=rev
Log:
Rename GtkEntry icon-related signals
Modified:
trunk/ChangeLog
trunk/demos/gtk-demo/search_entry.c
trunk/docs/reference/ChangeLog
trunk/docs/reference/gtk/migrating-GtkEntry-icons.sgml
trunk/docs/reference/gtk/tmpl/gtkentry.sgml
trunk/gtk/gtkentry.c
trunk/tests/testentryicons.c
Modified: trunk/demos/gtk-demo/search_entry.c
==============================================================================
--- trunk/demos/gtk-demo/search_entry.c (original)
+++ trunk/demos/gtk-demo/search_entry.c Wed Dec 31 07:29:23 2008
@@ -77,10 +77,10 @@
}
static void
-icon_pressed_cb (GtkEntry *entry,
- gint position,
- GdkEventButton *event,
- gpointer data)
+icon_press_cb (GtkEntry *entry,
+ gint position,
+ GdkEventButton *event,
+ gpointer data)
{
if (position == GTK_ENTRY_ICON_PRIMARY)
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
@@ -223,8 +223,8 @@
GTK_STOCK_CLEAR);
text_changed_cb (GTK_ENTRY (entry), NULL, find_button);
- g_signal_connect (entry, "icon-pressed",
- G_CALLBACK (icon_pressed_cb), NULL);
+ g_signal_connect (entry, "icon-press",
+ G_CALLBACK (icon_press_cb), NULL);
g_signal_connect (entry, "notify::text",
G_CALLBACK (text_changed_cb), find_button);
g_signal_connect (entry, "activate",
Modified: trunk/docs/reference/gtk/migrating-GtkEntry-icons.sgml
==============================================================================
--- trunk/docs/reference/gtk/migrating-GtkEntry-icons.sgml (original)
+++ trunk/docs/reference/gtk/migrating-GtkEntry-icons.sgml Wed Dec 31 07:29:23 2008
@@ -25,6 +25,58 @@
</para>
<para>
+ The signals SexyIconEntry::icon-pressed and SexyIconEntry::icon-released
+ have been renamed to #GtkEntry::icon-press and #GtkEntry::icon-release
+ to avoid problems due to signal name clashes. Also, the signature of the
+ signals has changed from
+<informalexample><programlisting>
+void (*icon_pressed) (SexyIconEntry *entry,
+ SexyIconEntryPosition icon_pos,
+ int button)
+</programlisting></informalexample>
+to
+<informalexample><programlisting>
+void (*icon_press) (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEventButton *event)
+</programlisting></informalexample>
+ The new signature has the advantage that the signal handler can use
+ the timestamp of the event, e.g. for passing it to gtk_menu_popup().
+ When adapting an existing signal handler to the new signature, you
+ should note that the button number is easily available as @event->button,
+ as shown in the following example:
+<informalexample><programlisting>
+static void
+icon_pressed_cb (SexyIconEntry *entry,
+ SexyIconEntryPosition position,
+ int button,
+ gpointer data)
+{
+ GtkMenu *menu = data;
+
+ if (position == SEXY_ICON_ENTRY_PRIMARY)
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ button, GDK_CURRENT_TIME);
+}
+</programlisting></informalexample>
+ can be ported as:
+<informalexample><programlisting>
+static void
+icon_press_cb (GtkEntry *entry,
+ GtkEntryIconPosition position,
+ GdkEventButton *event,
+ gpointer data)
+{
+ GtkMenu *menu = data;
+
+ if (position == GTK_ENTRY_ICON_PRIMARY)
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ event->button, event->time);
+}
+</programlisting></informalexample>
+ </para>
+
+ <para>
Another difference is that SexyIconEntry offers manual control of
the icon prelighting, via sexy_icon_entry_set_icon_highlight().
#GtkEntry prelights automatically when appropriate, depending on
Modified: trunk/docs/reference/gtk/tmpl/gtkentry.sgml
==============================================================================
--- trunk/docs/reference/gtk/tmpl/gtkentry.sgml (original)
+++ trunk/docs/reference/gtk/tmpl/gtkentry.sgml Wed Dec 31 07:29:23 2008
@@ -34,7 +34,7 @@
can have tooltips. To add an icon, use gtk_entry_set_icon_from_gicon() or
one of the various other functions that set an icon from a stock id, an
icon name or a pixbuf. To trigger an action when the user clicks an icon,
-connect to the #GtkEntry::icon-pressed signal. To allow DND operations
+connect to the #GtkEntry::icon-press signal. To allow DND operations
from an icon, use gtk_entry_set_icon_drag_source(). To set a tooltip on
an icon, use gtk_entry_set_icon_tooltip_text() or the corresponding function
for markup.
@@ -737,11 +737,11 @@
<!-- ##### ENUM GtkEntryIconPosition ##### -->
<para>
-
+Specifies the side of the entry at which an icon is placed.
</para>
- GTK_ENTRY_ICON_PRIMARY:
- GTK_ENTRY_ICON_SECONDARY:
+ GTK_ENTRY_ICON_PRIMARY: At the beginning of the entry (depending on the text direction).
+ GTK_ENTRY_ICON_SECONDARY: At the end of the entry (depending on the text direction).
<!-- ##### FUNCTION gtk_entry_set_icon_from_pixbuf ##### -->
<para>
Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c (original)
+++ trunk/gtk/gtkentry.c Wed Dec 31 07:29:23 2008
@@ -172,8 +172,8 @@
COPY_CLIPBOARD,
PASTE_CLIPBOARD,
TOGGLE_OVERWRITE,
- ICON_PRESSED,
- ICON_RELEASED,
+ ICON_PRESS,
+ ICON_RELEASE,
LAST_SIGNAL
};
@@ -1001,7 +1001,7 @@
*
* Whether the primary icon is activatable.
*
- * GTK+ emits the #GtkEntry::icon-pressed and #GtkEntry::icon-released
+ * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release
* signals only on sensitive, activatable icons.
*
* Sensitive, but non-activatable icons can be used for purely
@@ -1022,7 +1022,7 @@
*
* Whether the secondary icon is activatable.
*
- * GTK+ emits the #GtkEntry::icon-pressed and #GtkEntry::icon-released
+ * GTK+ emits the #GtkEntry::icon-press and #GtkEntry::icon-release
* signals only on sensitive, activatable icons.
*
* Sensitive, but non-activatable icons can be used for purely
@@ -1045,7 +1045,7 @@
* Whether the primary icon is sensitive.
*
* An insensitive icon appears grayed out. GTK+ does not emit the
- * #GtkEntry::icon-pressed and #GtkEntry::icon-released signals and
+ * #GtkEntry::icon-press and #GtkEntry::icon-release signals and
* does not allow DND from insensitive icons.
*
* An icon should be set insensitive if the action that would trigger
@@ -1067,7 +1067,7 @@
* Whether the secondary icon is sensitive.
*
* An insensitive icon appears grayed out. GTK+ does not emit the
- * #GtkEntry::icon-pressed and #GtkEntry::icon-released signals and
+ * #GtkEntry::icon-press and #GtkEntry::icon-release signals and
* does not allow DND from insensitive icons.
*
* An icon should be set insensitive if the action that would trigger
@@ -1335,18 +1335,18 @@
G_TYPE_NONE, 0);
/**
- * GtkEntry::icon-pressed:
+ * GtkEntry::icon-press:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
* @event: the button press event
*
- * The ::icon-pressed signal is emitted when an activatable icon
+ * The ::icon-press signal is emitted when an activatable icon
* is clicked.
*
* Since: 2.16
*/
- signals[ICON_PRESSED] =
- g_signal_new (I_("icon-pressed"),
+ signals[ICON_PRESS] =
+ g_signal_new (I_("icon-press"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0,
@@ -1354,21 +1354,21 @@
_gtk_marshal_VOID__ENUM_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_ENTRY_ICON_POSITION,
- GDK_TYPE_EVENT);
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
- * GtkEntry::icon-released:
+ * GtkEntry::icon-release:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
* @event: the button release event
*
- * The ::icon-released signal is emitted on the button release from a
+ * The ::icon-release signal is emitted on the button release from a
* mouse click over an activatable icon.
*
* Since: 2.16
*/
- signals[ICON_RELEASED] =
- g_signal_new (I_("icon-released"),
+ signals[ICON_RELEASE] =
+ g_signal_new (I_("icon-release"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
0,
@@ -1376,7 +1376,7 @@
_gtk_marshal_VOID__ENUM_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_ENTRY_ICON_POSITION,
- GDK_TYPE_EVENT);
+ GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/*
@@ -3239,7 +3239,7 @@
icon_info->pressed = TRUE;
if (!icon_info->nonactivatable)
- g_signal_emit (entry, signals[ICON_PRESSED], 0, i, event);
+ g_signal_emit (entry, signals[ICON_PRESS], 0, i, event);
return TRUE;
}
@@ -3427,7 +3427,7 @@
}
if (!icon_info->nonactivatable)
- g_signal_emit (entry, signals[ICON_RELEASED], 0, i, event);
+ g_signal_emit (entry, signals[ICON_RELEASE], 0, i, event);
return TRUE;
}
Modified: trunk/tests/testentryicons.c
==============================================================================
--- trunk/tests/testentryicons.c (original)
+++ trunk/tests/testentryicons.c Wed Dec 31 07:29:23 2008
@@ -41,6 +41,20 @@
}
static void
+drag_begin_cb (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer user_data)
+{
+ gint pos;
+
+ pos = gtk_entry_get_current_icon_drag_source (GTK_ENTRY (widget));
+ if (pos != -1)
+ gtk_drag_set_icon_stock (context, GTK_STOCK_INFO, 2, 2);
+
+ g_print ("drag begin %d\n", pos);
+}
+
+static void
drag_data_get_cb (GtkWidget *widget,
GdkDragContext *context,
GtkSelectionData *data,
@@ -154,6 +168,8 @@
gtk_entry_set_icon_drag_source (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
tlist, GDK_ACTION_COPY);
+ g_signal_connect_after (entry, "drag-begin",
+ G_CALLBACK (drag_begin_cb), NULL);
g_signal_connect (entry, "drag-data-get",
G_CALLBACK (drag_data_get_cb), NULL);
gtk_target_list_unref (tlist);
@@ -184,7 +200,7 @@
GTK_ENTRY_ICON_SECONDARY,
GTK_STOCK_CLEAR);
- g_signal_connect (entry, "icon-pressed", G_CALLBACK (clear_pressed), NULL);
+ g_signal_connect (entry, "icon-press", G_CALLBACK (clear_pressed), NULL);
button = gtk_button_new_with_label ("Properties");
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]