[Xfce4-commits] [xfce/xfce4-panel] 01/01: Add support for xfce4-panel-profiles

noreply at xfce.org noreply at xfce.org
Sun Jul 15 15:53:31 CEST 2018


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-panel.

commit 738032483f4501f3743a8cef3e169129b3e8c10c
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Jul 15 15:52:38 2018 +0200

    Add support for xfce4-panel-profiles
    
    Just to be sure, we also take the old name of the executable,
    xfpanel-switch, into account.
---
 panel/panel-preferences-dialog.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index ff1eccc..366d636 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -180,7 +180,8 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
   GtkTreeViewColumn *column;
   GtkCellRenderer   *renderer;
   GtkTreeSelection  *selection;
-  gchar             *path;
+  gchar             *path_old;
+  gchar             *path_new;
 
   dialog->bindings = NULL;
   dialog->application = panel_application_get ();
@@ -208,12 +209,12 @@ 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 */
+  /* check if xfce4-panel-profiles or panel-switch are installed and if either is show the 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);
-
+  path_old = g_find_program_in_path ("xfpanel-switch");
+  path_new = g_find_program_in_path ("xfce4-panel-profiles");
+  if (path_new == NULL && path_old == NULL)
+    gtk_widget_hide (GTK_WIDGET (object));
   connect_signal ("panel-switch", "clicked", panel_preferences_dialog_panel_switch);
 
   /* style tab */
@@ -922,19 +923,24 @@ static void
 panel_preferences_dialog_panel_switch (GtkWidget *widget, PanelPreferencesDialog *dialog)
 {
   GtkWidget *toplevel;
-  gchar     *path;
+  gchar     *path_old;
+  gchar     *path_new;
   GError    *error = NULL;
 
-  path = g_find_program_in_path ("xfpanel-switch");
-  if (path == NULL)
+  path_old = g_find_program_in_path ("xfpanel-switch");
+  path_new = g_find_program_in_path ("xfce4-panel-profiles");
+  if (path_old == NULL && path_new == 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);
+  /* first try the new name of the executable, then the old */
+  if (path_new)
+    g_spawn_command_line_async (path_new, &error);
+  else if (path_old)
+    g_spawn_command_line_async (path_old, &error);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list