Merge lp:~charlesk/indicator-sound/visibility into lp:indicator-sound/fifth

Proposed by Charles Kerr
Status: Merged
Merged at revision: 291
Proposed branch: lp:~charlesk/indicator-sound/visibility
Merge into: lp:indicator-sound/fifth
Diff against target: 184 lines (+87/-3)
4 files modified
data/com.canonical.indicator.sound.gschema.xml (+7/-0)
src/indicator-sound.c (+65/-1)
src/metadata-widget.c (+8/-2)
src/transport-widget.c (+7/-0)
To merge this branch: bzr merge lp:~charlesk/indicator-sound/visibility
Reviewer Review Type Date Requested Status
Conor Curran (community) Approve
Review via email: mp+90038@code.launchpad.net

Description of the change

This branch contains a new patch for bug #829648 and fixes a small handful of memory issues reported by valgrind.

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) wrote :

Thanks Charles, looking good !

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/com.canonical.indicator.sound.gschema.xml'
--- data/com.canonical.indicator.sound.gschema.xml 2012-01-17 10:09:27 +0000
+++ data/com.canonical.indicator.sound.gschema.xml 2012-01-25 03:12:24 +0000
@@ -34,5 +34,12 @@
34 updated volume value will be shown (if supported by your notification daemon).34 updated volume value will be shown (if supported by your notification daemon).
35 </description>35 </description>
36 </key>36 </key>
37 <key name="visible" type="b">
38 <default>true</default>
39 <summary>Whether or not to show the sound indicator in the menu bar.</summary>
40 <description>
41 Whether or not to show the sound indicator in the menu bar.
42 </description>
43 </key>
37 </schema>44 </schema>
38</schemalist>45</schemalist>
3946
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2011-12-01 17:19:30 +0000
+++ src/indicator-sound.c 2012-01-25 03:12:24 +0000
@@ -55,10 +55,13 @@
55 GDBusProxy *dbus_proxy; 55 GDBusProxy *dbus_proxy;
56 SoundStateManager* state_manager;56 SoundStateManager* state_manager;
57 gchar *accessible_desc;57 gchar *accessible_desc;
58 GSettings *settings;
58};59};
5960
60#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))61#define INDICATOR_SOUND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_SOUND_TYPE, IndicatorSoundPrivate))
6162
63#define SOUND_INDICATOR_GSETTINGS_SCHEMA_ID "com.canonical.indicator.sound"
64
62// GObject Boiler plate65// GObject Boiler plate
63INDICATOR_SET_VERSION66INDICATOR_SET_VERSION
64INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE)67INDICATOR_SET_TYPE(INDICATOR_SOUND_TYPE)
@@ -119,6 +122,10 @@
119 gboolean connected,122 gboolean connected,
120 gpointer userdata);123 gpointer userdata);
121124
125// Visiblity
126static void settings_init (IndicatorSound * self);
127
128
122static void129static void
123indicator_sound_class_init (IndicatorSoundClass *klass)130indicator_sound_class_init (IndicatorSoundClass *klass)
124{131{
@@ -156,6 +163,9 @@
156 priv->transport_widgets_list = t_list;163 priv->transport_widgets_list = t_list;
157 priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);164 priv->state_manager = g_object_new (SOUND_TYPE_STATE_MANAGER, NULL);
158 priv->accessible_desc = NULL;165 priv->accessible_desc = NULL;
166 priv->settings = NULL;
167
168 settings_init (self);
159169
160 g_signal_connect ( G_OBJECT(self->service),170 g_signal_connect ( G_OBJECT(self->service),
161 INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,171 INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE,
@@ -168,6 +178,11 @@
168 IndicatorSound * self = INDICATOR_SOUND(object);178 IndicatorSound * self = INDICATOR_SOUND(object);
169 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);179 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
170180
181 if (priv->settings != NULL) {
182 g_object_unref (G_OBJECT(priv->settings));
183 priv->settings = NULL;
184 }
185
171 if (self->service != NULL) {186 if (self->service != NULL) {
172 g_object_unref(G_OBJECT(self->service));187 g_object_unref(G_OBJECT(self->service));
173 self->service = NULL;188 self->service = NULL;
@@ -747,10 +762,12 @@
747void762void
748update_accessible_desc (IndicatorObject * io)763update_accessible_desc (IndicatorObject * io)
749{764{
750 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
751 GList *entries = indicator_object_get_entries(io);765 GList *entries = indicator_object_get_entries(io);
766 if (!entries)
767 return;
752 IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;768 IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
753769
770 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(io);
754 gchar *old_desc = priv->accessible_desc;771 gchar *old_desc = priv->accessible_desc;
755772
756 if (priv->volume_widget) {773 if (priv->volume_widget) {
@@ -770,3 +787,50 @@
770 TRUE);787 TRUE);
771 g_list_free(entries);788 g_list_free(entries);
772}789}
790
791/***
792****
793***/
794
795#define VISIBLE_KEY "visible"
796
797static void
798on_visible_changed (GSettings * settings, gchar * key, gpointer user_data)
799{
800 g_return_if_fail (!g_strcmp0 (key, VISIBLE_KEY));
801
802 IndicatorObject * io = INDICATOR_OBJECT(user_data);
803 const gboolean visible = g_settings_get_boolean (settings, key);
804 indicator_object_set_visible (io, visible);
805 if (visible)
806 update_accessible_desc (io); // requires an entry
807}
808
809static void
810settings_init (IndicatorSound *self)
811{
812 const char * schema = SOUND_INDICATOR_GSETTINGS_SCHEMA_ID;
813
814 gint i;
815 gboolean schema_exists = FALSE;
816 const char * const * schemas = g_settings_list_schemas ();
817 for (i=0; !schema_exists && schemas && schemas[i]; i++)
818 if (!g_strcmp0 (schema, schemas[i]))
819 schema_exists = TRUE;
820
821 IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self);
822 if (schema_exists) {
823 priv->settings = g_settings_new (schema);
824 } else {
825 priv->settings = NULL;
826 }
827
828 if (priv->settings != NULL) {
829 g_signal_connect (G_OBJECT(priv->settings), "changed::" VISIBLE_KEY,
830 G_CALLBACK(on_visible_changed), self);
831 const gboolean b = g_settings_get_boolean (priv->settings, VISIBLE_KEY);
832 g_object_set (G_OBJECT(self),
833 "indicator-object-default-visibility", b,
834 NULL);
835 }
836}
773837
=== modified file 'src/metadata-widget.c'
--- src/metadata-widget.c 2012-01-13 10:07:05 +0000
+++ src/metadata-widget.c 2012-01-25 03:12:24 +0000
@@ -256,6 +256,7 @@
256 #else256 #else
257 gdk_pixbuf_unref(priv->icon_buf);257 gdk_pixbuf_unref(priv->icon_buf);
258 #endif258 #endif
259 priv->icon_buf = NULL;
259 }260 }
260 G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);261 G_OBJECT_CLASS (metadata_widget_parent_class)->dispose (object);
261}262}
@@ -263,6 +264,10 @@
263static void264static void
264metadata_widget_finalize (GObject *object)265metadata_widget_finalize (GObject *object)
265{266{
267 MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(METADATA_WIDGET(object));
268 g_string_free (priv->image_path, TRUE);
269 g_string_free (priv->old_image_path, TRUE);
270
266 G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);271 G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object);
267}272}
268273
@@ -790,8 +795,9 @@
790 gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);795 gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
791 796
792 GString* banshee_string = g_string_new ( "banshee" );797 GString* banshee_string = g_string_new ( "banshee" );
793 GString* app_panel = g_string_new ( g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME),798 gchar * tmp = g_utf8_strdown (dbusmenu_menuitem_property_get(priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME), -1);
794 -1));799 GString* app_panel = g_string_new (tmp);
800 g_free (tmp);
795 GdkPixbuf* icon_buf;801 GdkPixbuf* icon_buf;
796 802
797 // Banshee Special case! 803 // Banshee Special case!
798804
=== modified file 'src/transport-widget.c'
--- src/transport-widget.c 2011-11-16 18:11:20 +0000
+++ src/transport-widget.c 2012-01-25 03:12:24 +0000
@@ -269,6 +269,13 @@
269 }269 }
270 }270 }
271 #endif271 #endif
272
273 TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(object);
274 if (priv->command_coordinates != NULL) {
275 g_hash_table_destroy (priv->command_coordinates);
276 priv->command_coordinates = NULL;
277 }
278
272 G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);279 G_OBJECT_CLASS (transport_widget_parent_class)->dispose (object);
273}280}
274281

Subscribers

People subscribed via source and target branches