[Xfce4-commits] [xfce/xfce4-panel] 01/01: Add "configure" button to composited infobar

noreply at xfce.org noreply at xfce.org
Sat Nov 24 00:36:15 CET 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 7ce7430e51b418a2cc80101d5826cbd9ee7f722a
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sat Nov 24 00:34:42 2018 +0100

    Add "configure" button to composited infobar
    
    If we find xfwm4-tweaks-settings in the path we assume the user is
    running xfwm4 and offer easy access to the compositing setting via the
    "Configure..." button.
---
 panel/panel-preferences-dialog.c     | 36 ++++++++++++++++++++++++++++++++++++
 panel/panel-preferences-dialog.glade | 12 +++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index f2f8edf..b286938 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -73,6 +73,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_compositing_clicked    (GtkButton              *button,
+                                                                                 gpointer                user_data);
 static void                     panel_preferences_dialog_panel_switch           (GtkWidget              *widget,
                                                                                  PanelPreferencesDialog *dialog);
 static XfcePanelPluginProvider *panel_preferences_dialog_item_get_selected      (PanelPreferencesDialog *dialog,
@@ -182,6 +184,7 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
   GtkTreeSelection  *selection;
   gchar             *path_old;
   gchar             *path_new;
+  gchar             *xfwm4_tweaks;
 
   dialog->bindings = NULL;
   dialog->application = panel_application_get ();
@@ -234,6 +237,16 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
                           G_OBJECT (info), "visible",
                           G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
 
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "xfwm4-settings");
+  panel_return_if_fail (G_IS_OBJECT (object));
+  xfwm4_tweaks = g_find_program_in_path ("xfwm4-tweaks-settings");
+  if (xfwm4_tweaks != NULL)
+    gtk_widget_show (GTK_WIDGET (object));
+  else
+    gtk_widget_hide (GTK_WIDGET (object));
+  g_signal_connect (G_OBJECT (object), "clicked",
+                    G_CALLBACK (panel_preferences_dialog_compositing_clicked), xfwm4_tweaks);
+
   object = gtk_builder_get_object (GTK_BUILDER (dialog), "background-image");
   panel_return_if_fail (GTK_IS_FILE_CHOOSER_BUTTON (object));
   g_signal_connect (G_OBJECT (object), "file-set",
@@ -932,6 +945,29 @@ panel_preferences_dialog_panel_remove (GtkWidget              *widget,
 
 
 static void
+panel_preferences_dialog_compositing_clicked (GtkButton *button, gpointer user_data)
+{
+  gchar    *command = user_data;
+  GAppInfo *app_info = NULL;
+  GError   *error = NULL;
+
+  app_info = g_app_info_create_from_commandline (command, "Window Manager Tweaks", G_APP_INFO_CREATE_NONE, &error);
+  if (G_UNLIKELY (app_info == NULL)) {
+    g_warning ("Could not find application %s", error->message);
+    return;
+  }
+  if (error != NULL)
+    g_error_free (error);
+
+  if (!g_app_info_launch (app_info, NULL, NULL, &error))
+    g_warning ("Could not launch the application %s", error->message);
+  if (error != NULL)
+    g_error_free (error);
+}
+
+
+
+static void
 panel_preferences_dialog_panel_switch (GtkWidget *widget, PanelPreferencesDialog *dialog)
 {
   GtkWidget *toplevel;
diff --git a/panel/panel-preferences-dialog.glade b/panel/panel-preferences-dialog.glade
index 29135a4..50e0e6a 100644
--- a/panel/panel-preferences-dialog.glade
+++ b/panel/panel-preferences-dialog.glade
@@ -781,7 +781,17 @@
                                 <property name="spacing">6</property>
                                 <property name="layout_style">end</property>
                                 <child>
-                                  <placeholder/>
+                                  <object class="GtkButton" id="xfwm4-settings">
+                                    <property name="label" translatable="yes">Configure...</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
                                 </child>
                               </object>
                               <packing>

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


More information about the Xfce4-commits mailing list