[Xfce4-commits] <xfce4-settings:master> Rework the UI

Nick Schermer noreply at xfce.org
Sat Aug 28 23:04:28 CEST 2010


Updating branch refs/heads/master
         to d28cf87b40da416ff7da7feb8902093d51d9aee4 (commit)
       from 2943f1733d08a754c26782e899e09f16b7b47366 (commit)

commit d28cf87b40da416ff7da7feb8902093d51d9aee4
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date:   Sat Jun 19 23:13:56 2010 +0200

    Rework the UI
    
    Use a single UI for both randr 1.1 and randr 1.2: hide by default some widgets,
    and only make them visible with randr 1.2.
    
    Also, with xrandr 1.2, add an on/off radio button to enable/disable an output,
    instead of using the resolution for that, it created too many issues; when the
    output is off, grey out all comboboxes.

 dialogs/display-settings/display-dialog.glade |   74 +++++-
 dialogs/display-settings/main.c               |  344 ++++++++++++++----------
 2 files changed, 267 insertions(+), 151 deletions(-)

diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index a255b81..f61f5fa 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -47,11 +47,26 @@
             <child>
               <object class="GtkTable" id="table1">
                 <property name="visible">True</property>
-                <property name="n_rows">3</property>
+                <property name="n_rows">5</property>
                 <property name="n_columns">2</property>
                 <property name="column_spacing">12</property>
                 <property name="row_spacing">6</property>
                 <child>
+                  <object class="GtkLabel" id="label-reflection">
+                    <property name="visible">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Ref_lection:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">randr-reflection</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkLabel" id="label5">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
@@ -60,8 +75,8 @@
                     <property name="mnemonic_widget">randr-rotation</property>
                   </object>
                   <packing>
-                    <property name="top_attach">2</property>
-                    <property name="bottom_attach">3</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
@@ -75,8 +90,8 @@
                     <property name="mnemonic_widget">randr-refresh-rate</property>
                   </object>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
@@ -90,24 +105,62 @@
                     <property name="mnemonic_widget">randr-resolution</property>
                   </object>
                   <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="randr-on">
+                    <property name="visible">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">O_n</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
                     <property name="x_options">GTK_FILL</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkComboBox" id="randr-reflection">
+                    <property name="visible">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">4</property>
+                    <property name="bottom_attach">5</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkComboBox" id="randr-rotation">
                     <property name="visible">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
+                    <property name="top_attach">3</property>
+                    <property name="bottom_attach">4</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="randr-refresh-rate">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="randr-refresh-rate">
+                  <object class="GtkComboBox" id="randr-resolution">
                     <property name="visible">True</property>
                   </object>
                   <packing>
@@ -119,12 +172,17 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="randr-resolution">
-                    <property name="visible">True</property>
+                  <object class="GtkRadioButton" id="randr-off">
+                    <property name="visible">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Of_f</property>
+                    <property name="use_underline">True</property>
+                    <property name="group">randr-on</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
                     <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
                     <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index c6b431f..9473c76 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -44,7 +44,6 @@
 #include "xfce-randr-legacy.h"
 #include "display-dialog_ui.h"
 #ifdef HAS_RANDR_ONE_POINT_TWO
-#include "display-dialog-xrandr1.2_ui.h"
 #include "minimal-display-dialog_ui.h"
 #endif
 
@@ -175,27 +174,30 @@ display_setting_reflections_populate (GtkBuilder *builder)
 
     if (xfce_randr)
     {
+        /* disable it if no mode is selected */
+        gtk_widget_set_sensitive (GTK_WIDGET (combobox), XFCE_RANDR_MODE (xfce_randr) != None);
+
         /* load only supported reflections */
         reflections = XFCE_RANDR_ROTATIONS (xfce_randr) & XFCE_RANDR_REFLECTIONS_MASK;
         active_reflection = XFCE_RANDR_ROTATION (xfce_randr) & XFCE_RANDR_REFLECTIONS_MASK;
-    }
 
