[prev in list] [next in list] [prev in thread] [next in thread]
List: xine-cvslog
Subject: [xine-cvs] HG: gxine: Merge the tray icon menu code into the main
From: Darren Salt <linux () youmustbejoking ! demon ! co ! uk>
Date: 2009-03-25 18:59:03
Message-ID: 41bdf0a3c16a6ec8c513.1238004108 () hg ! debian ! org
[Download RAW message or body]
# HG changeset patch
# User Darren Salt <linux@youmustbejoking.demon.co.uk>
# Date 1238004108 0
# Node ID 41bdf0a3c16a6ec8c5137583c8aaeccbed932101
# Parent 26c6978eb199527ab3b79d4e16edd7888ceb51a4
Merge the tray icon menu code into the main menu code.
Creation is still handled by the tray icon code, though.
diff -r 41bdf0a3c16a6ec8c5137583c8aaeccbed932101 -r \
26c6978eb199527ab3b79d4e16edd7888ceb51a4 src/menu.c
--- a/src/menu.c Wed Mar 25 18:01:48 2009 +0000
+++ b/src/menu.c Wed Mar 25 16:52:11 2009 +0000
@@ -329,6 +329,14 @@ JS_CB (SetupWizards, "run_wizards ();")
#ifdef HAVE_LIRC
JS_CB (ReloadLIRC, "reload_lirc ();")
#endif
+
+/* Systray */
+JS_CB (PrevTrack, "playlist_play (playlist_get_item () - 1);")
+JS_CB (NextTrack, "playlist_play (playlist_get_item () + 1);")
+JS_CB (Play, "play ();")
+JS_CB (Pause, "if (!is_live_stream ()) pause ();")
+JS_CB (FFwd, "if (!is_live_stream ()) av_speed.v = 5;")
+JS_CB (Stop, "stop ();")
#define CB(name, stock, label, key) \
{ #name, (stock), (label), (key), NULL, G_CALLBACK(js_##name##_cb) }
@@ -380,6 +388,12 @@ static const GtkActionEntry main_actions
CB(SetupWizards, GTK_STOCK_REDO, N_("_Re-run setup wizards..."), NULL),
{ "HelpMenu", NULL, N_("_Help"), NULL },
CB(About, GTK_STOCK_ABOUT, N_("_About..."), NULL),
+ CB(PrevTrack, GTK_STOCK_MEDIA_PREVIOUS, N_("Pre_vious track"), NULL),
+ CB(Play, GTK_STOCK_MEDIA_PLAY, N_("_Play"), NULL),
+ CB(Pause, GTK_STOCK_MEDIA_PAUSE, N_("_Pause"), NULL),
+ 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),
};
#undef CB
diff -r 41bdf0a3c16a6ec8c5137583c8aaeccbed932101 -r \
26c6978eb199527ab3b79d4e16edd7888ceb51a4 src/systray.c
--- a/src/systray.c Wed Mar 25 18:01:48 2009 +0000
+++ b/src/systray.c Wed Mar 25 16:52:11 2009 +0000
@@ -112,38 +112,6 @@ systray_update (void)
}
}
-/* Standard callback (invokes Javascript) */
-#define JS_CB(func, command) \
- static void js_##func##_cb (GtkAction *action, gpointer data) \
- { \
- char *fn = g_strdup_printf (_("menu function %s"), #func); \
- engine_exec ((command), NULL, NULL, fn); \
- free (fn); \
- }
-
-JS_CB (PrevTrack, "playlist_play (playlist_get_item () - 1);")
-JS_CB (NextTrack, "playlist_play (playlist_get_item () + 1);")
-JS_CB (Play, "play ();")
-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) }
-
-static const GtkActionEntry popup_actions[] = {
- CB(PrevTrack, GTK_STOCK_MEDIA_PREVIOUS, N_("Pre_vious track"), NULL),
- CB(Play, GTK_STOCK_MEDIA_PLAY, N_("_Play"), NULL),
- CB(Pause, GTK_STOCK_MEDIA_PAUSE, N_("_Pause"), NULL),
- 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[] =
"<ui><popup name='tray'>\n"
"<menuitem action='PrevTrack' />\n"
@@ -207,13 +175,9 @@ void systray_init (void)
gdk_window_add_filter (gdk_screen_get_root_window (screen),
systray_filter, NULL);
- 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 (st_ui, popup_menu_xml, -1, &error);
- tray_menu = gtk_ui_manager_get_widget (st_ui, "/ui/tray");
+ gtk_ui_manager_add_ui_from_string (ui, popup_menu_xml, -1, &error);
+ tray_menu = gtk_ui_manager_get_widget (ui, "/ui/tray");
static const char items[][16] = {
[Control_STOP] = "/ui/tray/Stop",
@@ -223,7 +187,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 (st_ui, items[i]));
+ ui_register_control_button (i, gtk_ui_manager_get_widget (ui, items[i]));
gdk_window_set_events (tray_icon->window,
gdk_window_get_events (tray_icon->window) | GDK_BUTTON_PRESS_MASK);
------------------------------------------------------------------------------
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic