[Xfce4-commits] [xfce/xfce4-settings] 01/01: display: Correctly hide primary setting with 1 display

noreply at xfce.org noreply at xfce.org
Thu Jan 10 16:31:43 CET 2019


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 1223f06feabf09f7d4f48cb214d0c7b0bbb461ab
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Jan 10 16:31:31 2019 +0100

    display: Correctly hide primary setting with 1 display
    
    If there's only one display connected RandR automatically sets it
    as primary, so the setting becomes meaningless and we hide all
    controls related to it.
---
 dialogs/display-settings/main.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 9bb027d..25191e1 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1077,24 +1077,28 @@ display_setting_primary_toggled (GtkWidget *widget,
 static void
 display_setting_primary_populate (GtkBuilder *builder)
 {
-    GObject *check, *label, *primary_indicator;
+    GObject *check, *label, *primary_indicator, *primary_info;
     gboolean output_on = TRUE;
+    gboolean multiple_displays = TRUE;
     gboolean primary;
 
     if (!xfce_randr)
         return;
     primary = xfce_randr->status[active_output] != XFCE_OUTPUT_STATUS_SECONDARY;
+    if (xfce_randr->noutput <= 1)
+        multiple_displays = FALSE;
     check = gtk_builder_get_object (builder, "primary");
     label = gtk_builder_get_object (builder, "label-primary");
+    primary_info = gtk_builder_get_object (builder, "primary-info-button");
     primary_indicator = gtk_builder_get_object (builder, "primary-indicator");
 
-    if (xfce_randr->noutput > 1)
-        gtk_widget_show (GTK_WIDGET (check));
-    else
-    {
-        gtk_widget_hide (GTK_WIDGET (check));
+    /* If there's only one display we hide the primary option as it is meaningless */
+    gtk_widget_set_visible (GTK_WIDGET (check), multiple_displays);
+    gtk_widget_set_visible (GTK_WIDGET (label), multiple_displays);
+    gtk_widget_set_visible (GTK_WIDGET (primary_info), multiple_displays);
+    gtk_widget_set_visible (GTK_WIDGET (primary_indicator), multiple_displays);
+    if (!multiple_displays)
         return;
-    }
 
     if (xfce_randr->mode[active_output] == None)
         output_on = FALSE;

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


More information about the Xfce4-commits mailing list