-    /* try to insert the reflections */
-    for (n = 0; n < G_N_ELEMENTS (reflection_names); n++)
-    {
-        if ((reflections & reflection_names[n].rotation) == reflection_names[n].rotation)
+        /* try to insert the reflections */
+        for (n = 0; n < G_N_ELEMENTS (reflection_names); n++)
         {
-            /* insert */
-            gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                                COLUMN_COMBO_NAME, _(reflection_names[n].name),
-                                COLUMN_COMBO_VALUE, reflection_names[n].rotation, -1);
-
-            /* select active reflection */
-            if (xfce_randr && XFCE_RANDR_MODE (xfce_randr) != None)
+            if ((reflections & reflection_names[n].rotation) == reflection_names[n].rotation)
             {
-                if ((reflection_names[n].rotation & active_reflection) == reflection_names[n].rotation)
-                    gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+                /* insert */
+                gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+                gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                    COLUMN_COMBO_NAME, _(reflection_names[n].name),
+                                    COLUMN_COMBO_VALUE, reflection_names[n].rotation, -1);
+
+                /* select active reflection */
+                if (xfce_randr && XFCE_RANDR_MODE (xfce_randr) != None)
+                {
+                    if ((reflection_names[n].rotation & active_reflection) == reflection_names[n].rotation)
+                        gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+                }
             }
         }
     }
@@ -245,6 +247,9 @@ display_setting_rotations_populate (GtkBuilder *builder)
 #ifdef HAS_RANDR_ONE_POINT_TWO
     if (xfce_randr)
     {
+        /* disable it if no mode is selected */
+        gtk_widget_set_sensitive (GTK_WIDGET (combobox), XFCE_RANDR_MODE (xfce_randr) != None);
+
         /* load only supported rotations */
         rotations = XFCE_RANDR_ROTATIONS (xfce_randr) & XFCE_RANDR_ROTATIONS_MASK;
         active_rotation = XFCE_RANDR_ROTATION (xfce_randr) & XFCE_RANDR_ROTATIONS_MASK;
@@ -291,7 +296,12 @@ display_setting_refresh_rates_changed (GtkComboBox *combobox,
     if (!display_setting_combo_box_get_value (combobox, &value))
         return;
 
-    /* set new rate */
+    /* set new mode (1.2) or rate (1.1) */
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+        XFCE_RANDR_MODE (xfce_randr) = value;
+    else
+#endif
         XFCE_RANDR_LEGACY_RATE (xfce_randr_legacy) = value;
 }
 
@@ -308,40 +318,82 @@ display_setting_refresh_rates_populate (GtkBuilder *builder)
     gchar        *name = NULL;
     gint          n, active = -1;
     gshort        diff, active_diff = G_MAXSHORT;
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    XfceRRMode   *modes, *current_mode;
+#endif
 
     /* get the combo box store and clear it */
     combobox = gtk_builder_get_object (builder, "randr-refresh-rate");
     model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
     gtk_list_store_clear (GTK_LIST_STORE (model));
 
-    /* get the refresh rates */
-    rates = XRRConfigRates (XFCE_RANDR_LEGACY_CONFIG (xfce_randr_legacy),
-                            XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy), &nrates);
-
-    for (n = 0; n < nrates; n++)
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
     {
-        /* insert */
-        name = g_strdup_printf (_("%d Hz"), rates[n]);
-        gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
-        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                            COLUMN_COMBO_NAME, name,
-                            COLUMN_COMBO_VALUE, rates[n], -1);
-        g_free (name);
-
-        /* get the active rate closest to the current diff */
-        diff = ABS (rates[n] - XFCE_RANDR_LEGACY_RATE (xfce_randr_legacy));
-
-        /* store active */
-        if (active_diff > diff)
+        /* disable it if no mode is selected */
+        gtk_widget_set_sensitive (GTK_WIDGET (combobox), XFCE_RANDR_MODE (xfce_randr) != None);
+
+        /* get the current mode */
+        current_mode = xfce_randr_find_mode_by_id (xfce_randr, xfce_randr->active_output,
+                                                   XFCE_RANDR_MODE (xfce_randr));
+
+        if (!current_mode)
+            return;
+
+        /* walk all supported modes */
+        modes = XFCE_RANDR_SUPPORTED_MODES (xfce_randr);
+        for (n = 0; n < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; ++n)
         {
-            active = nrates - n - 1;
-            active_diff = diff;
+            /* the mode resolution does not match the current one */
+            if (modes[n].width != current_mode->width
+                || modes[n].height != current_mode->height)
+                continue;
+
+            /* insert the mode */
+            name = g_strdup_printf (_("%.1f Hz"), modes[n].rate);
+            gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                COLUMN_COMBO_NAME, name,
+                                COLUMN_COMBO_VALUE, modes[n].id, -1);
+            g_free (name);
+
+            /* select the active mode */
+            if (modes[n].id == XFCE_RANDR_MODE (xfce_randr))
+                gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
         }
     }
+    else
+#endif
+    {
+        /* get the refresh rates */
+        rates = XRRConfigRates (XFCE_RANDR_LEGACY_CONFIG (xfce_randr_legacy),
+                                XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy), &nrates);
 
-    /* set closest refresh rate */
-    if (G_LIKELY (active != -1))
-        gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), active);
+        for (n = 0; n < nrates; n++)
+        {
+            /* insert */
+            name = g_strdup_printf (_("%d Hz"), rates[n]);
+            gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
+            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                COLUMN_COMBO_NAME, name,
+                                COLUMN_COMBO_VALUE, rates[n], -1);
+            g_free (name);
+
+            /* get the active rate closest to the current diff */
+            diff = ABS (rates[n] - XFCE_RANDR_LEGACY_RATE (xfce_randr_legacy));
+
+            /* store active */
+            if (active_diff > diff)
+            {
+                active = nrates - n - 1;
+                active_diff = diff;
+            }
+        }
+
+        /* set closest refresh rate */
+        if (G_LIKELY (active != -1))
+            gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), active);
+    }
 }
 
 
@@ -361,7 +413,6 @@ display_setting_resolutions_changed (GtkComboBox *combobox,
 
     /* update refresh rates */
     display_setting_refresh_rates_populate (builder);
-    display_setting_rotations_populate (builder);
 }
 
 
@@ -375,27 +426,63 @@ display_setting_resolutions_populate (GtkBuilder *builder)
     gint           n, nsizes;
     gchar         *name;
     GtkTreeIter    iter;
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    XfceRRMode   *modes;
+#endif
 
     /* get the combo box store and clear it */
     combobox = gtk_builder_get_object (builder, "randr-resolution");
     model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
     gtk_list_store_clear (GTK_LIST_STORE (model));
 
-    /* get the possible screen sizes for this screen */
-    screen_sizes = XRRConfigSizes (XFCE_RANDR_LEGACY_CONFIG (xfce_randr_legacy), &nsizes);
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    if (xfce_randr)
+    {
+        /* disable it if no mode is selected */
+        gtk_widget_set_sensitive (GTK_WIDGET (combobox), XFCE_RANDR_MODE (xfce_randr) != None);
+
+        /* walk all supported modes */
+        modes = XFCE_RANDR_SUPPORTED_MODES (xfce_randr);
+        for (n = 0; n < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; ++n)
+        {
+            /* try to avoid duplicates */
+            if (n == 0 || (n > 0 && modes[n].width != modes[n - 1].width
+                && modes[n].height != modes[n - 1].height))
+            {
+
+                /* insert the mode */
+                name = g_strdup_printf ("%dx%d", modes[n].width, modes[n].height);
+                gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+                gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                                    COLUMN_COMBO_NAME, name,
+                                    COLUMN_COMBO_VALUE, modes[n].id, -1);
+                g_free (name);
+            }
 
-    for (n = 0; n < nsizes; n++)
+            /* select the active mode */
+            if (modes[n].id == XFCE_RANDR_MODE (xfce_randr))
+                gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+        }
+    }
+    else
+#endif
     {
-        /* insert in the model */
-        name = g_strdup_printf ("%dx%d", screen_sizes[n].width, screen_sizes[n].height);
-        gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, n,
-                                           COLUMN_COMBO_NAME, name,
-                                           COLUMN_COMBO_VALUE, n, -1);
-        g_free (name);
-
-        /* select active */
-        if (G_UNLIKELY (XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy) == n))
-            gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+        /* get the possible screen sizes for this screen */
+        screen_sizes = XRRConfigSizes (XFCE_RANDR_LEGACY_CONFIG (xfce_randr_legacy), &nsizes);
+
+        for (n = 0; n < nsizes; n++)
+        {
+            /* insert in the model */
+            name = g_strdup_printf ("%dx%d", screen_sizes[n].width, screen_sizes[n].height);
+            gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter, n,
+                                               COLUMN_COMBO_NAME, name,
+                                               COLUMN_COMBO_VALUE, n, -1);
+            g_free (name);
+
+            /* select active */
+            if (G_UNLIKELY (XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy) == n))
+                gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
+        }
     }
 }
 
@@ -403,26 +490,16 @@ display_setting_resolutions_populate (GtkBuilder *builder)
 
 #ifdef HAS_RANDR_ONE_POINT_TWO
 static void
-display_setting_modes_changed (GtkComboBox *combobox,
-                               GtkBuilder  *builder)
+display_setting_output_enabled (GtkToggleButton *togglebutton,
+                                GtkBuilder      *builder)
 {
-    gint value;
-
-    if (!display_setting_combo_box_get_value (combobox, &value))
-        return;
-
-    /* set new mode */
     if (xfce_randr)
-        XFCE_RANDR_MODE (xfce_randr) = value;
-    else
-    /* set new resolution */
-    if (xfce_randr_legacy)
-        XFCE_RANDR_LEGACY_RESOLUTION (xfce_randr_legacy) = value;
-
-    /* update refresh rates */
-    if (!xfce_randr)
-        display_setting_refresh_rates_populate (builder);
-
+    {
+        if (gtk_toggle_button_get_active (togglebutton))
+            XFCE_RANDR_MODE (xfce_randr) = XFCE_RANDR_PREFERRED_MODE(xfce_randr);
+    }
+    display_setting_resolutions_populate (builder);
+    display_setting_refresh_rates_populate (builder);
     display_setting_rotations_populate (builder);
     display_setting_reflections_populate (builder);
 }
@@ -430,54 +507,36 @@ display_setting_modes_changed (GtkComboBox *combobox,
 
 
 static void
-display_setting_modes_populate (GtkBuilder *builder)
+display_setting_output_disabled (GtkToggleButton *togglebutton,
+                                 GtkBuilder      *builder)
 {
-    GtkTreeModel *model;
-    GObject      *combobox;
-    gint          n;
-    gchar        *name;
-    GtkTreeIter   iter;
-    XfceRRMode   *modes;
-
-    /* get the combo box store and clear it */
-    combobox = gtk_builder_get_object (builder, "randr-mode");
-    model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
-    gtk_list_store_clear (GTK_LIST_STORE (model));
-
     if (xfce_randr)
     {
-        /* entry for a disabled output */
-        gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                            COLUMN_COMBO_NAME, _("None (disabled)"),
-                            COLUMN_COMBO_VALUE, None, -1);
+        if (gtk_toggle_button_get_active (togglebutton))
+            XFCE_RANDR_MODE (xfce_randr) = None;
+    }
+    display_setting_resolutions_populate (builder);
+    display_setting_refresh_rates_populate (builder);
+    display_setting_rotations_populate (builder);
+    display_setting_reflections_populate (builder);
+}
 
-        if (XFCE_RANDR_MODE (xfce_randr) == None)
-            gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
 
-        /* walk all supported modes */
-        modes = XFCE_RANDR_SUPPORTED_MODES (xfce_randr);
-        for (n = 0; n < XFCE_RANDR_OUTPUT_INFO (xfce_randr)->nmode; ++n)
-        {
-            /* insert the mode */
-            name = g_strdup_printf (_("%dx%d @ %.1f Hz"), modes[n].width,
-                                    modes[n].height, modes[n].rate);
-            gtk_list_store_append (GTK_LIST_STORE (model), &iter);
-            gtk_list_store_set (GTK_LIST_STORE (model), &iter,
-                                COLUMN_COMBO_NAME, name,
-                                COLUMN_COMBO_VALUE, modes[n].id, -1);
-            g_free (name);
+static void
+display_setting_output_status_populate (GtkBuilder *builder)
+{
+    GObject *radio_on, *radio_off;
 
-            /* select the active mode */
-            if (modes[n].id == XFCE_RANDR_MODE (xfce_randr))
-                gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox), &iter);
-        }
-    }
+    if (!xfce_randr)
+        return;
+
+    radio_on = gtk_builder_get_object (builder, "randr-on");
+    radio_off = gtk_builder_get_object (builder, "randr-off");
+
+    if (XFCE_RANDR_MODE (xfce_randr) != None)
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_on), TRUE);
     else
