[rhythmbox] preferences: move plugin manager into the preferences dialog



commit 1fbcba18130fdd4022830d88a495db4c9323f000
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sun Aug 28 18:41:16 2016 +1000

    preferences: move plugin manager into the preferences dialog

 data/ui/Makefile.am           |  1 +
 data/ui/app-menu.ui           |  4 ---
 data/ui/plugin-prefs.ui       | 29 ++++++++++++++++++++
 po/POTFILES.in                |  1 +
 shell/rb-application.c        | 64 -------------------------------------------
 shell/rb-shell-preferences.c  |  8 ++++++
 shell/rhythmbox.gresource.xml |  1 +
 7 files changed, 40 insertions(+), 68 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 315560197..cf704c81c 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -19,6 +19,7 @@ GTK_BUILDER_FILES =                                   \
        playlist-popup.ui                               \
        playlist-save.ui                                \
        playlist-toolbar.ui                             \
+       plugin-prefis.ui                                \
        podcast-add-dialog.ui                           \
        podcast-feed-properties.ui                      \
        podcast-popups.ui                               \
diff --git a/data/ui/app-menu.ui b/data/ui/app-menu.ui
index 883db89ca..d3d722037 100644
--- a/data/ui/app-menu.ui
+++ b/data/ui/app-menu.ui
@@ -43,10 +43,6 @@
       </submenu>
     </section>
     <section>
-      <item>
-       <attribute name="label" translatable="yes">P_lugins</attribute>
-       <attribute name="action">app.plugins</attribute>
-      </item>
       <item>
        <attribute name="label" translatable="yes">_Preferences</attribute>
        <attribute name="action">app.preferences</attribute>
diff --git a/data/ui/plugin-prefs.ui b/data/ui/plugin-prefs.ui
new file mode 100644
index 000000000..c4f02c57a
--- /dev/null
+++ b/data/ui/plugin-prefs.ui
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <requires lib="libpeas-gtk" version="1.0"/>
+  <object class="GtkBox" id="plugins_box">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">0</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">18</property>
+    <child>
+      <object class="PeasGtkPluginManager">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="orientation">vertical</property>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2f3dc1add..88190b12c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -26,6 +26,7 @@ data/rhythmbox-device.desktop.in.in
 [type: gettext/glade]data/ui/playlist-popup.ui
 [type: gettext/glade]data/ui/playlist-save.ui
 [type: gettext/glade]data/ui/playlist-toolbar.ui
+[type: gettext/glade]data/ui/plugin-prefs.ui
 [type: gettext/glade]data/ui/podcast-add-dialog.ui
 [type: gettext/glade]data/ui/podcast-feed-properties.ui
 [type: gettext/glade]data/ui/podcast-popups.ui
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 1dbde18d3..bb10b7b34 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -30,9 +30,6 @@
 
 #include <glib/gi18n.h>
 
-#include <libpeas/peas.h>
-#include <libpeas-gtk/peas-gtk.h>
-
 #include <shell/rb-application.h>
 #include <shell/rb-shell.h>
 #include <lib/rb-debug.h>
@@ -129,66 +126,6 @@ quit_action_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
        rb_shell_quit (RB_SHELL (rb->priv->shell), NULL);
 }
 
-static gboolean
-plugins_window_delete_cb (GtkWidget *window,
-                         GdkEventAny *event,
-                         gpointer data)
-{
-       gtk_widget_hide (window);
-       return TRUE;
-}
-
-static void
-plugins_response_cb (GtkDialog *dialog,
-                    int response_id,
-                    gpointer data)
-{
-       if (response_id == GTK_RESPONSE_CLOSE)
-               gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-static void
-plugins_action_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
-{
-       RBApplication *app = RB_APPLICATION (user_data);
-
-       if (app->priv->plugins == NULL) {
-               GtkWidget *content_area;
-               GtkWidget *manager;
-               GtkWindow *window;
-
-               g_object_get (app->priv->shell, "window", &window, NULL);
-
-               app->priv->plugins = gtk_dialog_new_with_buttons (_("Configure Plugins"),
-                                                                 window,
-                                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                 _("_Close"),
-                                                                 GTK_RESPONSE_CLOSE,
-                                                                 NULL);
-               content_area = gtk_dialog_get_content_area (GTK_DIALOG (app->priv->plugins));
-               gtk_container_set_border_width (GTK_CONTAINER (app->priv->plugins), 5);
-               gtk_box_set_spacing (GTK_BOX (content_area), 2);
-
-               g_signal_connect_object (G_OBJECT (app->priv->plugins),
-                                        "delete_event",
-                                        G_CALLBACK (plugins_window_delete_cb),
-                                        NULL, 0);
-               g_signal_connect_object (G_OBJECT (app->priv->plugins),
-                                        "response",
-                                        G_CALLBACK (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 (content_area), manager, TRUE, TRUE, 0);
-               gtk_window_set_default_size (GTK_WINDOW (app->priv->plugins), 600, 400);
-
-               g_object_unref (window);
-       }
-
-       gtk_window_present (GTK_WINDOW (app->priv->plugins));
-}
-
 static void
 preferences_action_cb (GSimpleAction *action, GVariant *parameters, gpointer user_data)
 {
@@ -363,7 +300,6 @@ impl_startup (GApplication *app)
                { "activate-source", activate_source_action_cb, "(su)" },
 
                /* app menu actions */
-               { "plugins", plugins_action_cb },
                { "preferences", preferences_action_cb },
                { "help", help_action_cb },
                { "about", about_action_cb },
diff --git a/shell/rb-shell-preferences.c b/shell/rb-shell-preferences.c
index 7073bcc1b..7b91f926c 100644
--- a/shell/rb-shell-preferences.c
+++ b/shell/rb-shell-preferences.c
@@ -398,6 +398,7 @@ GtkWidget *
 rb_shell_preferences_new (GList *views)
 {
        RBShellPreferences *shell_preferences;
+       GtkBuilder *builder;
 
        shell_preferences = g_object_new (RB_TYPE_SHELL_PREFERENCES,
                                          NULL, NULL);
@@ -420,6 +421,13 @@ rb_shell_preferences_new (GList *views)
                g_free (name);
        }
 
+       /* make sure this goes last */
+       builder = rb_builder_load ("plugin-prefs.ui", NULL);
+       gtk_notebook_append_page (GTK_NOTEBOOK (shell_preferences->priv->notebook),
+                                 GTK_WIDGET (gtk_builder_get_object (builder, "plugins_box")),
+                                 gtk_label_new (_("Plugins")));
+       g_object_unref (builder);
+
        return GTK_WIDGET (shell_preferences);
 }
 
diff --git a/shell/rhythmbox.gresource.xml b/shell/rhythmbox.gresource.xml
index 9f054f404..db5af4e46 100644
--- a/shell/rhythmbox.gresource.xml
+++ b/shell/rhythmbox.gresource.xml
@@ -27,6 +27,7 @@
                <file preprocess="xml-stripblanks">ui/playlist-popup.ui</file>
                <file preprocess="xml-stripblanks">ui/playlist-save.ui</file>
                <file preprocess="xml-stripblanks">ui/playlist-toolbar.ui</file>
+               <file preprocess="xml-stripblanks">ui/plugin-prefs.ui</file>
                <file preprocess="xml-stripblanks">ui/podcast-add-dialog.ui</file>
                <file preprocess="xml-stripblanks">ui/podcast-feed-properties.ui</file>
                <file preprocess="xml-stripblanks">ui/podcast-popups.ui</file>


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