[gnome-control-center] info: add warning that always fallback will effect next login



commit 6ceea9b3aefdb373c3670dcc3288d722e174cb58
Author: William Jon McCann <jmccann redhat com>
Date:   Tue Feb 15 14:15:35 2011 -0500

    info: add warning that always fallback will effect next login

 panels/info/cc-info-panel.c |   48 +++++++++++++++++++++++++++---------------
 panels/info/info.ui         |   35 +++++++++++++++++++++++++++++-
 2 files changed, 64 insertions(+), 19 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 095c2ab..3753687 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -50,6 +50,7 @@ struct _CcInfoPanelPrivate
   char          *gnome_distributor;
   char          *gnome_date;
   gboolean       updates_available;
+  gboolean       is_fallback;
 
   GDBusConnection     *session_bus;
   GDBusProxy    *pk_proxy;
@@ -404,20 +405,6 @@ get_current_is_fallback (CcInfoPanel  *self)
   return is_fallback;
 }
 
-static char *
-get_graphics_experience (CcInfoPanel  *self)
-{
-  char *experience_str;
-
-  if (get_current_is_fallback (self))
-    experience_str = g_strdup (_("Fallback"));
-  else
-    experience_str = g_strdup (_("Standard"));
-
-  return experience_str;
-}
-
-
 static void
 cc_info_panel_get_property (GObject    *object,
                             guint       property_id,
@@ -736,17 +723,40 @@ switch_fallback_get_mapping (GValue    *value,
                              GVariant  *variant,
                              gpointer   data)
 {
-  const char *setting = g_variant_get_string (variant, NULL);
+  const char *setting;
+
+  setting = g_variant_get_string (variant, NULL);
   g_value_set_boolean (value, strcmp (setting, "gnome") != 0);
   return TRUE;
 }
 
+static void
+toggle_fallback_warning_label (CcInfoPanel *self,
+                               gboolean     visible)
+{
+  GtkWidget *widget;
+
+  widget = WID (self->priv->builder, "graphics_logout_warning_label");
+  if (visible)
+    gtk_widget_show (widget);
+  else
+    gtk_widget_hide (widget);
+}
+
 static GVariant *
 switch_fallback_set_mapping (const GValue        *value,
                              const GVariantType  *expected_type,
                              gpointer             data)
 {
-  gboolean is_set = g_value_get_boolean (value);
+  CcInfoPanel *self = data;
+  gboolean     is_set;
+
+  is_set = g_value_get_boolean (value);
+  if (is_set != self->priv->is_fallback)
+    toggle_fallback_warning_label (self, TRUE);
+  else
+    toggle_fallback_warning_label (self, FALSE);
+
   return g_variant_new_string (is_set ? "gnome-fallback" : "gnome");
 }
 
@@ -767,7 +777,11 @@ info_panel_setup_graphics (CcInfoPanel  *self)
   gtk_label_set_markup (GTK_LABEL (widget), text ? text : "");
   g_free (text);
 
-  text = get_graphics_experience (self);
+  self->priv->is_fallback = get_current_is_fallback (self);
+  if (self->priv->is_fallback)
+    text = g_strdup (_("Fallback"));
+  else
+    text = g_strdup (_("Standard"));
   widget = WID (self->priv->builder, "graphics_experience_label");
   gtk_label_set_markup (GTK_LABEL (widget), text ? text : "");
   g_free (text);
diff --git a/panels/info/info.ui b/panels/info/info.ui
index 70025a2..7c95b03 100644
--- a/panels/info/info.ui
+++ b/panels/info/info.ui
@@ -631,10 +631,10 @@
                             <property name="can_focus">False</property>
                             <property name="halign">start</property>
                             <property name="valign">start</property>
-                            <property name="n_rows">4</property>
+                            <property name="n_rows">5</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">12</property>
-                            <property name="row_spacing">5</property>
+                            <property name="row_spacing">10</property>
                             <child>
                               <object class="GtkLabel" id="label17">
                                 <property name="visible">True</property>
@@ -740,6 +740,37 @@
                                 <property name="bottom_attach">4</property>
                               </packing>
                             </child>
+                            <child>
+                              <object class="GtkLabel" id="label34">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="justify">right</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">4</property>
+                                <property name="bottom_attach">5</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="graphics_logout_warning_label">
+                                <property name="can_focus">False</property>
+                                <property name="no_show_all">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label">Will take effect at next login</property>
+                                <property name="wrap">True</property>
+                                <property name="selectable">True</property>
+                                <attributes>
+                                  <attribute name="weight" value="bold"/>
+                                </attributes>
+                              </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>
+                              </packing>
+                            </child>
                           </object>
                         </child>
                       </object>



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