universal-access: Hide zoom options when not in shell

https://bugzilla.gnome.org/show_bug.cgi?id=671386
This commit is contained in:
Bastien Nocera 2012-03-08 16:16:54 +01:00
parent d378dbae48
commit c48536c102
2 changed files with 36 additions and 1 deletions

View file

@ -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);
@ -462,6 +469,27 @@ cc_ua_panel_set_shortcut_label (CcUaPanel *self,
g_free (text);
}
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)
{
@ -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);

View file

@ -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>