[totem] main: Move Go menu contents to controls bar



commit db1dd5a95d3e203de8786a3ed038505d3a5f01bd
Author: Bastien Nocera <hadess hadess net>
Date:   Wed May 8 18:45:34 2013 +0200

    main: Move Go menu contents to controls bar

 data/totem.ui       |   71 ++++++++++++++++----------------------------
 src/totem-menu.c    |   80 ++++++++++++++++++++++++++++----------------------
 src/totem-object.c  |   14 +++++----
 src/totem-private.h |    7 ++++
 4 files changed, 86 insertions(+), 86 deletions(-)
---
diff --git a/data/totem.ui b/data/totem.ui
index b6e53d5..2dd9e6c 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -66,6 +66,32 @@
        </section>
 </menu>
 
+<menu id="gomenu">
+       <section>
+               <item>
+                       <attribute name="label" translatable="yes">_DVD Menu</attribute>
+                       <attribute name="action">app.dvd-root-menu</attribute>
+                       <attribute name="accel">&lt;Ctrl&gt;M</attribute>
+               </item>
+               <item>
+                       <attribute name="label" translatable="yes">_Title Menu</attribute>
+                       <attribute name="action">app.dvd-title-menu</attribute>
+               </item>
+               <item>
+                       <attribute name="label" translatable="yes">A_udio Menu</attribute>
+                       <attribute name="action">app.dvd-audio-menu</attribute>
+               </item>
+               <item>
+                       <attribute name="label" translatable="yes">_Angle Menu</attribute>
+                       <attribute name="action">app.dvd-angle-menu</attribute>
+               </item>
+               <item>
+                       <attribute name="label" translatable="yes">_Chapter Menu</attribute>
+                       <attribute name="action">app.dvd-chapter-menu</attribute>
+               </item>
+       </section>
+</menu>
+
 <object class="GtkUIManager" id="totem-ui-manager">
    <child>
       <object class="GtkActionGroup" id="main-action-group">
@@ -146,45 +172,6 @@
             </object>
          </child>
          <child>
-            <object class="GtkAction" id="dvd-root-menu">
-               <property name="label" translatable="yes">_DVD Menu</property>
-               <property name="stock-id">gtk-index</property>
-               <property name="tooltip" translatable="yes">Go to the DVD menu</property>
-               <signal name="activate" handler="dvd_root_menu_action_callback"/>
-            </object>
-            <accelerator key="M" modifiers="GDK_CONTROL_MASK"/>
-         </child>
-         <child>
-            <object class="GtkAction" id="dvd-title-menu">
-               <property name="label" translatable="yes">_Title Menu</property>
-               <property name="tooltip" translatable="yes">Go to the title menu</property>
-               <signal name="activate" handler="dvd_title_menu_action_callback"/>
-            </object>
-         </child>
-         <child>
-            <object class="GtkAction" id="dvd-audio-menu">
-               <property name="label" translatable="yes">A_udio Menu</property>
-               <property name="tooltip" translatable="yes">Go to the audio menu</property>
-               <signal name="activate" handler="dvd_audio_menu_action_callback"/>
-            </object>
-         </child>
-         <child>
-            <object class="GtkAction" id="dvd-angle-menu">
-               <property name="label" translatable="yes">_Angle Menu</property>
-               <property name="tooltip" translatable="yes">Go to the angle menu</property>
-               <signal name="activate" handler="dvd_angle_menu_action_callback"/>
-            </object>
-         </child>
-         <child>
-            <object class="GtkAction" id="dvd-chapter-menu">
-               <property name="label" translatable="yes">_Chapter Menu</property>
-               <property name="stock-id">gtk-index</property>
-               <property name="tooltip" translatable="yes">Go to the chapter menu</property>
-               <signal name="activate" handler="dvd_chapter_menu_action_callback"/>
-            </object>
-            <accelerator key="C" modifiers="GDK_CONTROL_MASK"/>
-         </child>
-         <child>
             <object class="GtkAction" id="next-chapter">
                <property name="label" translatable="yes">_Next Chapter/Movie</property>
                <property name="icon-name">media-skip-forward-symbolic</property>
@@ -376,12 +363,6 @@
             <placeholder name="sidebars-placeholder"/>
          </menu>
          <menu name="go" action="go-menu">
-            <menuitem name="dvd-root-menu" action="dvd-root-menu"/>
-            <menuitem name="dvd-title-menu" action="dvd-title-menu"/>
-            <menuitem name="dvd-audio-menu" action="dvd-audio-menu"/>
-            <menuitem name="dvd-angle-menu" action="dvd-angle-menu"/>
-            <menuitem name="dvd-chapter-menu" action="dvd-chapter-menu"/>
-            <separator/>
             <menuitem name="next-chapter" action="next-chapter"/>
             <menuitem name="previous-chapter" action="previous-chapter"/>
             <separator/>
diff --git a/src/totem-menu.c b/src/totem-menu.c
index d0de411..69353a0 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -47,11 +47,6 @@ G_MODULE_EXPORT void play_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void quit_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void zoom_toggle_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void next_angle_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void dvd_root_menu_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void dvd_title_menu_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void dvd_audio_menu_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void dvd_angle_menu_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void dvd_chapter_menu_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void next_chapter_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void previous_chapter_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void skip_forward_action_callback (GtkAction *action, Totem *totem);
@@ -154,10 +149,55 @@ quit_action_cb (GSimpleAction *action,
        totem_object_action_exit (TOTEM_OBJECT (user_data));
 }
 