-    {
-        display_setting_resolutions_populate (builder);
-        display_setting_refresh_rates_populate (builder);
-    }
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio_off), TRUE);
 }
 #endif
 
@@ -509,13 +568,16 @@ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
 
         /* update the combo boxes */
 #ifdef HAS_RANDR_ONE_POINT_TWO
-        display_setting_modes_populate (builder);
-        display_setting_reflections_populate (builder);
-#else
+        if (xfce_randr)
+            display_setting_output_status_populate (builder);
+#endif
         display_setting_resolutions_populate (builder);
         display_setting_refresh_rates_populate (builder);
-#endif
         display_setting_rotations_populate (builder);
+#ifdef HAS_RANDR_ONE_POINT_TWO
+        if (xfce_randr)
+            display_setting_reflections_populate (builder);
+#endif
     }
 }
 
@@ -690,6 +752,9 @@ display_settings_dialog_new (GtkBuilder *builder)
     GtkCellRenderer  *renderer;
     GtkTreeSelection *selection;
     GObject          *combobox;
+#ifdef HAS_RANDR_ONE_POINT_TWO
+    GObject          *label, *radio;
+#endif
 
     /* get the treeview */
     treeview = gtk_builder_get_object (builder, "randr-outputs");
@@ -714,25 +779,30 @@ display_settings_dialog_new (GtkBuilder *builder)
 #ifdef HAS_RANDR_ONE_POINT_TWO
     if (xfce_randr != NULL)
     {
-        combobox = gtk_builder_get_object (builder, "randr-mode");
-        display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
-        g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_modes_changed), builder);
+        radio = gtk_builder_get_object (builder, "randr-on");
+        gtk_widget_show (GTK_WIDGET (radio));
+        g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (display_setting_output_enabled), builder);
+
+        radio = gtk_builder_get_object (builder, "randr-off");
+        gtk_widget_show (GTK_WIDGET (radio));
+        g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (display_setting_output_disabled), builder);
+
+        label = gtk_builder_get_object (builder, "label-reflection");
+        gtk_widget_show (GTK_WIDGET (label));
 
         combobox = gtk_builder_get_object (builder, "randr-reflection");
         display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
+        gtk_widget_show (GTK_WIDGET (combobox));
         g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_reflections_changed), builder);
     }
-    else
 #endif
-    {
-        combobox = gtk_builder_get_object (builder, "randr-resolution");
-        display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
-        g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_resolutions_changed), builder);
+    combobox = gtk_builder_get_object (builder, "randr-resolution");
+    display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
+    g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_resolutions_changed), builder);
 
-        combobox = gtk_builder_get_object (builder, "randr-refresh-rate");
-        display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
-        g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_refresh_rates_changed), builder);
-    }
+    combobox = gtk_builder_get_object (builder, "randr-refresh-rate");
+    display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
+    g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (display_setting_refresh_rates_changed), builder);
 
     combobox = gtk_builder_get_object (builder, "randr-rotation");
     display_settings_combo_box_create (GTK_COMBO_BOX (combobox));
@@ -966,20 +1036,8 @@ main (gint argc, gchar **argv)
 #endif
             /* load the Gtk user-interface file */
             builder = gtk_builder_new ();
-    #ifdef HAS_RANDR_ONE_POINT_TWO
-            if (xfce_randr != NULL)
-            {
-                ui_ret = gtk_builder_add_from_string (builder, display_dialog_xrandr12_ui,
-                                                      display_dialog_xrandr12_ui_length, &error);
-            }
-            else
-    #endif
-            {
-                ui_ret = gtk_builder_add_from_string (builder, display_dialog_ui,
-                                                      display_dialog_ui_length, &error);
-            }
-
-            if (ui_ret != 0)
+            if (gtk_builder_add_from_string (builder, display_dialog_ui,
+                                             display_dialog_ui_length, &error) != 0)
             {
                 /* build the dialog */
                 dialog = display_settings_dialog_new (builder);



More information about the Xfce4-commits mailing list