From f8a8b763f595001715064655ce5ffa4f89e50e30 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 14 Sep 2010 10:09:03 +0100 Subject: one potential fix --- src/metadata-menu-item.vala | 24 ++++++++++++++++++++++++ src/mpris2-controller.vala | 6 ++++-- src/sound-service.c | 4 ++-- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 3f71653..b616a7b 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -19,6 +19,7 @@ with this program. If not, see . using Gee; using DbusmenuMetadata; +using Dbusmenu; using Gdk; public class MetadataMenuitem : PlayerItem @@ -95,6 +96,29 @@ public class MetadataMenuitem : PlayerItem return result; } + public void determine_visibility() + { + try{ + if(property_get_int(MENUITEM_TITLE) == -1){ + this.property_set_bool(MENUITEM_PROP_VISIBLE, false); + return; + } + } + catch(Error e){ + warning("determine_visibility - %s", e.message); + } + try{ + string title = property_get(MENUITEM_TITLE); + if(title.length == 0){ + this.property_set_bool(MENUITEM_PROP_VISIBLE, false); + return; + } + } + catch(Error e){ + warning("determine_visibility - %s", e.message); + } + } + public void fetch_art(string uri, string prop) { File art_file = File.new_for_uri(uri); diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index bab20ae..86665ea 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -119,8 +119,10 @@ public class Mpris2Controller : GLib.Object GLib.HashTable changed_updates = clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(changed_updates, - MetadataMenuitem.attributes_format()); - } + MetadataMenuitem.attributes_format()); + MetadataMenuitem metadata_item = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; + metadata_item.determine_visibility(); + } } private GLib.HashTable clean_metadata() diff --git a/src/sound-service.c b/src/sound-service.c index f19379d..51f5f37 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From 01182ba70563b73014c5296e32e9b5eb16d66dbb Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 15 Sep 2010 10:20:47 +0100 Subject: race condition indicator crash fixed when the service crashes - indicator should now seemlessly handle flaky service --- src/indicator-sound.c | 11 ++++++++--- src/sound-service.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 0aa93b3..35045d7 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -365,7 +365,9 @@ connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer u IndicatorSound* indicator = INDICATOR_SOUND(user_data); fetch_sink_availability_from_dbus(indicator); IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(indicator); - determine_state_from_volume (volume_widget_get_current_volume(priv->volume_widget)); + if(priv->volume_widget != NULL){ + determine_state_from_volume (volume_widget_get_current_volume(priv->volume_widget)); + } } } else{ @@ -557,8 +559,11 @@ fetch_sink_availability_from_dbus(IndicatorSound* self) } IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); - GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); - gtk_widget_set_sensitive(slider_widget, device_available); + + if(priv->volume_widget != NULL){ + GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); + gtk_widget_set_sensitive(slider_widget, device_available); + } g_free(available_input); g_debug("IndicatorSound::fetch_sink_availability_from_dbus ->%i", device_available); diff --git a/src/sound-service.c b/src/sound-service.c index f19379d..51f5f37 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3