[gnome-control-center] universal-access: Hide zoom options when not in shell



commit c48536c10262c39f9a3cb710a64b09f793cd523d
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 8 16:16:54 2012 +0100

    universal-access: Hide zoom options when not in shell
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671386

 panels/universal-access/cc-ua-panel.c |   35 +++++++++++++++++++++++++++++++++
 panels/universal-access/uap.ui        |    2 +-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 81c9f8d..1ce8210 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -50,6 +50,7 @@ struct _CcUaPanelPrivate
   GSettings *mediakeys_settings;
 
   ZoomOptions *zoom_options;
+  guint shell_watch_id;
 };
 
 
@@ -84,6 +85,12 @@ cc_ua_panel_dispose (GObject *object)
 {
   CcUaPanelPrivate *priv = CC_UA_PANEL (object)->priv;
 
+  if (priv->shell_watch_id)
+    {
+      g_bus_unwatch_name (priv->shell_watch_id);
+      priv->shell_watch_id = 0;
+    }
+
   if (priv->builder)
     {
       g_object_unref (priv->builder);
@@ -463,6 +470,27 @@ cc_ua_panel_set_shortcut_label (CcUaPanel  *self,
 }
 
 static void
+shell_vanished_cb (GDBusConnection *connection,
+		   const gchar *name,
+		   CcUaPanel   *self)
+{
+  CcUaPanelPrivate *priv = self->priv;
+
+  gtk_widget_hide (WID (priv->builder, "zoom_frame"));
+}
+
+static void
+shell_appeared_cb (GDBusConnection *connection,
+		   const gchar *name,
+		   const gchar *name_owner,
+		   CcUaPanel   *self)
+{
+  CcUaPanelPrivate *priv = self->priv;
+
+  gtk_widget_show (WID (priv->builder, "zoom_frame"));
+}
+
+static void
 cc_ua_panel_init_seeing (CcUaPanel *self)
 {
   CcUaPanelPrivate *priv = self->priv;
@@ -480,6 +508,13 @@ cc_ua_panel_init_seeing (CcUaPanel *self)
                    WID (priv->builder, "seeing_enable_toggle_keys_checkbutton"), "active",
                    G_SETTINGS_BIND_DEFAULT);
 
+  priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
+					   "org.gnome.Shell",
+					   G_BUS_NAME_WATCHER_FLAGS_NONE,
+					   (GBusNameAppearedCallback) shell_appeared_cb,
+					   (GBusNameVanishedCallback) shell_vanished_cb,
+					   self,
+					   NULL);
   g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"),
                     "clicked",
                     G_CALLBACK (zoom_options_launch_cb), self);
diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui
index 8017855..c8910c0 100644
--- a/panels/universal-access/uap.ui
+++ b/panels/universal-access/uap.ui
@@ -428,7 +428,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkFrame" id="frame4">
+                  <object class="GtkFrame" id="zoom_frame">
                     <property name="visible">True</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>



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