From 8f41c4e6e74805c63944f73d4acebef3f9efafe9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 19:27:52 +0100 Subject: fixes for new valac compilation --- src/Makefile.am | 1 - src/player-controller.vala | 2 +- src/specific-items-manager.vala | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 2381429..29cc33c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,7 +66,6 @@ music_bridge_VALASOURCES = \ music_bridge_VALAFLAGS = \ --ccode \ - --disable-dbus-transformation \ -H music-player-bridge.h -d . \ --vapidir=$(top_srcdir)/vapi/ \ --vapidir=./ \ diff --git a/src/player-controller.vala b/src/player-controller.vala index ced7d96..2f5569c 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -24,7 +24,7 @@ public class PlayerController : GLib.Object { public const int WIDGET_QUANTITY = 4; - public static enum widget_order{ + public enum widget_order{ SEPARATOR, METADATA, TRANSPORT, diff --git a/src/specific-items-manager.vala b/src/specific-items-manager.vala index d26199f..1bfe03e 100644 --- a/src/specific-items-manager.vala +++ b/src/specific-items-manager.vala @@ -22,7 +22,7 @@ using Gee; public class SpecificItemsManager : GLib.Object { - public static enum category{ + public enum category{ TRACK, PLAYER } -- cgit v1.2.3 From 373abc7256e51c38d6d00a9c4332b41b316a97f3 Mon Sep 17 00:00:00 2001 From: Andrea Cimitan Date: Fri, 9 Sep 2011 14:57:51 +0200 Subject: Fixes to the positioning and dimension of the player menuitem, and fix for the spinner widget matching (if some themers need it) --- src/metadata-widget.c | 26 ++++++++++++++------------ src/transport-widget.c | 8 ++++---- 2 files changed, 18 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/metadata-widget.c b/src/metadata-widget.c index d21c10d..8ab7d1d 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -212,9 +212,9 @@ metadata_widget_init (MetadataWidget *self) // player label GtkWidget* player_label; player_label = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0); + gtk_misc_set_alignment(GTK_MISC(player_label), (gfloat)0, (gfloat)0.5); gtk_misc_set_padding (GTK_MISC(player_label), (gfloat)1, (gfloat)0); - gtk_widget_set_size_request (player_label, 200, 25); + gtk_widget_set_size_request (player_label, 200, 24); priv->player_label = player_label; gtk_box_pack_start (GTK_BOX(outer_v_box), priv->player_label, FALSE, FALSE, 0); @@ -319,9 +319,8 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta); GtkStyle *style; - int x, y, arrow_width, arrow_height; + int x, y, arrow_width, arrow_height; - gint offset = 3; arrow_width = 5; arrow_height = 9; @@ -331,7 +330,9 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); x = allocation.x; y = 0; - + + gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2; + // Draw player icon if (priv->icon_buf != NULL){ gdk_cairo_set_source_pixbuf (cr, @@ -340,11 +341,11 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, y + offset); cairo_paint (cr); } - + // Draw triangle but only if the player is running. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ - y += (double)arrow_height/2.0 + offset; + y += allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); //g_debug ("triangle drawing"); @@ -426,9 +427,8 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, GtkStyle *style; cairo_t *cr; - int x, y, arrow_width, arrow_height; + int x, y, arrow_width, arrow_height; - gint offset = 3; arrow_width = 5; arrow_height = 9; @@ -440,7 +440,9 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); x = allocation.x; y = allocation.y; - + + gint offset = (allocation.height - gdk_pixbuf_get_height (priv->icon_buf)) / 2; + // Draw player icon if (priv->icon_buf != NULL){ gdk_cairo_set_source_pixbuf (cr, @@ -449,11 +451,11 @@ metadata_widget_icon_triangle_draw_cb (GtkWidget *widget, y + offset); cairo_paint (cr); } - + // Draw triangle but only if the player is running. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ - y += (double)arrow_height/2.0 + offset; + y += allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); cairo_move_to (cr, x, y); diff --git a/src/transport-widget.c b/src/transport-widget.c index 22e3b2a..c535e00 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -181,10 +181,10 @@ transport_widget_init (TransportWidget *self) /* create widget path */ spinner_widget_path = gtk_widget_path_new(); - gtk_widget_path_iter_set_name (spinner_widget_path, -1 , "IndicatorSound"); gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU); gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_MENU_ITEM); - gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER); + gint pos = gtk_widget_path_append_type (spinner_widget_path, GTK_TYPE_SPINNER); + gtk_widget_path_iter_set_name (spinner_widget_path, pos, "IndicatorSoundSpinner"); /* create style context and append path */ spinner_style_context = gtk_style_context_new(); @@ -1800,8 +1800,8 @@ draw (GtkWidget* button, cairo_t *cr) #if GTK_CHECK_VERSION(3, 0, 0) else if(priv->current_state == TRANSPORT_STATE_LAUNCHING) { - - gtk_render_activity (spinner_style_context, cr, 106, 6 , 30, 30); + // the spinner is not aligned, why? because the play button has odd width/height numbers + gtk_render_activity (spinner_style_context, cr, 106, 6, 30, 30); } #endif return FALSE; -- cgit v1.2.3 From b6fb30caf2354f05dbe496c1a2820acd37a1f2bf Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 9 Sep 2011 18:47:00 +0100 Subject: increased the max playlist count to 20, fixed a bug which was prohibiting the playlists being shown --- src/mpris2-controller.vala | 5 +++-- src/music-player-bridge.vala | 2 +- src/player-controller.vala | 6 ++++-- src/playlists-menu-item.vala | 1 + src/specific-items-manager.vala | 6 ++++-- 5 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 8eeac08..ce35a06 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -21,11 +21,12 @@ using Transport; public class Mpris2Controller : GLib.Object { + public const int MAX_PLAYLIST_COUNT = 20; + public MprisRoot mpris2_root {get; construct;} public MprisPlayer player {get; construct;} public MprisPlaylists playlists {get; construct;} public FreeDesktopProperties properties_interface {get; construct;} - public PlayerController owner {get; construct;} public Mpris2Controller(PlayerController ctrl) @@ -226,7 +227,7 @@ public class Mpris2Controller : GLib.Object try{ current_playlists = yield this.playlists.GetPlaylists (0, - 10, + MAX_PLAYLIST_COUNT, "Alphabetical", false); } diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 72c9bdb..0c9cb10 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -131,7 +131,7 @@ public class MusicPlayerBridge : GLib.Object this.registered_clients[mpris_key].use_playlists = use_playlists; this.registered_clients[mpris_key].update_state ( PlayerController.state.READY ); this.registered_clients[mpris_key].activate ( dbus_name ); - debug("Application has already registered - awaken the hibernation: %s \n", dbus_name ); + debug("Application has already registered - awaken the hibernation: %s with playlists %s \n", dbus_name, use_playlists.to_string() ); } } diff --git a/src/player-controller.vala b/src/player-controller.vala index 2f5569c..0fe7104 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -30,6 +30,8 @@ public class PlayerController : GLib.Object TRANSPORT, PLAYLISTS } + + public enum state{ OFFLINE, @@ -169,7 +171,6 @@ public class PlayerController : GLib.Object public void update_layout() { - debug ("a call to update layout"); PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem; MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem; if(this.current_state != state.CONNECTED){ @@ -190,6 +191,7 @@ public class PlayerController : GLib.Object this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, true); } + debug ("SETTING PLAYLISTS MENUITEM TO %s", this.use_playlists.to_string()); playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE, this.use_playlists ); } @@ -212,7 +214,7 @@ public class PlayerController : GLib.Object this.custom_items.add(playlist_menuitem); foreach(PlayerItem item in this.custom_items){ - if (this.custom_items.index_of(item) == 4) { + if (this.custom_items.index_of(item) == WIDGET_QUANTITY-1) { PlaylistsMenuitem playlists_menuitem = item as PlaylistsMenuitem; root_menu.child_add_position(playlists_menuitem.root_item, this.menu_offset + this.custom_items.index_of(item)); } diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 452a586..9cb7ac7 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -62,6 +62,7 @@ public class PlaylistsMenuitem : PlayerItem ); this.current_playlists.set( menuitem.id, menuitem ); this.root_item.child_append( menuitem ); + debug ("populating valid playlists %s", detail.name); } // Finally remove any that might have been deleted foreach (Dbusmenu.Menuitem item in this.current_playlists.values) { diff --git a/src/specific-items-manager.vala b/src/specific-items-manager.vala index 1bfe03e..923cf3f 100644 --- a/src/specific-items-manager.vala +++ b/src/specific-items-manager.vala @@ -51,10 +51,12 @@ public class SpecificItemsManager : GLib.Object { int result = 0 ; if (this.of_type == category.TRACK){ - result = this.owner.menu_offset + 4 + this.proxy_items.size; + result = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.proxy_items.size; } else if (this.of_type == category.PLAYER){ - int pos = this.owner.menu_offset + 4 + this.owner.track_specific_count(); + int pos = this.owner.menu_offset + this.owner.WIDGET_QUANTITY + this.owner.track_specific_count(); + //Surely the playlists item is there whether its visible or not ? + //TODO test playlists and player specific item positioning. pos += this.owner.use_playlists == true ? 1 : 0; result = pos; } -- cgit v1.2.3 From 41e5d2ef85dd8f53a70464affdb9bbcab441f788 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 9 Sep 2011 18:49:49 +0100 Subject: tidy up --- src/player-controller.vala | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/player-controller.vala b/src/player-controller.vala index 0fe7104..04d0bf9 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -174,7 +174,6 @@ public class PlayerController : GLib.Object PlaylistsMenuitem playlists_menuitem = this.custom_items[widget_order.PLAYLISTS] as PlaylistsMenuitem; MetadataMenuitem metadata_menuitem = this.custom_items[widget_order.METADATA] as MetadataMenuitem; if(this.current_state != state.CONNECTED){ - // TODO metadata_menuitem.should_collapse (true); playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, false ); @@ -191,7 +190,6 @@ public class PlayerController : GLib.Object this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, true); } - debug ("SETTING PLAYLISTS MENUITEM TO %s", this.use_playlists.to_string()); playlists_menuitem.root_item.property_set_bool ( MENUITEM_PROP_VISIBLE, this.use_playlists ); } -- cgit v1.2.3 From 2240d3f7d355cbcf4f27c2facea4e704b91d7ddc Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 13 Sep 2011 10:41:24 +0100 Subject: link fix for maths --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 29cc33c..e79f64e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,7 @@ libsoundmenu_la_SOURCES = \ dbus-shared-names.h libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\" -libsoundmenu_la_LIBADD = $(APPLET_LIBS) +libsoundmenu_la_LIBADD = $(APPLET_LIBS) -lm libsoundmenu_la_LDFLAGS = -module -avoid-version -- cgit v1.2.3 From fb1369ee834e352a5150cfd8bd01d9bf4b2fa35b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 27 Sep 2011 16:05:02 +0100 Subject: only unmute on a handle event if the vol update is greater than zero, circumvent feedback issues with gnome-settings-daemon --- src/slider-menu-item.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index 8186fa3..165c3d5 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -113,7 +113,8 @@ handle_event (DbusmenuMenuitem * mi, */ slider_menu_item_update_volume (SLIDER_MENU_ITEM (mi), volume_input); - device_ensure_sink_is_unmuted (priv->a_sink); + if (volume_input > 0) + device_ensure_sink_is_unmuted (priv->a_sink); } -- cgit v1.2.3