[Xfce4-commits] [xfce/xfce4-settings] 01/01: display: Make primary indicator a star icon

noreply at xfce.org noreply at xfce.org
Mon Nov 12 00:34:14 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 5916132c80c7623dfe589176dfd284791118a541
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Nov 12 00:33:20 2018 +0100

    display: Make primary indicator a star icon
---
 dialogs/display-settings/display-dialog.glade | 197 +++++++++++++++-----------
 dialogs/display-settings/main.c               |  30 ++--
 2 files changed, 138 insertions(+), 89 deletions(-)

diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index 0869390..719164c 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -280,179 +280,214 @@
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="row_spacing">6</property>
-                            <property name="column_spacing">12</property>
+                            <property name="column_spacing">3</property>
                             <child>
-                              <object class="GtkLabel" id="label-resolution">
+                              <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">4</property>
+                              </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">3</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkSwitch" id="primary">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="halign">end</property>
+                                <property name="valign">center</property>
+                                <property name="margin_left">9</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">2</property>
+                                <property name="top_attach">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label-primary">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">start</property>
-                                <property name="margin_left">12</property>
-                                <property name="label" translatable="yes">R_esolution:</property>
+                                <property name="label" translatable="yes">Primary Display:</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">2</property>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="randr-resolution">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="margin_left">9</property>
                               </object>
                               <packing>
-                                <property name="left_attach">1</property>
+                                <property name="left_attach">2</property>
                                 <property name="top_attach">2</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label-refresh-rate">
+                              <object class="GtkLabel" id="label-resolution">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">start</property>
-                                <property name="margin_left">12</property>
-                                <property name="label" translatable="yes">Refresh _rate:</property>
+                                <property name="label" translatable="yes">R_esolution:</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">3</property>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">2</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="randr-refresh-rate">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="margin_left">9</property>
                               </object>
                               <packing>
-                                <property name="left_attach">1</property>
+                                <property name="left_attach">2</property>
                                 <property name="top_attach">3</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label-rotation">
+                              <object class="GtkLabel" id="label-refresh-rate">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">start</property>
-                                <property name="margin_left">12</property>
-                                <property name="label" translatable="yes">Ro_tation:</property>
+                                <property name="label" translatable="yes">Refresh _rate:</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">4</property>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">3</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="randr-rotation">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
+                                <property name="margin_left">9</property>
                               </object>
                               <packing>
-                                <property name="left_attach">1</property>
+                                <property name="left_attach">2</property>
                                 <property name="top_attach">4</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label-reflection">
+                              <object class="GtkLabel" id="label-rotation">
+                                <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">start</property>
-                                <property name="margin_left">12</property>
-                                <property name="label" translatable="yes">Ref_lection:</property>
+                                <property name="label" translatable="yes">Ro_tation:</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">5</property>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">4</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="randr-reflection">
                                 <property name="can_focus">False</property>
+                                <property name="margin_left">9</property>
                               </object>
                               <packing>
-                                <property name="left_attach">1</property>
+                                <property name="left_attach">2</property>
                                 <property name="top_attach">5</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkSwitch" id="primary">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="halign">end</property>
-                                <property name="valign">center</property>
+                              <object class="GtkLabel" id="label-reflection">
+                                <property name="can_focus">False</property>
+                                <property name="halign">start</property>
+                                <property name="label" translatable="yes">Ref_lection:</property>
+                                <property name="use_underline">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">1</property>
-                                <property name="top_attach">1</property>
+                                <property name="top_attach">5</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkMenuButton" id="primary-info-button">
+                              <object class="GtkImage" id="primary-indicator">
                                 <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>
+                                <property name="can_focus">False</property>
+                                <property name="valign">center</property>
+                                <property name="margin_left">6</property>
+                                <property name="pixel_size">16</property>
+                                <property name="icon_name">gtk-about-symbolic</property>
                               </object>
                               <packing>
-                                <property name="left_attach">2</property>
+                                <property name="left_attach">0</property>
                                 <property name="top_attach">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkBox">
+                              <object class="GtkImage" id="dummy-icon">
                                 <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>
