[totem] main: Move Plugins dialogue to Preferences



commit 6443cc1aaf098f42a9b3310e0f544ab24965a9a5
Author: Bastien Nocera <hadess hadess net>
Date:   Tue May 7 16:29:55 2013 +0200

    main: Move Plugins dialogue to Preferences
    
    We have a button to launch the plugins dialogue in the preferences
    now, instead of a menu item.

 data/preferences.ui     |   61 +++++++++++++++++++++++++++++++++++++++++++++++
 data/totem.ui           |    9 -------
 src/totem-menu.c        |   55 ------------------------------------------
 src/totem-preferences.c |   59 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 120 insertions(+), 64 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index 0b7e976..e6399b5 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -525,6 +525,67 @@
                  <property name="fill">True</property>
                </packing>
              </child>
+              <child>
+                <object class="GtkVBox" id="vbox3">
+                  <property name="visible">True</property>
+                  <property name="can_focus">False</property>
+                  <property name="spacing">6</property>
+                  <child>
+                    <object class="GtkLabel" id="tpw_plugins_label">
+                      <property name="visible">True</property>
+                      <property name="can_focus">False</property>
+                      <property name="xalign">0</property>
+                      <property name="label" translatable="yes">Plugins</property>
+                      <property name="use_markup">True</property>
+                      <attributes>
+                        <attribute name="weight" value="bold"/>
+                      </attributes>
+                    </object>
+                    <packing>
+                      <property name="expand">False</property>
+                      <property name="fill">False</property>
+                      <property name="position">0</property>
+                    </packing>
+                  </child>
+                  <child>
+                    <object class="GtkAlignment" id="alignment3_1">
+                      <property name="visible">True</property>
+                      <property name="can_focus">False</property>
+                      <property name="left_padding">12</property>
+                      <child>
+                        <object class="GtkTable" id="table3_1">
+                          <property name="visible">True</property>
+                          <property name="can_focus">False</property>
+                          <property name="n_columns">2</property>
+                          <property name="column_spacing">12</property>
+                          <property name="row_spacing">6</property>
+                          <child>
+                            <object class="GtkButton" id="tpw_plugins_button">
+                              <property name="label" translatable="yes">Plugins...</property>
+                              <property name="visible">True</property>
+                              <property name="can_focus">True</property>
+                              <property name="receives_default">True</property>
+                            </object>
+                            <packing>
+                              <property name="right_attach">2</property>
+                            </packing>
+                          </child>
+                        </object>
+                      </child>
+                    </object>
+                    <packing>
+                      <property name="expand">False</property>
+                      <property name="fill">True</property>
+                      <property name="position">1</property>
+                    </packing>
+                  </child>
+                </object>
+                <packing>
+                  <property name="expand">False</property>
+                  <property name="fill">True</property>
+                  <property name="position">3</property>
+                </packing>
+              </child>
            </object>
            <packing>
              <property name="tab_expand">False</property>
diff --git a/data/totem.ui b/data/totem.ui
index ae9e031..78dba67 100644
--- a/data/totem.ui
+++ b/data/totem.ui
@@ -105,13 +105,6 @@
                <signal name="activate" handler="clear_playlist_action_callback"/>
             </object>
          </child>
-         <child>
-            <object class="GtkAction" id="plugins">
-               <property name="label" translatable="yes">Plugins...</property>
-               <property name="tooltip" translatable="yes">Configure plugins to extend the 
application</property>
-               <signal name="activate" handler="plugins_action_callback"/>
-            </object>
-         </child>
 
          <child>
             <object class="GtkAction" id="view-menu">
@@ -352,8 +345,6 @@
          </menu>
          <menu name="edit" action="edit-menu">
             <menuitem name="clear-playlist" action="clear-playlist"/>
-            <separator/>
-            <menuitem name="plugins" action="plugins"/>
          </menu>
          <menu name="view" action="view-menu">
             <menuitem name="zoom-toggle" action="zoom-toggle"/>
diff --git a/src/totem-menu.c b/src/totem-menu.c
index 4ae51c4..d0de411 100644
--- a/src/totem-menu.c
+++ b/src/totem-menu.c
@@ -27,7 +27,6 @@
 #define GST_USE_UNSTABLE_API 1
 #include <gst/tag/tag.h>
 #include <string.h>
-#include <libpeas-gtk/peas-gtk-plugin-manager.h>
 
 #include "totem-menu.h"
 #include "totem.h"
@@ -59,7 +58,6 @@ G_MODULE_EXPORT void skip_forward_action_callback (GtkAction *action, Totem *tot
 G_MODULE_EXPORT void skip_backwards_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void volume_up_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void volume_down_action_callback (GtkAction *action, Totem *totem);
-G_MODULE_EXPORT void plugins_action_callback (GtkAction *action, Totem *totem);
 G_MODULE_EXPORT void show_sidebar_action_callback (GtkToggleAction *action, Totem *totem);
 G_MODULE_EXPORT void aspect_ratio_changed_callback (GtkRadioAction *action, GtkRadioAction *current, Totem 
*totem);
 G_MODULE_EXPORT void select_subtitle_action_callback (GtkAction *action, Totem *totem);
@@ -561,59 +559,6 @@ volume_down_action_callback (GtkAction *action, Totem *totem)
        totem_action_volume_relative (totem, VOLUME_DOWN_OFFSET);
 }
 
