[Xfce4-commits] [xfce/xfce4-panel] 44/73: When it is installed, show launcher for xfpanel-switch in the preferences
noreply at xfce.org
noreply at xfce.org
Sun Feb 26 16:34:25 CET 2017
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.
commit 300b20a345b56df2d8c1a78c192710ea7bfa7139
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sat Aug 8 15:16:20 2015 +0200
When it is installed, show launcher for xfpanel-switch in the preferences
---
panel/panel-preferences-dialog.c | 31 +++++++++++++++++++++++++++++++
panel/panel-preferences-dialog.glade | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 0b4a595..5480507 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -71,6 +71,8 @@ static void panel_preferences_dialog_panel_add
PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_panel_remove (GtkWidget *widget,
PanelPreferencesDialog *dialog);
+static void panel_preferences_dialog_panel_switch (GtkWidget *widget,
+ PanelPreferencesDialog *dialog);
static XfcePanelPluginProvider *panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog,
GtkTreeIter *return_iter);
static void panel_preferences_dialog_item_store_rebuild (GtkWidget *itembar,
@@ -176,6 +178,7 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkTreeSelection *selection;
+ gchar *path;
dialog->bindings = NULL;
dialog->application = panel_application_get ();
@@ -203,6 +206,14 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
connect_signal ("panel-remove", "clicked", panel_preferences_dialog_panel_remove);
connect_signal ("panel-combobox", "changed", panel_preferences_dialog_panel_combobox_changed);
+ /* check if panel-switch is installed and if so show button */
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-switch");
+ path = g_find_program_in_path ("xfpanel-switch");
+ if (path == NULL)
+ gtk_widget_set_visible (GTK_WIDGET (object), FALSE);
+
+ connect_signal ("panel-switch", "clicked", panel_preferences_dialog_panel_switch);
+
/* style tab */
object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-style");
panel_return_if_fail (G_IS_OBJECT (object));
@@ -897,6 +908,26 @@ panel_preferences_dialog_panel_remove (GtkWidget *widget,
+static void
+panel_preferences_dialog_panel_switch (GtkWidget *widget, PanelPreferencesDialog *dialog)
+{
+ GtkWidget *toplevel;
+ gchar *path;
+ GError *error = NULL;
+
+ path = g_find_program_in_path ("xfpanel-switch");
+ if (path == NULL)
+ return;
+
+ /* close the preferences dialog */
+ toplevel = gtk_widget_get_toplevel (widget);
+ panel_preferences_dialog_response (toplevel, 0, dialog);
+
+ /* run xfpanel-switch */
+ g_spawn_command_line_async (path, &error);
+}
+
+
static XfcePanelPluginProvider *
panel_preferences_dialog_item_get_selected (PanelPreferencesDialog *dialog,
GtkTreeIter *return_iter)
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index 0f9f73d..fb9b5ae 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -92,6 +92,11 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">package-x-generic</property>
+ </object>
<object class="GtkSizeGroup" id="display-sizegroup">
<widgets>
<widget name="label13"/>
@@ -186,6 +191,32 @@
</packing>
</child>
<child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="panel-switch">
+ <property name="label">Backup and restore</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Switch between panel presets</property>
+ <property name="image">image10</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="sensitive">False</property>
@@ -1018,7 +1049,7 @@
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list