[totem] main: Move zoom menu item to cogwheel



commit 4508c97b64700adfe0c1bde80d015adb9eb603a2
Author: Bastien Nocera <hadess hadess net>
Date:   Thu May 9 17:28:58 2013 +0200

    main: Move zoom menu item to cogwheel

 data/totem.ui      |   15 ++++-----------
 src/totem-menu.c   |   24 +++++++++++++++---------
 src/totem-object.c |    6 +++---
 3 files changed, 22 insertions(+), 23 deletions(-)
---
diff --git a/data/totem.ui b/data/totem.ui
index d2f6ccd..71e8279 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -95,6 +95,10 @@
                                </item>
                        </section>
                </submenu>
+               <item>
+                       <attribute name="label" translatable="yes">Zoom In</attribute>
+                       <attribute name="action">app.zoom</attribute>
+               </item>
        </section>
 </menu>
 
@@ -258,15 +262,6 @@
             </object>
          </child>
 
-         <child>
-            <object class="GtkToggleAction" id="zoom-toggle">
-               <property name="label" translatable="yes">Zoom In</property>
-               <property name="stock-id">gtk-zoom-in</property>
-               <property name="tooltip" translatable="yes">Zoom in</property>
-               <signal name="activate" handler="zoom_toggle_action_callback"/>
-            </object>
-            <accelerator key="Z" modifiers="GDK_CONTROL_MASK"/>
-         </child>
       </object>
    </child>
    <ui>
@@ -282,8 +277,6 @@
             <menuitem name="clear-playlist" action="clear-playlist"/>
          </menu>
          <menu name="view" action="view-menu">
-            <menuitem name="zoom-toggle" action="zoom-toggle"/>
-            <separator/>
             <menuitem name="next-angle" action="next-angle"/>
             <separator/>
             <menu name="subtitles" action="subtitles-menu">
diff --git a/src/totem-menu.c b/src/totem-menu.c
index ddbc929..d620423 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -45,7 +45,6 @@ G_MODULE_EXPORT void eject_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void properties_action_callback (GtkAction *action, Totem *totem);
 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 next_chapter_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void previous_chapter_action_callback (GtkAction *action, Totem *totem);
@@ -116,6 +115,20 @@ aspect_ratio_action_cb (GSimpleAction *action,
 }
 
 static void
+zoom_action_change_state (GSimpleAction *action,
+                         GVariant      *value,
+                         gpointer       user_data)
+{
+       gboolean expand;
+
+       expand = g_variant_get_boolean (value);
+       bacon_video_widget_set_zoom (TOTEM_OBJECT (user_data)->bvw,
+                                    expand ? BVW_ZOOM_EXPAND : BVW_ZOOM_NONE);
+
+       g_simple_action_set_state (action, value);
+}
+
+static void
 shuffle_change_state (GSimpleAction *action,
                      GVariant      *value,
                      gpointer       user_data)
@@ -219,6 +232,7 @@ static GActionEntry app_entries[] = {
        { "dvd-angle-menu", dvd_angle_menu_action_cb, NULL, NULL, NULL },
        { "dvd-chapter-menu", dvd_chapter_menu_action_cb, NULL, NULL, NULL },
        { "aspect-ratio", aspect_ratio_action_cb, "i", "0", aspect_ratio_change_state },
+       { "zoom", toggle_action_cb, NULL, "false", zoom_action_change_state },
        { "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 },
@@ -534,14 +548,6 @@ quit_action_callback (GtkAction *action, Totem *totem)
 }
 
 void
-zoom_toggle_action_callback (GtkToggleAction *action,
-                            Totem           *totem)
-{
-       bacon_video_widget_set_zoom (totem->bvw,
-                                    gtk_toggle_action_get_active (action) ? BVW_ZOOM_EXPAND : BVW_ZOOM_NONE);
-}
-
-void
 select_subtitle_action_callback (GtkAction *action, Totem *totem)
 {
        totem_playlist_select_subtitle_dialog (totem->playlist,
diff --git a/src/totem-object.c b/src/totem-object.c
index e4e1f66..8d8f783 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1916,10 +1916,10 @@ void
 totem_action_set_zoom (TotemObject *totem,
                       gboolean     zoom)
 {
-       GtkAction *action;
+       GAction *action;
 
-       action = gtk_action_group_get_action (totem->main_action_group, "zoom-toggle");
-       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), zoom);
+       action = g_action_map_lookup_action (G_ACTION_MAP (totem), "zoom");
+       g_action_change_state (action, g_variant_new_boolean (zoom));
 }
 
 /**


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