Skip to content

Commit

Permalink
preferences: move plugin manager into the preferences dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Matthew committed Sep 3, 2019
1 parent 6218ed6 commit 1fbcba1
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 68 deletions.
1 change: 1 addition & 0 deletions data/ui/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 0 additions & 4 deletions data/ui/app-menu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
29 changes: 29 additions & 0 deletions data/ui/plugin-prefs.ui
Original file line number Diff line number Diff line change
@@ -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>
1 change: 1 addition & 0 deletions po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
64 changes: 0 additions & 64 deletions shell/rb-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 },
Expand Down
8 changes: 8 additions & 0 deletions shell/rb-shell-preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions shell/rhythmbox.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 1fbcba1

Please sign in to comment.