diff options
-rw-r--r-- | src/metadata-menu-item.vala | 24 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 6 | ||||
-rw-r--r-- | src/sound-service.c | 4 |
3 files changed, 30 insertions, 4 deletions
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 <http://www.gnu.org/licenses/>. 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<string, Value?> 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<string, Value?> 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; } |