aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2012-01-26 14:50:10 +0000
committerConor Curran <conor.curran@canonical.com>2012-01-26 14:50:10 +0000
commit8b2ab5bfbc1b40dde9db2fcdb1074221f42125f0 (patch)
tree5befc2940f672b3d94b7933ac00c5b893cee119c
parentae4f73ab037fa9fd4ffce9d88acba4d739ba007f (diff)
parent6101f59b28f94ebe2ac819c4af61928a0ff17844 (diff)
downloadayatana-indicator-sound-8b2ab5bfbc1b40dde9db2fcdb1074221f42125f0.tar.gz
ayatana-indicator-sound-8b2ab5bfbc1b40dde9db2fcdb1074221f42125f0.tar.bz2
ayatana-indicator-sound-8b2ab5bfbc1b40dde9db2fcdb1074221f42125f0.zip
charles fixes for invisibility flag
-rw-r--r--data/com.canonical.indicator.sound.gschema.xml7
-rw-r--r--src/indicator-sound.c66
-rw-r--r--src/metadata-widget.c10
-rw-r--r--src/transport-widget.c7
4 files changed, 87 insertions, 3 deletions
diff --git a/data/com.canonical.indicator.sound.gschema.xml b/data/com.canonical.indicator.sound.gschema.xml
index ae0cc8d..a3ec770 100644
--- a/data/com.canonical.indicator.sound.gschema.xml
+++ b/data/com.canonical.indicator.sound.gschema.xml
@@ -34,5 +34,12 @@
updated volume value will be shown (if supported by your notification daemon).
</description>
</key>
+ <key name="visible" type="b">
+ <default>true</default>
+ <summary>Whether or not to show the sound indicator in the menu bar.</summary>
+ <description>
+ Whether or not to show the sound indicator in the menu bar.
+ </description>
+ </key>
</schema>
</schemalist>
diff --git a/src/indicator-sound.c b/src/indicator-sound.c
index b953449..c87f850 100644
--- a/src/indicator-sound.c
+++ b/src/indicator-sound.c
@@ -55,10 +55,13 @@ struct _IndicatorSoundPrivate
GDBusProxy *dbus_proxy;
SoundStateManager* state_manager;
gchar *accessible_desc;
+ GSettings *settings;
};
#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))
+#define SOUND_INDICATOR_GSETTINGS_SCHEMA_ID "com.canonical.indicator.sound"
+
// GObject Boiler plate
INDICATOR_SET_VERSION
INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE)
@@ -119,6 +122,10 @@ static void connection_changed (IndicatorServiceManager * sm,
gboolean connected,
gpointer userdata);
+// Visiblity
+static void settings_init (IndicatorSound * self);
+
+
static void
indicator_sound_class_init (IndicatorSoundClass *klass)
{
@@ -156,6 +163,9 @@ indicator_sound_init (IndicatorSound *self)
priv->transport_widgets_list = t_list;
priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);
priv->accessible_desc = NULL;
+ priv->settings = NULL;
+
+ settings_init (self);
g_signal_connect ( G_OBJECT(self->service),
INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,
@@ -168,6 +178,11 @@ indicator_sound_dispose (GObject *object)
IndicatorSound * self = INDICATOR_SOUND(object);
IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
+ if (priv->settings != NULL) {
+ g_object_unref (G_OBJECT(priv->settings));
+ priv->settings = NULL;
+ }
+
if (self->service != NULL) {
g_object_unref(G_OBJECT(self->service));
self->service = NULL;
@@ -747,10 +762,12 @@ indicator_sound_middle_click (IndicatorObject * io, IndicatorObjectEntry * entry
void
update_accessible_desc (IndicatorObject * io)
{
- IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
GList *entries = indicator_object_get_entries(io);
+ if (!entries)
+ return;
IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
gchar *old_desc = priv->accessible_desc;
if (priv->volume_widget) {
@@ -770,3 +787,50 @@ update_accessible_desc (IndicatorObject * io)
TRUE);
g_list_free(entries);
}
+
+/***
+****
+***/
+
+#define VISIBLE_KEY "visible"
+
+static void
+on_visible_changed (GSettings * settings, gchar * key, gpointer user_data)
+{
+ g_return_if_fail (!g_strcmp0 (key, VISIBLE_KEY));
+
+ IndicatorObject * io = INDICATOR_OBJECT(user_data);
+ const gboolean visible = g_settings_get_boolean (settings, key);
+ indicator_object_set_visible (io, visible);
+ if (visible)
+ update_accessible_desc (io); // requires an entry
+}
+
+static void
+settings_init (IndicatorSound *self)
+{
+ const char * schema = SOUND_INDICATOR_GSETTINGS_SCHEMA_ID;
+
+ gint i;
+ gboolean schema_exists = FALSE;
+ const char * const * schemas = g_settings_list_schemas ();
+ for (i=0; !schema_exists && schemas && schemas[i]; i++)
+ if (!g_strcmp0 (schema, schemas[i]))
+ schema_exists = TRUE;
+
+ IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
+ if (schema_exists) {
+ priv->settings = g_settings_new (schema);
+ } else {
+ priv->settings = NULL;
+ }
+
+ if (priv->settings != NULL) {
+ g_signal_connect (G_OBJECT(priv->settings), "changed::" VISIBLE_KEY,
+ G_CALLBACK(on_visible_changed), self);
+ const gboolean b = g_settings_get_boolean (priv->settings, VISIBLE_KEY);
+ g_object_set (G_OBJECT(self),
+ "indicator-object-default-visibility", b,
+ NULL);
+ }
+}
diff --git a/src/metadata-widget.c b/src/metadata-widget.c
index 8d816de..a3383df 100644
--- a/src/metadata-widget.c
+++ b/src/metadata-widget.c
@@ -256,6 +256,7 @@ metadata_widget_dispose (GObject *object)
#else
gdk_pixbuf_unref(priv->icon_buf);
#endif
+ priv->icon_buf = NULL;
}
G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
}
@@ -263,6 +264,10 @@ metadata_widget_dispose (GObject *object)
static void
metadata_widget_finalize (GObject *object)
{
+ MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
+ g_string_free (priv->image_path, TRUE);
+ g_string_free (priv->old_image_path, TRUE);
+
G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
}
@@ -790,8 +795,9 @@ metadata_widget_set_icon (MetadataWidget *self)
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
GString* banshee_string = g_string_new ( "banshee" );
- GString* app_panel = g_string_new ( g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME),
- -1));
+ gchar * tmp = g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), -1);
+ GString* app_panel = g_string_new (tmp);
+ g_free (tmp);
GdkPixbuf* icon_buf;
// Banshee Special case!
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 2d1a7f2..08e4ba9 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -269,6 +269,13 @@ transport_widget_dispose (GObject *object)
}
}
#endif
+
+ TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(object);
+ if (priv->command_coordinates != NULL) {
+ g_hash_table_destroy (priv->command_coordinates);
+ priv->command_coordinates = NULL;
+ }
+
G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);
}