+static void
+dvd_root_menu_action_cb (GSimpleAction *action,
+                        GVariant      *parameter,
+                        gpointer       user_data)
+{
+        bacon_video_widget_dvd_event (TOTEM_OBJECT (user_data)->bvw, BVW_DVD_ROOT_MENU);
+}
+
+static void
+dvd_title_menu_action_cb (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
+{
+        bacon_video_widget_dvd_event (TOTEM_OBJECT (user_data)->bvw, BVW_DVD_TITLE_MENU);
+}
+
+static void
+dvd_audio_menu_action_cb (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
+{
+        bacon_video_widget_dvd_event (TOTEM_OBJECT (user_data)->bvw, BVW_DVD_AUDIO_MENU);
+}
+
+static void
+dvd_angle_menu_action_cb (GSimpleAction *action,
+                         GVariant      *parameter,
+                         gpointer       user_data)
+{
+        bacon_video_widget_dvd_event (TOTEM_OBJECT (user_data)->bvw, BVW_DVD_ANGLE_MENU);
+}
+
+static void
+dvd_chapter_menu_action_cb (GSimpleAction *action,
+                           GVariant      *parameter,
+                           gpointer       user_data)
+{
+        bacon_video_widget_dvd_event (TOTEM_OBJECT (user_data)->bvw, BVW_DVD_CHAPTER_MENU);
+}
+
 static GActionEntry app_entries[] = {
        { "open", open_action_cb, NULL, NULL, NULL },
        { "open-location", open_location_action_cb, NULL, NULL, NULL },
        { "fullscreen", toggle_action_cb, NULL, "false", fullscreen_change_state },
+       { "dvd-root-menu", dvd_root_menu_action_cb, NULL, NULL, NULL },
+       { "dvd-title-menu", dvd_title_menu_action_cb, NULL, NULL, NULL },
+       { "dvd-audio-menu", dvd_audio_menu_action_cb, NULL, NULL, NULL },
+       { "dvd-angle-menu", dvd_angle_menu_action_cb, NULL, NULL, NULL },
+       { "dvd-chapter-menu", dvd_chapter_menu_action_cb, NULL, NULL, NULL },
        { "preferences", preferences_action_cb, NULL, NULL, NULL },
        { "shuffle", toggle_action_cb, NULL, "false", shuffle_change_state },
        { "repeat", toggle_action_cb, NULL, "false", repeat_change_state },
@@ -494,36 +534,6 @@ next_angle_action_callback (GtkAction *action, Totem *totem)
 }
 
 void
-dvd_root_menu_action_callback (GtkAction *action, Totem *totem)
-{
-        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ROOT_MENU);
-}
-
-void
-dvd_title_menu_action_callback (GtkAction *action, Totem *totem)
-{
-        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_TITLE_MENU);
-}
-
-void
-dvd_audio_menu_action_callback (GtkAction *action, Totem *totem)
-{
-        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_AUDIO_MENU);
-}
-
-void
-dvd_angle_menu_action_callback (GtkAction *action, Totem *totem)
-{
-        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_ANGLE_MENU);
-}
-
-void
-dvd_chapter_menu_action_callback (GtkAction *action, Totem *totem)
-{
-        bacon_video_widget_dvd_event (totem->bvw, BVW_DVD_CHAPTER_MENU);
-}
-
-void
 next_chapter_action_callback (GtkAction *action, Totem *totem)
 {
        TOTEM_PROFILE (totem_object_action_next (totem));
diff --git a/src/totem-object.c b/src/totem-object.c
index 4763993..0c16d33 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3656,11 +3656,11 @@ update_media_menu_items (TotemObject *totem)
 
        playing = totem_playing_dvd (totem->mrl);
 
-       totem_action_set_sensitivity ("dvd-root-menu", playing);
-       totem_action_set_sensitivity ("dvd-title-menu", playing);
-       totem_action_set_sensitivity ("dvd-audio-menu", playing);
-       totem_action_set_sensitivity ("dvd-angle-menu", playing);
-       totem_action_set_sensitivity ("dvd-chapter-menu", playing);
+       totem_action_set_sensitivity2 ("dvd-root-menu", playing);
+       totem_action_set_sensitivity2 ("dvd-title-menu", playing);
+       totem_action_set_sensitivity2 ("dvd-audio-menu", playing);
+       totem_action_set_sensitivity2 ("dvd-angle-menu", playing);
+       totem_action_set_sensitivity2 ("dvd-chapter-menu", playing);
 
        totem_action_set_sensitivity ("next-angle",
                                      bacon_video_widget_has_angles (totem->bvw));
@@ -3888,7 +3888,9 @@ totem_callback_connect (TotemObject *totem)
                          G_CALLBACK (seek_slider_changed_cb), totem);
 
        /* Go button */
-       /* FIXME */
+       item = g_object_get_data (totem->controls, "go_button");
+       menu = (GMenuModel *) gtk_builder_get_object (totem->xml, "gomenu");
+       gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (item), menu);
 
        /* Fullscreen button */
        item = g_object_get_data (bacon_video_widget_get_header_object (totem->bvw),
diff --git a/src/totem-private.h b/src/totem-private.h
index 644e141..b7eb350 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -55,6 +55,13 @@
                gtk_action_set_sensitive (__action, state);                             \
        }
 
+#define totem_action_set_sensitivity2(name, state)                                     \
+       {                                                                               \
+               GAction *__action;                                                      \
+               __action = g_action_map_lookup_action (G_ACTION_MAP (totem), name);     \
+               g_simple_action_set_enabled (G_SIMPLE_ACTION (__action), state);        \
+       }
+
 typedef enum {
        TOTEM_CONTROLS_UNDEFINED,
        TOTEM_CONTROLS_VISIBLE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]