-static gboolean
-totem_plugins_window_delete_cb (GtkWidget *window,
-                                  GdkEventAny *event,
-                                  gpointer data)
-{
-       gtk_widget_hide (window);
-
-       return TRUE;
-}
-
-static void
-totem_plugins_response_cb (GtkDialog *dialog,
-                             int response_id,
-                             gpointer data)
-{
-       gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-
-void
-plugins_action_callback (GtkAction *action, Totem *totem)
-{
-       if (totem->plugins == NULL) {
-               GtkWidget *manager;
-
-               totem->plugins = gtk_dialog_new_with_buttons (_("Configure Plugins"),
-                                                             GTK_WINDOW (totem->win),
-                                                             GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                             GTK_STOCK_CLOSE,
-                                                             GTK_RESPONSE_CLOSE,
-                                                             NULL);
-               gtk_container_set_border_width (GTK_CONTAINER (totem->plugins), 5);
-               gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (totem->plugins))), 2);
-
-               g_signal_connect_object (G_OBJECT (totem->plugins),
-                                        "delete_event",
-                                        G_CALLBACK (totem_plugins_window_delete_cb),
-                                        NULL, 0);
-               g_signal_connect_object (G_OBJECT (totem->plugins),
-                                        "response",
-                                        G_CALLBACK (totem_plugins_response_cb),
-                                        NULL, 0);
-
-               manager = peas_gtk_plugin_manager_new (NULL);
-               gtk_widget_show_all (GTK_WIDGET (manager));
-               gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (totem->plugins))),
-                                   manager, TRUE, TRUE, 0);
-               gtk_window_set_default_size (GTK_WINDOW (totem->plugins), 600, 400);
-       }
-
-       gtk_window_present (GTK_WINDOW (totem->plugins));
-}
-
 void
 show_sidebar_action_callback (GtkToggleAction *action, Totem *totem)
 {
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index a1e0c1a..e296183 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -34,6 +34,7 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <libpeas-gtk/peas-gtk-plugin-manager.h>
 
 #include "bacon-video-widget-enums.h"
 #include "totem.h"
@@ -263,6 +264,59 @@ visualization_quality_writable_changed_cb (GSettings *settings, const gchar *key
        gtk_widget_set_sensitive (PWID ("tpw_visuals_size_combobox"), writable && show_visualizations);
 }
 
+static gboolean
+totem_plugins_window_delete_cb (GtkWidget *window,
+                                  GdkEventAny *event,
+                                  gpointer data)
+{
+       gtk_widget_hide (window);
+
+       return TRUE;
+}
+
+static void
+totem_plugins_response_cb (GtkDialog *dialog,
+                             int response_id,
+                             gpointer data)
+{
+       gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static void
+plugin_button_clicked_cb (GtkButton *button,
+                         Totem     *totem)
+{
+       if (totem->plugins == NULL) {
+               GtkWidget *manager;
+
+               totem->plugins = gtk_dialog_new_with_buttons (_("Configure Plugins"),
+                                                             GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET 
(button))),
+                                                             GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                             GTK_STOCK_CLOSE,
+                                                             GTK_RESPONSE_CLOSE,
+                                                             NULL);
+               gtk_container_set_border_width (GTK_CONTAINER (totem->plugins), 5);
+               gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (totem->plugins))), 2);
+
+               g_signal_connect_object (G_OBJECT (totem->plugins),
+                                        "delete_event",
+                                        G_CALLBACK (totem_plugins_window_delete_cb),
+                                        NULL, 0);
+               g_signal_connect_object (G_OBJECT (totem->plugins),
+                                        "response",
+                                        G_CALLBACK (totem_plugins_response_cb),
+                                        NULL, 0);
+
+               manager = peas_gtk_plugin_manager_new (NULL);
+               gtk_widget_show_all (GTK_WIDGET (manager));
+               gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (totem->plugins))),
+                                   manager, TRUE, TRUE, 0);
+               gtk_window_set_default_size (GTK_WINDOW (totem->plugins), 600, 400);
+       }
+
+       gtk_window_present (GTK_WINDOW (totem->plugins));
+}
+
 void
 totem_setup_preferences (Totem *totem)
 {
@@ -354,6 +408,11 @@ totem_setup_preferences (Totem *totem)
        item = POBJ ("tpw_auto_chapters_checkbutton");
        g_settings_bind (totem->settings, "autoload-chapters", item, "active", G_SETTINGS_BIND_DEFAULT);
 
+       /* Plugins button */
+       item = POBJ ("tpw_plugins_button");
+       g_signal_connect (G_OBJECT (item), "clicked",
+                         G_CALLBACK (plugin_button_clicked_cb), totem);
+
        /* Visuals list */
        list = bacon_video_widget_get_visualization_list (totem->bvw);
        menu = gtk_menu_new ();


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