[rhythmbox/media-player-sync] media-player: explicitly set up media player source action group
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rhythmbox/media-player-sync] media-player: explicitly set up media player source action group
- Date: Mon, 1 Feb 2010 13:04:29 +0000 (UTC)
commit 6dfb434b0fb7d72243ae64904379215c8766512f
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Feb 1 23:00:18 2010 +1000
media-player: explicitly set up media player source action group
The ipod and mtp plugins load UI XML files referencing the sync action
from the media player source action group, so it must be registered
before that happens. Since there won't be an instance of a media player
source at that point, we need a function to explicitly register the
action group.
plugins/ipod/rb-ipod-plugin.c | 2 ++
plugins/mtpdevice/rb-mtp-plugin.c | 1 +
sources/rb-media-player-source.c | 37 ++++++++++++++++++++++++++++---------
sources/rb-media-player-source.h | 2 ++
4 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/plugins/ipod/rb-ipod-plugin.c b/plugins/ipod/rb-ipod-plugin.c
index 3f1528c..28ff127 100644
--- a/plugins/ipod/rb-ipod-plugin.c
+++ b/plugins/ipod/rb-ipod-plugin.c
@@ -167,6 +167,8 @@ impl_activate (RBPlugin *bplugin,
"ui-manager", &uimanager,
NULL);
+ rb_media_player_source_init_actions (shell);
+
/* add ipod UI */
plugin->action_group = gtk_action_group_new ("iPodActions");
gtk_action_group_set_translation_domain (plugin->action_group,
diff --git a/plugins/mtpdevice/rb-mtp-plugin.c b/plugins/mtpdevice/rb-mtp-plugin.c
index 3432bc4..b1d9351 100644
--- a/plugins/mtpdevice/rb-mtp-plugin.c
+++ b/plugins/mtpdevice/rb-mtp-plugin.c
@@ -187,6 +187,7 @@ impl_activate (RBPlugin *bplugin, RBShell *shell)
NULL);
/* ui */
+ rb_media_player_source_init_actions (shell);
plugin->action_group = gtk_action_group_new ("MTPActions");
gtk_action_group_set_translation_domain (plugin->action_group,
GETTEXT_PACKAGE);
diff --git a/sources/rb-media-player-source.c b/sources/rb-media-player-source.c
index de8b756..6ae1045 100644
--- a/sources/rb-media-player-source.c
+++ b/sources/rb-media-player-source.c
@@ -109,6 +109,30 @@ enum
PROP_DEVICE_SERIAL
};
+static GtkActionGroup *action_group = NULL;
+
+void
+rb_media_player_source_init_actions (RBShell *shell)
+{
+ GtkUIManager *uimanager;
+
+ if (action_group != NULL) {
+ return;
+ }
+
+ action_group = gtk_action_group_new ("MediaPlayerActions");
+ gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
+
+ g_object_get (shell, "ui-manager", &uimanager, NULL);
+ gtk_ui_manager_insert_action_group (uimanager, action_group, 0);
+ g_object_unref (uimanager);
+
+ _rb_action_group_add_source_actions (action_group,
+ G_OBJECT (shell),
+ rb_media_player_source_actions,
+ G_N_ELEMENTS (rb_media_player_source_actions));
+}
+
static void
rb_media_player_source_class_init (RBMediaPlayerSourceClass *klass)
{
@@ -200,15 +224,10 @@ rb_media_player_source_constructed (GObject *object)
RB_CHAIN_GOBJECT_METHOD (rb_media_player_source_parent_class, constructed, object);
g_object_get (object, "shell", &shell, NULL);
- priv->action_group = _rb_source_register_action_group (RB_SOURCE (object),
- "MediaPlayerActions",
- NULL, 0,
- NULL);
- _rb_action_group_add_source_actions (priv->action_group,
- G_OBJECT (shell),
- rb_media_player_source_actions,
- G_N_ELEMENTS (rb_media_player_source_actions));
- priv->sync_action = gtk_action_group_get_action (priv->action_group, "MediaPlayerSourceSync");
+ rb_media_player_source_init_actions (shell);
+ g_object_unref (shell);
+
+ priv->sync_action = gtk_action_group_get_action (action_group, "MediaPlayerSourceSync");
}
static gboolean
diff --git a/sources/rb-media-player-source.h b/sources/rb-media-player-source.h
index 84d3c61..10ec486 100644
--- a/sources/rb-media-player-source.h
+++ b/sources/rb-media-player-source.h
@@ -75,6 +75,8 @@ struct _RBMediaPlayerSourceClass
GType rb_media_player_source_get_type (void);
+void rb_media_player_source_init_actions (RBShell *shell);
+
void rb_media_player_source_load (RBMediaPlayerSource *source);
void rb_media_player_source_delete_entries (RBMediaPlayerSource *source,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]