+                                <property name="margin_left">6</property>
+                                <property name="pixel_size">16</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
-                                <property name="top_attach">0</property>
-                                <property name="width">3</property>
+                                <property name="top_attach">2</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="label-primary">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="margin_left">12</property>
-                                <property name="label" translatable="yes">Primary Display:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                              </packing>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
                             </child>
                             <child>
                               <placeholder/>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index f42f09c..201d100 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1077,14 +1077,16 @@ display_setting_primary_toggled (GtkWidget *widget,
 static void
 display_setting_primary_populate (GtkBuilder *builder)
 {
-    GObject *check, *label;
+    GObject *check, *label, *primary_indicator;
     gboolean output_on = TRUE;
+    gboolean primary;
 
     if (!xfce_randr)
         return;
-
+    primary = xfce_randr->status[active_output] != XFCE_OUTPUT_STATUS_SECONDARY;
     check = gtk_builder_get_object (builder, "primary");
     label = gtk_builder_get_object (builder, "label-primary");
+    primary_indicator = gtk_builder_get_object (builder, "primary-indicator");
 
     if (xfce_randr->noutput > 1)
         gtk_widget_show (GTK_WIDGET (check));
@@ -1098,12 +1100,12 @@ display_setting_primary_populate (GtkBuilder *builder)
         output_on = FALSE;
     gtk_widget_set_sensitive (GTK_WIDGET (check), output_on);
     gtk_widget_set_sensitive (GTK_WIDGET (label), output_on);
+    gtk_widget_set_visible (GTK_WIDGET (primary_indicator), primary);
 
     /* Block the "changed" signal to avoid triggering the confirmation dialog */
     g_signal_handlers_block_by_func (check, display_setting_primary_toggled,
                                      builder);
-    gtk_switch_set_state (GTK_SWITCH (check),
-                          xfce_randr->status[active_output] != XFCE_OUTPUT_STATUS_SECONDARY);
+    gtk_switch_set_state (GTK_SWITCH (check), primary);
     /* Unblock the signal */
     g_signal_handlers_unblock_by_func (check, display_setting_primary_toggled,
                                        builder);
@@ -1872,7 +1874,7 @@ display_settings_dialog_new (GtkBuilder *builder)
 {
     GObject          *combobox;
     GtkCellRenderer  *renderer;
-    GObject          *label, *check, *primary, *primary_label, *mirror, *identify;
+    GObject          *label, *check, *primary, *primary_label, *mirror, *identify, *primary_indicator;
     GtkWidget        *button;
     GtkTreeSelection *selection;
 
@@ -1921,6 +1923,8 @@ display_settings_dialog_new (GtkBuilder *builder)
 
     /* Set up primary status info button */
     display_settings_primary_status_info_populate (builder);
+    primary_indicator = gtk_builder_get_object (builder, "primary-indicator");
+    gtk_widget_set_visible (GTK_WIDGET (primary_indicator), gtk_switch_get_active (GTK_SWITCH (primary)));
 
     label = gtk_builder_get_object (builder, "label-reflection");
     gtk_widget_show (GTK_WIDGET (label));
@@ -3135,9 +3139,19 @@ paint_output (cairo_t *cr, int i, double *snap_x, double *snap_y)
 
     /* Draw a panel type rectangle to show which monitor is primary */
     if (xfce_randr->status[output->id] == XFCE_OUTPUT_STATUS_PRIMARY) {
-        cairo_rectangle (cr, x, y, end_x - x, 7);
-        cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, alpha - 0.3);
-        cairo_fill (cr);
+        GdkPixbuf   *pixbuf;
+        GtkIconInfo *icon_info;
+        GdkRGBA      fg;
+
+        icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (),
+                                                "gtk-about-symbolic",
+                                                16,
+                                                GTK_ICON_LOOKUP_GENERIC_FALLBACK);
+
+        gdk_rgba_parse (&fg, "#000000");
+        pixbuf = gtk_icon_info_load_symbolic (icon_info, &fg, NULL, NULL, NULL, NULL, NULL);
+        gdk_cairo_set_source_pixbuf (cr, pixbuf, x + 1, y + 1);
+        cairo_paint (cr);
     }
 
     /* Display name label*/

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


More information about the Xfce4-commits mailing list