diff --git a/ChangeLog b/ChangeLog index e60fb04b9c..21f1d156d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-11-03 Tor Lillqvist + + * tests/teststatusicon.c (icon_activated): Position the dialog + with GTK_WIN_POS_CENTER. + (do_quit): New function, hide and unref the GtkStatusIcon, and + call gtk_main_quit(). + (popup_menu): Add a Quit menu item that calls do_quit(). + 2005-11-02 Tor Lillqvist * gdk/win32/gdkcolor-win32.c diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e60fb04b9c..21f1d156d8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2005-11-03 Tor Lillqvist + + * tests/teststatusicon.c (icon_activated): Position the dialog + with GTK_WIN_POS_CENTER. + (do_quit): New function, hide and unref the GtkStatusIcon, and + call gtk_main_quit(). + (popup_menu): Add a Quit menu item that calls do_quit(). + 2005-11-02 Tor Lillqvist * gdk/win32/gdkcolor-win32.c diff --git a/tests/teststatusicon.c b/tests/teststatusicon.c index 738181d30d..102eb3390d 100755 --- a/tests/teststatusicon.c +++ b/tests/teststatusicon.c @@ -113,6 +113,8 @@ icon_activated (GtkStatusIcon *icon) GTK_BUTTONS_CLOSE, "You wanna test the status icon ?"); + gtk_window_set_position (dialog, GTK_WIN_POS_CENTER); + g_object_set_data_full (G_OBJECT (icon), "test-status-icon-dialog", dialog, (GDestroyNotify) gtk_widget_destroy); @@ -160,6 +162,15 @@ check_activated (GtkCheckMenuItem *item, gtk_check_menu_item_get_active (item)); } +static void +do_quit (GtkMenuItem *item, + GtkStatusIcon *icon) +{ + gtk_status_icon_set_visible (icon, FALSE); + g_object_unref (icon); + gtk_main_quit (); +} + static void popup_menu (GtkStatusIcon *icon, guint button, @@ -178,6 +189,13 @@ popup_menu (GtkStatusIcon *icon, gtk_widget_show (menuitem); + menuitem = gtk_menu_item_new_with_label ("Quit"); + g_signal_connect (menuitem, "activate", G_CALLBACK (do_quit), icon); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + + gtk_widget_show (menuitem); + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, activate_time);