diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus-menu-manager.c | 6 | ||||
-rw-r--r-- | src/metadata-widget.c | 20 | ||||
-rw-r--r-- | src/mpris-controller.vala | 15 | ||||
-rw-r--r-- | src/mpris2-controller.vala | 21 | ||||
-rw-r--r-- | src/player-controller.vala | 15 | ||||
-rw-r--r-- | src/sound-service.c | 4 | ||||
-rw-r--r-- | src/title-widget.c | 4 |
7 files changed, 22 insertions, 63 deletions
diff --git a/src/dbus-menu-manager.c b/src/dbus-menu-manager.c index 6f0af9e..5ea561f 100644 --- a/src/dbus-menu-manager.c +++ b/src/dbus-menu-manager.c @@ -119,7 +119,7 @@ void dbus_menu_manager_update_mute_ui(gboolean incoming_mute_value) b_all_muted = incoming_mute_value; dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } @@ -190,7 +190,7 @@ static void rebuild_sound_menu(DbusmenuMenuitem *root, SoundServiceDbus *service { // Mute button mute_all_menuitem = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, b_all_muted == FALSE ? _("Mute") : _("Unmute")); g_signal_connect(G_OBJECT(mute_all_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(set_global_mute_from_ui), NULL); dbusmenu_menuitem_property_set_bool(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, b_sink_available); @@ -229,7 +229,7 @@ static void set_global_mute_from_ui() toggle_global_mute(b_all_muted); dbusmenu_menuitem_property_set(mute_all_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, - b_all_muted == FALSE ? _("Mute All") : _("Unmute")); + b_all_muted == FALSE ? _("Mute") : _("Unmute")); } diff --git a/src/metadata-widget.c b/src/metadata-widget.c index aeef670..8aeb862 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -61,9 +61,8 @@ static void metadata_widget_property_update (DbusmenuMenuitem* item, gpointer userdata); static void metadata_widget_update_album_art(MetadataWidget* self); -static void metadata_widget_style_title_text(MetadataWidget* self); -static void metadata_widget_style_artist_and_album_label(MetadataWidget* self, - GtkLabel* label); +static void metadata_widget_style_labels(MetadataWidget* self, + GtkLabel* label); void metadata_widget_set_style(GtkWidget* button, GtkStyle* style); @@ -83,7 +82,6 @@ metadata_widget_class_init (MetadataWidgetClass *klass) gobject_class->dispose = metadata_widget_dispose; gobject_class->finalize = metadata_widget_finalize; - } static void @@ -120,7 +118,7 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(artist), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(artist), 15); gtk_label_set_ellipsize(GTK_LABEL(artist), PANGO_ELLIPSIZE_MIDDLE); - metadata_widget_style_artist_and_album_label(self, GTK_LABEL(artist)); + metadata_widget_style_labels(self, GTK_LABEL(artist)); priv->artist_label = artist; // title @@ -131,8 +129,8 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(piece), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(piece), 15); gtk_label_set_ellipsize(GTK_LABEL(piece), PANGO_ELLIPSIZE_MIDDLE); + metadata_widget_style_labels(self, GTK_LABEL(piece)); priv->piece_label = piece; - metadata_widget_style_title_text(self); // container GtkWidget* container; @@ -142,7 +140,7 @@ metadata_widget_init (MetadataWidget *self) gtk_misc_set_padding (GTK_MISC(container), (gfloat)10, (gfloat)0); gtk_label_set_width_chars(GTK_LABEL(container), 15); gtk_label_set_ellipsize(GTK_LABEL(container), PANGO_ELLIPSIZE_MIDDLE); - metadata_widget_style_artist_and_album_label(self, GTK_LABEL(container)); + metadata_widget_style_labels(self, GTK_LABEL(container)); priv->container_label = container; gtk_box_pack_start (GTK_BOX (vbox), priv->piece_label, FALSE, FALSE, 0); @@ -286,15 +284,15 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTIST, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->artist_label), g_value_get_string(value)); - metadata_widget_style_artist_and_album_label(mitem, GTK_LABEL(priv->artist_label)); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->artist_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_TITLE, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->piece_label), g_value_get_string(value)); - metadata_widget_style_title_text(mitem); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->piece_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ALBUM, property) == 0){ gtk_label_set_text(GTK_LABEL(priv->container_label), g_value_get_string(value)); - metadata_widget_style_artist_and_album_label(mitem, GTK_LABEL(priv->container_label)); + metadata_widget_style_labels(mitem, GTK_LABEL(priv->container_label)); } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ g_string_erase(priv->image_path, 0, -1); @@ -317,7 +315,7 @@ metadata_widget_update_album_art(MetadataWidget* self){ // TODO refactor next 3 methods into one once the style has been static void -metadata_widget_style_artist_and_album_label(MetadataWidget* self, GtkLabel* label) +metadata_widget_style_labels(MetadataWidget* self, GtkLabel* label) { char* markup; markup = g_markup_printf_escaped ("<span size=\"small\">%s</span>", diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index 1e1e00a..fc9eee0 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -61,10 +61,6 @@ public class MprisController : GLib.Object (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(play_state); this.owner.custom_items[PlayerController.widget_order.METADATA].update(this.mpris_player.GetMetadata(), MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public void transport_event(TransportMenuitem.action command) @@ -96,8 +92,6 @@ public class MprisController : GLib.Object double new_time_position = total_time * position/100.0; debug("new position = %f", (new_time_position * 1000)); this.mpris_player.PositionSet((int32)(new_time_position)); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(this.mpris_player.PositionGet()); } public bool connected() @@ -117,7 +111,6 @@ public class MprisController : GLib.Object v.set_int(play_state); ht.insert("state", v); this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(ht, ScrubMenuitem.attributes_format()); } private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht) @@ -125,21 +118,13 @@ public class MprisController : GLib.Object debug("onTrackChange"); this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - //HashTable<string, Value?> status_hash = new HashTable<string, Value?>(str_hash, str_equal); status st = this.mpris_player.GetStatus(); int play_state = st.playback; debug("GetStatusChange, about to update scrub with play state - %i", play_state); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_playstate(play_state); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(), - ScrubMenuitem.attributes_format()); this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht, MetadataMenuitem.attributes_format()); debug("about to update the duration on the scrub bar"); - // temporary fix - scrub.update_position(this.mpris_player.PositionGet()); } } diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 166d7f4..df2bbd3 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -107,31 +107,20 @@ public class Mpris2Controller : GLib.Object debug("new playback state = %s", state); int p = this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(p); } Value? pos_v = changed_properties.lookup("Position"); if(pos_v != null){ int64 pos = pos_v.get_int64(); debug("new position = %i", (int)pos); - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_position((int32)pos); } Value? meta_v = changed_properties.lookup("Metadata"); if(meta_v != null){ GLib.HashTable<string, Value?> changed_updates = clean_metadata(); - - //MetadataMenuitem meta = this.owner.custom_items[PlayerController.widget_order.METADATA] as MetadataMenuitem; - //meta.reset(MetadataMenuitem.attributes_format()); 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()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(changed_updates, - ScrubMenuitem.attributes_format()); - - (this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem).update_playstate(this.determine_play_state(this.player.PlaybackStatus)); - } } @@ -180,8 +169,6 @@ public class Mpris2Controller : GLib.Object GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata(); this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata, MetadataMenuitem.attributes_format()); - this.owner.custom_items[PlayerController.widget_order.SCRUB].update(cleaned_metadata, - ScrubMenuitem.attributes_format()); } public void transport_event(TransportMenuitem.action command) @@ -240,8 +227,8 @@ public class Mpris2Controller : GLib.Object DBus.ObjectPath path = new ObjectPath(v.get_string()); try{ this.player.SetPosition(path, (int64)(new_time_position)); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position(((int32)new_time_position) / 1000); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position(((int32)new_time_position) / 1000); } catch(DBus.Error e){ error("DBus Error calling the player objects SetPosition method %s", @@ -253,8 +240,8 @@ public class Mpris2Controller : GLib.Object public void onSeeked(int64 position){ debug("Seeked signal callback with pos = %i", (int)position/1000); - ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; - scrub.update_position((int32)position/1000); + //ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem; + //scrub.update_position((int32)position/1000); } public bool connected() diff --git a/src/player-controller.vala b/src/player-controller.vala index 2aa4382..3e12dce 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -23,13 +23,12 @@ using Gee; public class PlayerController : GLib.Object { - public const int WIDGET_QUANTITY = 5; + public const int WIDGET_QUANTITY = 4; public static enum widget_order{ SEPARATOR, TITLE, METADATA, - SCRUB, TRANSPORT, } @@ -114,25 +113,19 @@ public class PlayerController : GLib.Object update_state(PlayerController.state.OFFLINE); this.custom_items[widget_order.TRANSPORT].reset(TransportMenuitem.attributes_format()); this.custom_items[widget_order.METADATA].reset(MetadataMenuitem.attributes_format()); - this.custom_items[widget_order.SCRUB].reset(ScrubMenuitem.attributes_format()); } public void update_layout() - { - + { if(this.current_state != state.CONNECTED){ this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, false); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - false); this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, false); return; } this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, this.custom_items[widget_order.METADATA].populated(MetadataMenuitem.attributes_format())); - this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, - this.custom_items[widget_order.SCRUB].populated(ScrubMenuitem.attributes_format())); this.custom_items[widget_order.TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -150,10 +143,6 @@ public class PlayerController : GLib.Object MetadataMenuitem metadata_item = new MetadataMenuitem(); this.custom_items.add(metadata_item); - // Scrub item - ScrubMenuitem scrub_item = new ScrubMenuitem(this); - this.custom_items.add(scrub_item); - // Transport item TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); diff --git a/src/sound-service.c b/src/sound-service.c index 12f067e..42ce116 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; } diff --git a/src/title-widget.c b/src/title-widget.c index 7e73f7e..b5ed3c0 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -160,12 +160,12 @@ title_widget_style_name_text(TitleWidget* self) TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self); char* markup; - markup = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>", + markup = g_markup_printf_escaped ("<span size=\"larger\">%s</span>", gtk_label_get_text(GTK_LABEL(priv->name))); gtk_label_set_markup (GTK_LABEL (priv->name), markup); g_free(markup); } - + /** * transport_new: * @returns: a new #TitleWidget. |