From 844e27e365aa00a3d49055d316e5848c03118895 Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Thu, 18 May 2000 00:32:18 +0000 Subject: new signals "added_item", "removed_item", "added_group", "removed_group". 2000-05-18 Damon Chaplin * e-shortcut-bar.[hc]: new signals "added_item", "removed_item", "added_group", "removed_group". Note that the removed signals are emitted just before the item/group is actually removed. * test-shortcut-bar.c: updated to test the new signals, and ref'ed the pixbufs in the icon callback. svn path=/trunk/; revision=3111 --- widgets/shortcut-bar/test-shortcut-bar.c | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'widgets/shortcut-bar/test-shortcut-bar.c') diff --git a/widgets/shortcut-bar/test-shortcut-bar.c b/widgets/shortcut-bar/test-shortcut-bar.c index abdccddeb1..5d9ae700f3 100644 --- a/widgets/shortcut-bar/test-shortcut-bar.c +++ b/widgets/shortcut-bar/test-shortcut-bar.c @@ -84,6 +84,16 @@ static void on_set_group_button_clicked (GtkWidget *button, EShortcutBar *shortcut_bar); static void on_set_group_button_no_animation_clicked (GtkWidget *button, EShortcutBar *shortcut_bar); +static void on_item_added (EShortcutBar *shortcut_bar, + gint group_num, + gint item_num); +static void on_item_removed (EShortcutBar *shortcut_bar, + gint group_num, + gint item_num); +static void on_group_added (EShortcutBar *shortcut_bar, + gint group_num); +static void on_group_removed (EShortcutBar *shortcut_bar, + gint group_num); int main (int argc, char *argv[]) @@ -115,6 +125,15 @@ main (int argc, char *argv[]) icon_callback, NULL); + gtk_signal_connect (GTK_OBJECT (shortcut_bar), "item_added", + GTK_SIGNAL_FUNC (on_item_added), NULL); + gtk_signal_connect (GTK_OBJECT (shortcut_bar), "item_removed", + GTK_SIGNAL_FUNC (on_item_removed), NULL); + gtk_signal_connect (GTK_OBJECT (shortcut_bar), "group_added", + GTK_SIGNAL_FUNC (on_group_added), NULL); + gtk_signal_connect (GTK_OBJECT (shortcut_bar), "group_removed", + GTK_SIGNAL_FUNC (on_group_removed), NULL); + #if 0 gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4); #endif @@ -190,6 +209,7 @@ icon_callback (EShortcutBar *shortcut_bar, for (i = 0; i < NUM_SHORTCUT_TYPES; i++) { if (!strncmp (url, shortcut_types[i], strlen (shortcut_types[i]))) { + gdk_pixbuf_ref (icon_pixbufs[i]); return icon_pixbufs[i]; } } @@ -559,3 +579,37 @@ on_move_button_clicked (GtkWidget *button, e_group_bar_reorder_group (E_GROUP_BAR (shortcut_bar), 0, 3); } + + +static void +on_item_added (EShortcutBar *shortcut_bar, + gint group_num, + gint item_num) +{ + g_print ("In on_item_added Group:%i Item:%i\n", group_num, item_num); +} + + +static void +on_item_removed (EShortcutBar *shortcut_bar, + gint group_num, + gint item_num) +{ + g_print ("In on_item_removed Group:%i Item:%i\n", group_num, item_num); +} + + +static void +on_group_added (EShortcutBar *shortcut_bar, + gint group_num) +{ + g_print ("In on_group_added Group:%i\n", group_num); +} + + +static void +on_group_removed (EShortcutBar *shortcut_bar, + gint group_num) +{ + g_print ("In on_group_removed Group:%i\n", group_num); +} -- cgit v1.2.3