[Xfce4-commits] [xfce/xfce4-settings] 01/01: Add interactive information about primary setting

noreply at xfce.org noreply at xfce.org
Sun Nov 11 23:37:05 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-settings.

commit b619470f9904da23f3f752e8f2c4c338dd66c638
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sun Nov 11 23:36:43 2018 +0100

    Add interactive information about primary setting
    
    Currently we check if the Xfce panel, xfdesktop or xfce4-notifyd
    are configured to honour the "primary" setting.
---
 dialogs/display-settings/display-dialog.glade | 250 ++++++++++++++++++++++----
 dialogs/display-settings/main.c               |  92 ++++++++++
 2 files changed, 305 insertions(+), 37 deletions(-)

diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index dfedf4e..0869390 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -18,6 +18,154 @@
     <property name="can_focus">False</property>
     <property name="icon_name">document-new-symbolic</property>
   </object>
+  <object class="GtkPopover" id="primary-info">
+    <property name="can_focus">False</property>
+    <property name="position">bottom</property>
+    <child>
+      <object class="GtkGrid">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <property name="margin_right">12</property>
+        <property name="margin_top">12</property>
+        <property name="margin_bottom">12</property>
+        <child>
+          <object class="GtkImage" id="panel-ok">
+            <property name="can_focus">False</property>
+            <property name="margin_left">18</property>
+            <property name="icon_name">emblem-ok-symbolic</property>
+            <style>
+              <class name="success"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="desktop-ok">
+            <property name="can_focus">False</property>
+            <property name="margin_left">18</property>
+            <property name="icon_name">emblem-ok-symbolic</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkImage" id="notifications-ok">
+            <property name="can_focus">False</property>
+            <property name="margin_left">18</property>
+            <property name="icon_name">emblem-ok-symbolic</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_bottom">12</property>
+            <property name="label" translatable="yes">The primary display is currently configured to show:</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="panel-label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">Xfce Panel</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="desktop-label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">Desktop icons</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="notifications-label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="label" translatable="yes">Notifications</property>
+            <property name="xalign">0</property>
+          </object>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="panel-configure">
+            <property name="label" translatable="yes">Configure...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <style>
+              <class name="flat"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="desktop-configure">
+            <property name="label" translatable="yes">Configure...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <style>
+              <class name="flat"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="notifications-configure">
+            <property name="label" translatable="yes">Configure...</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <style>
+              <class name="flat"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">2</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
   <object class="XfceTitledDialog" id="display-dialog">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Display</property>
@@ -134,43 +282,6 @@
                             <property name="row_spacing">6</property>
                             <property name="column_spacing">12</property>
                             <child>
-                              <object class="GtkBox">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="spacing">12</property>
-                                <child>
-                                  <object class="GtkComboBox" id="randr-outputs">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="hexpand">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkSwitch" id="output-on">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="halign">end</property>
-                                    <property name="valign">center</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">2</property>
-                              </packing>
-                            </child>
-                            <child>
                               <object class="GtkLabel" id="label-resolution">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
@@ -277,6 +388,59 @@
                               </packing>
                             </child>
                             <child>
+                              <object class="GtkMenuButton" id="primary-info-button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="relief">none</property>
+                                <property name="popover">primary-info</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">12</property>
+                                <child>
+                                  <object class="GtkComboBox" id="randr-outputs">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="hexpand">True</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <object class="GtkSwitch" id="output-on">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="halign">end</property>
+                                    <property name="valign">center</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">3</property>
+                              </packing>
+                            </child>
+                            <child>
                               <object class="GtkLabel" id="label-primary">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
@@ -290,6 +454,18 @@
                                 <property name="top_attach">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index fb1712b..f42f09c 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1778,6 +1778,95 @@ display_setting_minimal_autoshow_toggled (GtkSwitch       *widget,
     return TRUE;
 }
 
