[gnome-control-center/benzea/only-show-appliable-scales: 4/4] display: Show scale row unconditionally



commit 2e4fd2ddf483f930eeefb0e35bf16b19fea396a0
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Feb 22 16:03:10 2019 +0100

    display: Show scale row unconditionally
    
    The only functional change in this commit is the reval of the if that is
    checking for cloning mode.

 panels/display/cc-display-settings.c | 84 ++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 46 deletions(-)
---
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index f658eb06f..656729ec7 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -231,6 +231,9 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
   GList *item;
   gint width, height;
   CcDisplayMode *current_mode;
+  GtkRadioButton *group = NULL;
+  gint buttons = 0;
+  const gdouble *scales, *scale;
 
   self->idle_udpate_id = 0;
 
@@ -380,58 +383,47 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
     }
 
 
-  /* Update scale row. */
+  /* Scale row is usually shown. */
   gtk_container_foreach (GTK_CONTAINER (self->scale_bbox), (GtkCallback) gtk_widget_destroy, NULL);
-  if (!cc_display_config_is_cloning (self->config))
+  scales = cc_display_mode_get_supported_scales (current_mode);
+  for (scale = scales; *scale != 0.0; scale++)
     {
-      GtkRadioButton *group = NULL;
-      gint buttons = 0;
-      const gdouble *scales, *scale;
-
-      scales = cc_display_mode_get_supported_scales (current_mode);
-      for (scale = scales; *scale != 0.0; scale++)
-        {
-          g_autofree gchar *scale_str = NULL;
-          GtkWidget *scale_btn;
+      g_autofree gchar *scale_str = NULL;
+      GtkWidget *scale_btn;
 
-          if (!cc_display_config_is_scaled_mode_valid (self->config,
-                                                       cc_display_monitor_get_mode (self->selected_output),
-                                                       *scale) &&
-              cc_display_monitor_get_scale (self->selected_output) != *scale)
-            continue;
-
-          scale_str = make_scale_string (*scale);
-
-          scale_btn = gtk_radio_button_new_with_label_from_widget (group, scale_str);
-          if (!group)
-            group = GTK_RADIO_BUTTON (scale_btn);
-          gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (scale_btn), FALSE);
-          g_object_set_data_full (G_OBJECT (scale_btn),
-                                  "scale",
-                                  g_memdup (scale, sizeof (gdouble)),
-                                  g_free);
-          gtk_widget_show (scale_btn);
-          gtk_container_add (GTK_CONTAINER (self->scale_bbox), scale_btn);
-          g_signal_connect_object (scale_btn,
-                                   "notify::active",
-                                   G_CALLBACK (on_scale_btn_active_changed_cb),
-                                   self, 0);
-
-          if (cc_display_monitor_get_scale (self->selected_output) == *scale)
-            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scale_btn), TRUE);
-
-          buttons += 1;
-          if (buttons >= MAX_SCALE_BUTTONS)
-            break;
-        }
+      if (!cc_display_config_is_scaled_mode_valid (self->config,
+                                                   cc_display_monitor_get_mode (self->selected_output),
+                                                   *scale) &&
+          cc_display_monitor_get_scale (self->selected_output) != *scale)
+        continue;
 
-      gtk_widget_set_visible (self->scale_row, buttons > 1);
-    }
-  else
-    {
-      gtk_widget_set_visible (self->scale_row, FALSE);
+      scale_str = make_scale_string (*scale);
+
+      scale_btn = gtk_radio_button_new_with_label_from_widget (group, scale_str);
+      if (!group)
+        group = GTK_RADIO_BUTTON (scale_btn);
+      gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (scale_btn), FALSE);
+      g_object_set_data_full (G_OBJECT (scale_btn),
+                              "scale",
+                              g_memdup (scale, sizeof (gdouble)),
+                              g_free);
+      gtk_widget_show (scale_btn);
+      gtk_container_add (GTK_CONTAINER (self->scale_bbox), scale_btn);
+      g_signal_connect_object (scale_btn,
+                               "notify::active",
+                               G_CALLBACK (on_scale_btn_active_changed_cb),
+                               self, 0);
+
+      if (cc_display_monitor_get_scale (self->selected_output) == *scale)
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scale_btn), TRUE);
+
+      buttons += 1;
+      if (buttons >= MAX_SCALE_BUTTONS)
+        break;
     }
 
+  gtk_widget_set_visible (self->scale_row, buttons > 1);
+
   gtk_widget_set_visible (self->underscanning_row,
                           cc_display_monitor_supports_underscanning (self->selected_output) &&
                           !cc_display_config_is_cloning (self->config));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]