From: Darren S. <li...@yo...> - 2007-03-26 13:55:41
|
# HG changeset patch # User Darren Salt <li...@yo...> # Date 1174917311 -3600 # Node ID 53a7ee29ec4206d988c66296f612762ab048da63 # Parent 2f38e3032b74f590c951e54557b899f3e2500ff5 Create a separate GtkUIManager for the systray icon menu to avoid GTK warnings. diff -r 53a7ee29ec4206d988c66296f612762ab048da63 -r 2f38e3032b74f590c951e54557b899f3e2500ff5 src/systray.c --- a/src/systray.c Mon Mar 26 14:55:11 2007 +0100 +++ b/src/systray.c Mon Mar 26 14:53:43 2007 +0100 @@ -127,6 +127,8 @@ JS_CB (Pause, "if (!is_live_stream ()) p JS_CB (Pause, "if (!is_live_stream ()) pause ();") JS_CB (FFwd, "if (!is_live_stream ()) av_speed.v = 5;") JS_CB (Stop, "stop ();") +JS_CB (Playlist, "playlist_show ();") +JS_CB (Quit, "exit ();") #define CB(name, stock, label, key) \ { #name, (stock), (label), (key), NULL, G_CALLBACK(js_##name##_cb) } @@ -138,6 +140,8 @@ static const GtkActionEntry popup_action CB(FFwd, GTK_STOCK_MEDIA_FORWARD, N_("_Fast forward"), NULL), CB(Stop, GTK_STOCK_MEDIA_STOP, N_("_Stop"), NULL), CB(NextTrack, GTK_STOCK_MEDIA_NEXT, N_("_Next track"), NULL), + CB(Playlist, GTK_STOCK_INDEX, N_("Play_list..."), NULL), + CB(Quit, GTK_STOCK_QUIT, N_("_Quit"), NULL), }; static const char popup_menu_xml[] = @@ -203,12 +207,13 @@ void systray_init (void) gdk_window_add_filter (gdk_screen_get_root_window (screen), systray_filter, NULL); - GtkActionGroup *action = ui_get_action_group (ui); + GtkUIManager *st_ui = ui_create_manager ("systray", tray_icon); + GtkActionGroup *action = ui_get_action_group (st_ui); gtk_action_group_add_actions (action, popup_actions, G_N_ELEMENTS (popup_actions), NULL); GError *error = NULL; - gtk_ui_manager_add_ui_from_string (ui, popup_menu_xml, -1, &error); - tray_menu = gtk_ui_manager_get_widget (ui, "/ui/tray"); + gtk_ui_manager_add_ui_from_string (st_ui, popup_menu_xml, -1, &error); + tray_menu = gtk_ui_manager_get_widget (st_ui, "/ui/tray"); static const char items[][16] = { [Control_STOP] = "/ui/tray/Stop", @@ -218,7 +223,7 @@ void systray_init (void) }; for (int i = 0; i < G_N_ELEMENTS (items); ++i) if (items[i][0]) - ui_register_control_button (i, gtk_ui_manager_get_widget (ui, items[i])); + ui_register_control_button (i, gtk_ui_manager_get_widget (st_ui, items[i])); gdk_window_set_events (tray_icon->window, gdk_window_get_events (tray_icon->window) | GDK_BUTTON_PRESS_MASK); |