+static void
+display_settings_launch_settings_dialogs (GtkButton *button,
+                                          gpointer   user_data)
+{
+    gchar    *command = user_data;
+    GAppInfo *app_info = NULL;
+    GError   *error = NULL;
+
+    g_warning ("trying to launch %s", command);
+
+    app_info = g_app_info_create_from_commandline (command, "Xfce Settings",
+                                                   G_APP_INFO_CREATE_NONE, NULL);
+    app_info = g_app_info_create_from_commandline (command, "Xfce Settings", 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
+display_settings_primary_status_info_populate (GtkBuilder *builder)
+{
+    GObject          *widget;
+    GtkWidget        *image;
+    XfconfChannel    *channel;
+    gchar            *primary_status_panel;
+    gint              primary_status;
+    gint              panels = 0;
+    gint              panels_with_primary = 0;
+    gchar            *property;
+
+    widget = gtk_builder_get_object (builder, "primary-info-button");
+    image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_BUTTON);
+    gtk_container_add (GTK_CONTAINER (widget), image);
+    gtk_widget_show (image);
+
+    channel = xfconf_channel_new ("xfce4-panel");
+    widget = gtk_builder_get_object (builder, "panel-ok");
+    property = g_strdup_printf ("/panels/panel-%u/output-name", panels);
+    /* Check all panels and show the ok icon on the first occurence of a panel set to "Primary" */
+    for (panels = 0; xfconf_channel_has_property (channel, property); panels++)
+    {
+        primary_status_panel = xfconf_channel_get_string (channel, property, "Automatic");
+        if (g_strcmp0 (primary_status_panel, "Primary") == 0)
+        {
+            gtk_widget_show (GTK_WIDGET (widget));
+            panels_with_primary++;
+        }
+        else
+            gtk_widget_hide (GTK_WIDGET (widget));
+        property = g_strdup_printf ("/panels/panel-%u/output-name", panels + 1);
+    }
+    if (panels_with_primary > 1)
+    {
+        gchar *label;
+        widget = gtk_builder_get_object (builder, "panel-label");
+        label = g_strdup_printf (_("%d Xfce Panels"), panels_with_primary);
+        gtk_label_set_text (GTK_LABEL (widget), label);
+        g_free (label);
+    }
+    g_free (property);
+    g_object_unref (G_OBJECT (channel));
+    widget = gtk_builder_get_object (builder, "panel-configure");
+    g_signal_connect (widget, "clicked", G_CALLBACK (display_settings_launch_settings_dialogs), "xfce4-panel --preferences");
+
+    channel = xfconf_channel_new ("xfce4-desktop");
+    primary_status = xfconf_channel_get_bool (channel, "/desktop-icons/primary", FALSE);
+    widget = gtk_builder_get_object (builder, "desktop-ok");
+    gtk_widget_set_visible (GTK_WIDGET (widget), primary_status);
+    g_object_unref (G_OBJECT (channel));
+    widget = gtk_builder_get_object (builder, "desktop-configure");
+    g_signal_connect (widget, "clicked", G_CALLBACK (display_settings_launch_settings_dialogs), "xfdesktop-settings");
+
+    channel = xfconf_channel_new ("xfce4-notifyd");
+    primary_status = xfconf_channel_get_uint (channel, "/primary-monitor", 0);
+    widget = gtk_builder_get_object (builder, "notifications-ok");
+    gtk_widget_set_visible (GTK_WIDGET (widget), primary_status);
+    g_object_unref (G_OBJECT (channel));
+    widget = gtk_builder_get_object (builder, "notifications-configure");
+    g_signal_connect (widget, "clicked", G_CALLBACK (display_settings_launch_settings_dialogs), "xfce4-notifyd-config");
+}
+
 static GtkWidget *
 display_settings_dialog_new (GtkBuilder *builder)
 {
@@ -1830,6 +1919,9 @@ display_settings_dialog_new (GtkBuilder *builder)
         gtk_widget_hide (GTK_WIDGET (mirror));
     }
 
+    /* Set up primary status info button */
+    display_settings_primary_status_info_populate (builder);
+
     label = gtk_builder_get_object (builder, "label-reflection");
     gtk_widget_show (GTK_WIDGET (label));
 

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


More information about the Xfce4-commits mailing list