[gnome-initial-setup/shell/4765: 201/362] display: update toggle button selection for changes



commit ec79bc53dd42a0dca32aa11536725e1c057e89ce
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Fri Sep 5 17:14:23 2014 -0700

    display: update toggle button selection for changes
    
    [endlessm/eos-shell#3562]

 .../pages/display/gis-display-page.c               |   24 ++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gnome-initial-setup/pages/display/gis-display-page.c 
b/gnome-initial-setup/pages/display/gis-display-page.c
index ddd019b..87644ba 100644
--- a/gnome-initial-setup/pages/display/gis-display-page.c
+++ b/gnome-initial-setup/pages/display/gis-display-page.c
@@ -48,6 +48,28 @@ G_DEFINE_TYPE_WITH_PRIVATE (GisDisplayPage, gis_display_page, GIS_TYPE_PAGE);
 #define OBJ(type,name) ((type)gtk_builder_get_object(GIS_PAGE(page)->builder,(name)))
 #define WID(name) OBJ(GtkWidget*,name)
 
+static void
+set_toggle_options_from_config (GisDisplayPage *page)
+{
+  GisDisplayPagePrivate *priv = gis_display_page_get_instance_private (page);
+  GtkWidget *default_toggle, *toggle;
+  gboolean is_underscanning;
+
+  /* Do not set the toggle if we're on the default selection */
+  default_toggle = WID ("overscan_default_selection");
+  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (default_toggle)))
+    return;
+
+  is_underscanning = gnome_rr_output_info_get_underscanning  (priv->current_output);
+
+  if (is_underscanning)
+    toggle = WID ("overscan_on");
+  else
+    toggle = WID ("overscan_off");
+
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), TRUE);
+}
+
 static gboolean
 read_screen_config (GisDisplayPage *page)
 {
@@ -83,6 +105,8 @@ read_screen_config (GisDisplayPage *page)
   if (priv->current_output == NULL)
     return FALSE;
 
+  set_toggle_options_from_config (page);
+
   return TRUE;
 }
 


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