Position the dialog with GTK_WIN_POS_CENTER. (do_quit): New function, hide

2005-11-03  Tor Lillqvist  <tml@novell.com>

	* 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().
This commit is contained in:
Tor Lillqvist 2005-11-03 12:09:49 +00:00 committed by Tor Lillqvist
parent a9340696a2
commit 542aedc182
3 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2005-11-03 Tor Lillqvist <tml@novell.com>
* 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 <tml@novell.com>
* gdk/win32/gdkcolor-win32.c

View File

@ -1,3 +1,11 @@
2005-11-03 Tor Lillqvist <tml@novell.com>
* 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 <tml@novell.com>
* gdk/win32/gdkcolor-win32.c

View File

@ -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);