diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-sound.c | 8 | ||||
-rw-r--r-- | src/metadata-menu-item.c | 35 | ||||
-rw-r--r-- | src/metadata-menu-item.vala | 4 | ||||
-rw-r--r-- | src/metadata-widget.c | 51 | ||||
-rw-r--r-- | src/mpris2-controller.c | 6 | ||||
-rw-r--r-- | src/mpris2-interfaces.c | 18 | ||||
-rw-r--r-- | src/mpris2-interfaces.vala | 2 | ||||
-rw-r--r-- | src/music-player-bridge.h | 4 | ||||
-rw-r--r-- | src/player-controller.vala | 2 | ||||
-rw-r--r-- | src/pulseaudio-mgr.c | 62 | ||||
-rw-r--r-- | src/sound-service-dbus.c | 17 | ||||
-rw-r--r-- | src/transport-menu-item.c | 13 | ||||
-rw-r--r-- | src/transport-menu-item.vala | 1 | ||||
-rw-r--r-- | src/volume-widget.c | 56 |
14 files changed, 154 insertions, 125 deletions
diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 243e759..272c8da 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -299,8 +299,8 @@ connection_changed (IndicatorServiceManager * sm, node_info = g_dbus_node_info_new_for_xml ( _sound_service, &error ); if (error != NULL) { - g_warning( "Failed to get create interface info from xml: %s", - error->message ); + g_critical ( "Failed to get create interface info from xml: %s", + error->message ); g_error_free(error); return; } @@ -310,7 +310,7 @@ connection_changed (IndicatorServiceManager * sm, interface_info = g_dbus_node_info_lookup_interface (node_info, INDICATOR_SOUND_DBUS_INTERFACE); if (interface_info == NULL) { - g_error("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'"); + g_critical ("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'"); } } @@ -339,7 +339,7 @@ static void create_connection_to_service (GObject *source_object, priv->dbus_proxy = g_dbus_proxy_new_finish(res, &error); if (error != NULL) { - g_warning("Failed to get dbus proxy: %s", error->message); + g_critical ("Failed to get dbus proxy: %s", error->message); g_error_free(error); return; } diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c index f4ab318..1b75751 100644 --- a/src/metadata-menu-item.c +++ b/src/metadata-menu-item.c @@ -721,7 +721,6 @@ void metadata_menuitem_alter_label (MetadataMenuitem* self, const gchar* new_tit const gchar* _tmp0_; const gchar* _tmp1_; g_return_if_fail (self != NULL); - g_return_if_fail (new_title != NULL); _tmp0_ = new_title; if (_tmp0_ == NULL) { return; @@ -793,15 +792,10 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr const gchar* _tmp5_ = NULL; PlayerController* _tmp6_; PlayerController* _tmp7_; - GAppInfo* _tmp8_; - GAppInfo* _tmp9_; - const gchar* _tmp10_ = NULL; - PlayerController* _tmp11_; - PlayerController* _tmp12_; - const gchar* _tmp13_; - const gchar* _tmp14_; - GeeHashSet* _tmp15_ = NULL; - GeeHashSet* _tmp16_; + const gchar* _tmp8_; + const gchar* _tmp9_; + GeeHashSet* _tmp10_ = NULL; + GeeHashSet* _tmp11_; parent_class = G_OBJECT_CLASS (metadata_menuitem_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = METADATA_MENUITEM (obj); @@ -816,25 +810,18 @@ static GObject * metadata_menuitem_constructor (GType type, guint n_construct_pr _tmp3_ = player_controller_get_app_info (_tmp2_); _tmp4_ = _tmp3_; _tmp5_ = g_app_info_get_name (_tmp4_); - g_debug ("metadata-menu-item.vala:42: JUST ABOUT TO ATTEMPT PLAYER NAME SETTING " \ -"%s", _tmp5_); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp5_); _tmp6_ = player_item_get_owner ((PlayerItem*) self); _tmp7_ = _tmp6_; - _tmp8_ = player_controller_get_app_info (_tmp7_); + _tmp8_ = player_controller_get_icon_name (_tmp7_); _tmp9_ = _tmp8_; - _tmp10_ = g_app_info_get_name (_tmp9_); - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, _tmp10_); - _tmp11_ = player_item_get_owner ((PlayerItem*) self); - _tmp12_ = _tmp11_; - _tmp13_ = player_controller_get_icon_name (_tmp12_); - _tmp14_ = _tmp13_; - dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp14_); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_ICON, _tmp9_); dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING, FALSE); dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_HIDE_TRACK_DETAILS, TRUE); - _tmp15_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp16_ = _tmp15_; - player_item_reset ((PlayerItem*) self, _tmp16_); - _g_object_unref0 (_tmp16_); + _tmp10_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp11_ = _tmp10_; + player_item_reset ((PlayerItem*) self, _tmp11_); + _g_object_unref0 (_tmp11_); return obj; } diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 42f9667..b2dd752 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -39,7 +39,7 @@ public class MetadataMenuitem : PlayerItem MetadataMenuitem.clean_album_art_temp_dir(); this.previous_temp_album_art_path = null; this.album_art_cache_dir = MetadataMenuitem.create_album_art_temp_dir(); - debug ("JUST ABOUT TO ATTEMPT PLAYER NAME SETTING %s", this.owner.app_info.get_name()); + //debug ("JUST ABOUT TO ATTEMPT PLAYER NAME SETTING %s", this.owner.app_info.get_name()); this.property_set (MENUITEM_PLAYER_NAME, this.owner.app_info.get_name()); this.property_set (MENUITEM_PLAYER_ICON, this.owner.icon_name); this.property_set_bool (MENUITEM_PLAYER_RUNNING, false); @@ -178,7 +178,7 @@ public class MetadataMenuitem : PlayerItem } } - public void alter_label (string new_title) + public void alter_label (string? new_title) { if (new_title == null) return; this.property_set (MENUITEM_PLAYER_NAME, new_title); diff --git a/src/metadata-widget.c b/src/metadata-widget.c index 597c12c..da2ae9a 100644 --- a/src/metadata-widget.c +++ b/src/metadata-widget.c @@ -138,8 +138,7 @@ metadata_widget_init (MetadataWidget *self) hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); #else hbox = gtk_hbox_new(FALSE, 0); - #endif - + #endif priv->meta_data_h_box = hbox; priv->current_height = 1; @@ -270,6 +269,18 @@ metadata_widget_finalize (GObject *object) G_OBJECT_CLASS (metadata_widget_parent_class)->finalize (object); } +/** +* Make sure to only clear the album art only when it is not empty +* Otherwise it will continuously call queue_draw after each empty call. +*/ +static void +clear_album_art (GtkImage* album_art) +{ + if (gtk_image_get_storage_type(album_art) != GTK_IMAGE_EMPTY){ + gtk_image_clear (album_art); + } +} + #if GTK_CHECK_VERSION(3, 0, 0) static void @@ -279,6 +290,7 @@ metadata_widget_get_preferred_width (GtkWidget* self, { *minimum_width = *natural_width = 200; } + /** * We override the expose method to enable primitive drawing of the * empty album art image. @@ -298,15 +310,16 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata, return FALSE; } - if(priv->image_path->len > 0){ - if(g_string_equal(priv->image_path, priv->old_image_path) == FALSE || + if((guint)priv->image_path->len != 0){ + + if(g_string_equal (priv->image_path, priv->old_image_path) == FALSE || priv->theme_change_occured == TRUE){ priv->theme_change_occured = FALSE; GdkPixbuf* pixbuf; pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL); - + if(GDK_IS_PIXBUF(pixbuf) == FALSE){ - gtk_image_clear ( GTK_IMAGE(priv->album_art)); + clear_album_art (GTK_IMAGE(priv->album_art)); gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); draw_album_border (metadata, FALSE); draw_album_art_placeholder(metadata); @@ -325,9 +338,10 @@ metadata_image_expose_gtk_3 (GtkWidget *metadata, } return FALSE; } - gtk_image_clear (GTK_IMAGE(priv->album_art)); + clear_album_art (GTK_IMAGE(priv->album_art)); + g_string_erase (priv->old_image_path, 0, -1); gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); - draw_album_border (metadata, FALSE); + draw_album_border (metadata, FALSE); draw_album_art_placeholder(metadata); return FALSE; } @@ -337,8 +351,7 @@ static gboolean metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, cairo_t* cr, gpointer user_data) -{ - +{ g_return_val_if_fail(IS_METADATA_WIDGET(user_data), FALSE); MetadataWidget* meta = METADATA_WIDGET(user_data); MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(meta); @@ -371,11 +384,8 @@ metadata_widget_icon_triangle_draw_cb_gtk_3 (GtkWidget *widget, if (dbusmenu_menuitem_property_get_bool (priv->twin_item, DBUSMENU_METADATA_MENUITEM_PLAYER_RUNNING)){ y += gdk_pixbuf_get_height (priv->icon_buf) / 3 + 3; - //allocation.height/2.0 - (double)arrow_height/2.0; cairo_set_line_width (cr, 1.0); - //g_debug ("triangle drawing"); - cairo_move_to (cr, x, y); cairo_line_to (cr, x, y + arrow_height); cairo_line_to (cr, x + arrow_width, y + (double)arrow_height/2.0); @@ -417,7 +427,7 @@ metadata_image_expose (GtkWidget *metadata, pixbuf = gdk_pixbuf_new_from_file_at_size(priv->image_path->str, 60, 60, NULL); if(GDK_IS_PIXBUF(pixbuf) == FALSE){ - gtk_image_clear ( GTK_IMAGE(priv->album_art)); + clear_album_art (GTK_IMAGE(priv->album_art)); gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); draw_album_art_placeholder(metadata); return FALSE; @@ -434,7 +444,8 @@ metadata_image_expose (GtkWidget *metadata, } return FALSE; } - gtk_image_clear (GTK_IMAGE(priv->album_art)); + clear_album_art (GTK_IMAGE(priv->album_art)); + g_string_erase (priv->old_image_path, 0, -1); gtk_widget_set_size_request(GTK_WIDGET(priv->album_art), 60, 60); draw_album_art_placeholder(metadata); return FALSE; @@ -528,7 +539,7 @@ draw_album_border(GtkWidget *metadata, bg_normal.g = style->bg[0].green/65535.0; bg_normal.b = style->bg[0].blue/65535.0; - gint state = selected ? 5 : 0; + const gint state = selected ? GTK_STATE_SELECTED : GTK_STATE_NORMAL; fg_normal.r = style->fg[state].red/65535.0; fg_normal.g = style->fg[state].green/65535.0; @@ -597,7 +608,7 @@ draw_album_border(GtkWidget *metadata, static void draw_album_art_placeholder(GtkWidget *metadata) -{ +{ cairo_t *cr; cr = gdk_cairo_create (gtk_widget_get_window (metadata)); GtkStyle *style; @@ -726,7 +737,7 @@ metadata_widget_property_update(DbusmenuMenuitem* item, gchar* property, } else if(g_ascii_strcasecmp(DBUSMENU_METADATA_MENUITEM_ARTURL, property) == 0){ g_string_erase(priv->image_path, 0, -1); - g_string_overwrite(priv->image_path, 0, g_variant_get_string (value, NULL)); + g_string_overwrite (priv->image_path, 0, g_variant_get_string (value, NULL)); gtk_widget_queue_draw(GTK_WIDGET(mitem)); } else if (g_ascii_strcasecmp (DBUSMENU_METADATA_MENUITEM_PLAYER_NAME, property) == 0){ @@ -753,7 +764,7 @@ metadata_widget_handle_resizing (MetadataWidget* self) else{ gtk_widget_show (priv->meta_data_h_box); } - gtk_widget_queue_draw(GTK_WIDGET(self)); + gtk_widget_queue_draw(GTK_WIDGET(self)); } static void @@ -773,7 +784,7 @@ metadata_widget_set_style(GtkWidget* metadata, GtkStyle* style) MetadataWidget* widg = METADATA_WIDGET(metadata); MetadataWidgetPrivate * priv = METADATA_WIDGET_GET_PRIVATE(widg); priv->theme_change_occured = TRUE; - gtk_widget_queue_draw(GTK_WIDGET(metadata)); + gtk_widget_queue_draw (GTK_WIDGET(metadata)); } static void diff --git a/src/mpris2-controller.c b/src/mpris2-controller.c index 20d02a7..57250b6 100644 --- a/src/mpris2-controller.c +++ b/src/mpris2-controller.c @@ -212,7 +212,7 @@ struct _MprisPlaylistsIface { GTypeInterface parent_iface; void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error); - void (*GetPlaylists) (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); + void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1); void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1); @@ -377,7 +377,7 @@ void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, Pla static void mpris2_controller_fetch_playlists_data_free (gpointer _data); static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlaylistsData* _data_); MprisPlaylists* mpris2_controller_get_playlists (Mpris2Controller* self); -void mpris_playlists_GetPlaylists (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); +void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); static void mpris2_controller_fetch_playlists_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_); static void _vala_PlaylistDetails_array_free (PlaylistDetails* array, gint array_length); @@ -1148,7 +1148,7 @@ static gboolean mpris2_controller_fetch_playlists_co (Mpris2ControllerFetchPlayl _data_->_tmp0_ = _data_->self->priv->_playlists; _data_->_tmp1_ = 0; _data_->_state_ = 1; - mpris_playlists_GetPlaylists (_data_->_tmp0_, (gint32) 0, (guint32) MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, _data_); + mpris_playlists_GetPlaylists (_data_->_tmp0_, (guint32) 0, (guint32) MPRIS2_CONTROLLER_MAX_PLAYLIST_COUNT, "Alphabetical", FALSE, mpris2_controller_fetch_playlists_ready, _data_); return FALSE; _state_1: _data_->_tmp2_ = NULL; diff --git a/src/mpris2-interfaces.c b/src/mpris2-interfaces.c index d5d0bce..9058f95 100644 --- a/src/mpris2-interfaces.c +++ b/src/mpris2-interfaces.c @@ -122,7 +122,7 @@ struct _MprisPlaylistsIface { GTypeInterface parent_iface; void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error); - void (*GetPlaylists) (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); + void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1); void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1); @@ -257,7 +257,7 @@ guint mpris_playlists_register_object (void* object, GDBusConnection* connection GType mpris_playlists_get_type (void) G_GNUC_CONST; void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error); -void mpris_playlists_GetPlaylists (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); +void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1); void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1); @@ -270,7 +270,7 @@ static void mpris_playlists_proxy_g_signal (GDBusProxy* proxy, const gchar* send static void _dbus_handle_mpris_playlists_playlist_changed (MprisPlaylists* self, GVariant* parameters); static void mpris_playlists_proxy_ActivatePlaylist_async (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error); -static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); +static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); static PlaylistDetails* mpris_playlists_proxy_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); static gchar** mpris_playlists_dbus_proxy_get_Orderings (MprisPlaylists* self, int* result_length1); static void mpris_playlists_dbus_proxy_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1); @@ -342,7 +342,7 @@ static const GDBusArgInfo _mpris_playlists_dbus_arg_info_ActivatePlaylist_playli static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_in[] = {&_mpris_playlists_dbus_arg_info_ActivatePlaylist_playlist_id, NULL}; static const GDBusArgInfo * const _mpris_playlists_dbus_arg_info_ActivatePlaylist_out[] = {NULL}; static const GDBusMethodInfo _mpris_playlists_dbus_method_info_ActivatePlaylist = {-1, "ActivatePlaylist", (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_in), (GDBusArgInfo **) (&_mpris_playlists_dbus_arg_info_ActivatePlaylist_out)}; -static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_index = {-1, "index", "i"}; +static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_index = {-1, "index", "u"}; static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_max_count = {-1, "max_count", "u"}; static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_order = {-1, "order", "s"}; static const GDBusArgInfo _mpris_playlists_dbus_arg_info_GetPlaylists_reverse_order = {-1, "reverse_order", "b"}; @@ -1845,7 +1845,7 @@ void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult } -void mpris_playlists_GetPlaylists (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) { +void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) { MPRIS_PLAYLISTS_GET_INTERFACE (self)->GetPlaylists (self, index, max_count, order, reverse_order, _callback_, _user_data_); } @@ -2010,14 +2010,14 @@ static void mpris_playlists_proxy_ActivatePlaylist_finish (MprisPlaylists* self, } -static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) { +static void mpris_playlists_proxy_GetPlaylists_async (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_) { GDBusMessage *_message; GVariant *_arguments; GVariantBuilder _arguments_builder; G_IO_ERROR; _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.mpris.MediaPlayer2.Playlists", "GetPlaylists"); g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value (&_arguments_builder, g_variant_new_int32 (index)); + g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (index)); g_variant_builder_add_value (&_arguments_builder, g_variant_new_uint32 (max_count)); g_variant_builder_add_value (&_arguments_builder, g_variant_new_string (order)); g_variant_builder_add_value (&_arguments_builder, g_variant_new_boolean (reverse_order)); @@ -2340,7 +2340,7 @@ static void _dbus_mpris_playlists_ActivatePlaylist_ready (GObject * source_objec static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* parameters, GDBusMethodInvocation* invocation) { GVariantIter _arguments_iter; - gint32 index = 0; + guint32 index = 0U; GVariant* _tmp51_; guint32 max_count = 0U; GVariant* _tmp52_; @@ -2350,7 +2350,7 @@ static void _dbus_mpris_playlists_GetPlaylists (MprisPlaylists* self, GVariant* GVariant* _tmp54_; g_variant_iter_init (&_arguments_iter, parameters); _tmp51_ = g_variant_iter_next_value (&_arguments_iter); - index = g_variant_get_int32 (_tmp51_); + index = g_variant_get_uint32 (_tmp51_); g_variant_unref (_tmp51_); _tmp52_ = g_variant_iter_next_value (&_arguments_iter); max_count = g_variant_get_uint32 (_tmp52_); diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala index ee86c2b..db6888d 100644 --- a/src/mpris2-interfaces.vala +++ b/src/mpris2-interfaces.vala @@ -69,7 +69,7 @@ public interface MprisPlaylists : Object { //methods public abstract async void ActivatePlaylist(ObjectPath playlist_id) throws IOError; - public abstract async PlaylistDetails[]? GetPlaylists ( int32 index, + public abstract async PlaylistDetails[]? GetPlaylists ( uint32 index, uint32 max_count, string order, bool reverse_order ) throws IOError; diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h index f02d20e..3a0cb33 100644 --- a/src/music-player-bridge.h +++ b/src/music-player-bridge.h @@ -345,7 +345,7 @@ struct _MprisPlaylistsIface { GTypeInterface parent_iface; void (*ActivatePlaylist) (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); void (*ActivatePlaylist_finish) (MprisPlaylists* self, GAsyncResult* _res_, GError** error); - void (*GetPlaylists) (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); + void (*GetPlaylists) (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* (*GetPlaylists_finish) (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); gchar** (*get_Orderings) (MprisPlaylists* self, int* result_length1); void (*set_Orderings) (MprisPlaylists* self, gchar** value, int value_length1); @@ -526,7 +526,7 @@ guint mpris_playlists_register_object (void* object, GDBusConnection* connection GType mpris_playlists_get_type (void) G_GNUC_CONST; void mpris_playlists_ActivatePlaylist (MprisPlaylists* self, const char* playlist_id, GAsyncReadyCallback _callback_, gpointer _user_data_); void mpris_playlists_ActivatePlaylist_finish (MprisPlaylists* self, GAsyncResult* _res_, GError** error); -void mpris_playlists_GetPlaylists (MprisPlaylists* self, gint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); +void mpris_playlists_GetPlaylists (MprisPlaylists* self, guint32 index, guint32 max_count, const gchar* order, gboolean reverse_order, GAsyncReadyCallback _callback_, gpointer _user_data_); PlaylistDetails* mpris_playlists_GetPlaylists_finish (MprisPlaylists* self, GAsyncResult* _res_, int* result_length1, GError** error); gchar** mpris_playlists_get_Orderings (MprisPlaylists* self, int* result_length1); void mpris_playlists_set_Orderings (MprisPlaylists* self, gchar** value, int value_length1); diff --git a/src/player-controller.vala b/src/player-controller.vala index 8d3e6cc..80a48c3 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -174,7 +174,7 @@ public class PlayerController : GLib.Object if(this.current_state != state.CONNECTED){ metadata_menuitem.should_collapse (true); playlists_menuitem.root_item.property_set_bool (MENUITEM_PROP_VISIBLE, - false ); + false); this.custom_items[widget_order.TRANSPORT].property_set_bool (MENUITEM_PROP_VISIBLE, this.app_info.get_id() == "rhythmbox.desktop"); return; diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index fee504e..f205723 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -218,7 +218,7 @@ pm_update_mute (gboolean update) if (!operation){ g_warning ("pm_update_mute operation failed for some reason"); return; - } + } pa_operation_unref (operation); } @@ -401,27 +401,39 @@ pm_context_state_callback (pa_context *c, void *userdata) case PA_CONTEXT_READY: connection_attempts = 0; g_debug("PA_CONTEXT_READY"); + if (reconnect_idle_id != 0){ g_source_remove (reconnect_idle_id); reconnect_idle_id = 0; } - pa_operation *o; pa_context_set_subscribe_callback(c, pm_subscribed_events_callback, userdata); - - if (!(o = pa_context_subscribe (c, (pa_subscription_mask_t) - (PA_SUBSCRIPTION_MASK_SINK| - PA_SUBSCRIPTION_MASK_SOURCE| - PA_SUBSCRIPTION_MASK_SINK_INPUT| - PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| - PA_SUBSCRIPTION_MASK_SERVER), NULL, NULL))) { - g_warning("pa_context_subscribe() failed"); + pa_operation *o = NULL; + + o = pa_context_subscribe (c, (pa_subscription_mask_t) + (PA_SUBSCRIPTION_MASK_SINK| + PA_SUBSCRIPTION_MASK_SOURCE| + PA_SUBSCRIPTION_MASK_SINK_INPUT| + PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT| + PA_SUBSCRIPTION_MASK_SERVER), + NULL, + NULL); + + if (!o){ + g_critical("pa_context_subscribe() failed - ?"); + return; } - if (!(o = pa_context_get_server_info (c, pm_server_info_callback, userdata))) { - g_warning("Initial - pa_context_get_server_info() failed"); + pa_operation_unref(o); + + o = pa_context_get_server_info (c, pm_server_info_callback, userdata); + + if (!o){ + g_warning("pa_context_get_server_info() failed - ?"); + return; } + pa_operation_unref(o); break; @@ -621,17 +633,23 @@ pm_toggle_mute_for_every_sink_callback (pa_context *c, if (eol > 0) { return; } - else { - if (sink == NULL) { - g_warning ("toggle_mute cb - sink parameter is null - why ?"); - return; - } - pa_operation_unref (pa_context_set_sink_mute_by_index (c, - sink->index, - GPOINTER_TO_INT(userdata), - NULL, - NULL)); + + if (sink == NULL) { + g_warning ("toggle_mute cb - sink parameter is null - why ?"); + return; + } + + pa_operation *operation = NULL; + operation = pa_context_set_sink_mute_by_index (c, + sink->index, + GPOINTER_TO_INT(userdata), + NULL, + NULL); + if (!operation){ + g_warning ("pm_update_mic_mute operation failed for some reason"); + return; } + pa_operation_unref (operation); } // Source info related callbacks diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 07d3d6f..7cad2bc 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -107,7 +107,7 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) node_info = g_dbus_node_info_new_for_xml(_sound_service, &error); if (error != NULL) { - g_error("Unable to parse Indicator Service Interface description: %s", + g_critical ("Unable to parse Indicator Service Interface description: %s", error->message); g_error_free(error); } @@ -118,7 +118,7 @@ sound_service_dbus_class_init (SoundServiceDbusClass *klass) INDICATOR_SOUND_DBUS_INTERFACE); if (interface_info == NULL) { - g_error("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'"); + g_critical("Unable to find interface '" INDICATOR_SOUND_DBUS_INTERFACE "'"); } } signals[TRACK_SPECIFIC_ITEM] = g_signal_new("track-specific-item-requested", @@ -151,8 +151,8 @@ sound_service_dbus_init (SoundServiceDbus *self) priv->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); if (error != NULL) { - g_error("sound-service-dbus:Unable to connect to the session bus when creating indicator sound service : %s", error->message); - g_error_free(error); + g_critical ("sound-service-dbus:Unable to connect to the session bus when creating indicator sound service : %s", error->message); + g_error_free (error); return; } /* register the service on it */ @@ -164,9 +164,8 @@ sound_service_dbus_init (SoundServiceDbus *self) NULL, &error); if (error != NULL) { - g_error("Unable to register the object to DBus: %s", error->message); - g_error_free(error); - return; + g_critical ("Unable to register the sound service on DBus: %s", error->message); + g_error_free (error); } } @@ -275,12 +274,12 @@ sound_service_dbus_update_sound_state (SoundServiceDbus* self, if (priv->connection == NULL || g_dbus_connection_is_closed (priv->connection) == TRUE){ - g_critical ("sound_service_dbus_update_sound_state - connection is %s !!", + g_critical ("sound_service_dbus_update_sound_state - dbus connection is %s !!", priv->connection == NULL? "NULL" : "closed"); return; } - g_debug ("emitting state signal with value %i", (int)new_state); + //g_debug ("emitting state signal with value %i", (int)new_state); g_dbus_connection_emit_signal( priv->connection, NULL, INDICATOR_SOUND_SERVICE_DBUS_OBJECT_PATH, diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index a73091b..4fb493a 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -33,6 +33,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gee.h> #include <stdlib.h> #include <string.h> +#include <gio/gio.h> #define TYPE_PLAYER_ITEM (player_item_get_type ()) @@ -151,6 +152,7 @@ void player_controller_instantiate (PlayerController* self); GeeHashSet* transport_menuitem_attributes_format (void); GType player_controller_state_get_type (void) G_GNUC_CONST; static GObject * transport_menuitem_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +GAppInfo* player_controller_get_app_info (PlayerController* self); static void transport_menuitem_finalize (GObject* obj); static void _vala_transport_menuitem_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -314,10 +316,21 @@ static GObject * transport_menuitem_constructor (GType type, guint n_construct_p GObject * obj; GObjectClass * parent_class; TransportMenuitem * self; + PlayerController* _tmp0_; + PlayerController* _tmp1_; + GAppInfo* _tmp2_; + GAppInfo* _tmp3_; + const gchar* _tmp4_ = NULL; parent_class = G_OBJECT_CLASS (transport_menuitem_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = TRANSPORT_MENUITEM (obj); dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, (gint) TRANSPORT_STATE_PAUSED); + _tmp0_ = player_item_get_owner ((PlayerItem*) self); + _tmp1_ = _tmp0_; + _tmp2_ = player_controller_get_app_info (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = g_app_info_get_name (_tmp3_); + dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, DBUSMENU_MENUITEM_PROP_LABEL, _tmp4_); self->priv->cached_action = TRANSPORT_ACTION_NO_ACTION; return obj; } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index ec41dd7..4ec7dad 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -38,6 +38,7 @@ public class TransportMenuitem : PlayerItem } construct{ this.property_set_int(MENUITEM_PLAY_STATE, (int)Transport.State.PAUSED); + this.property_set (MENUITEM_PROP_LABEL, this.owner.app_info.get_name()); this.cached_action = Transport.Action.NO_ACTION; } diff --git a/src/volume-widget.c b/src/volume-widget.c index bd68eb3..c71c1e3 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -56,7 +56,8 @@ static gboolean volume_widget_change_value_cb (GtkRange *range, GtkScrollType scroll, gdouble value, gpointer user_data); -static gboolean volume_widget_value_changed_cb(GtkRange *range, gpointer user_data); +static void volume_widget_primary_clicked(GtkWidget *widget, gpointer user_data); +static void volume_widget_secondary_clicked(GtkWidget *widget, gpointer user_data); static void volume_widget_slider_grabbed(GtkWidget *widget, gpointer user_data); static void volume_widget_slider_released(GtkWidget *widget, gpointer user_data); static void volume_widget_parent_changed (GtkWidget *widget, gpointer user_data); @@ -93,7 +94,8 @@ volume_widget_init (VolumeWidget *self) GtkWidget* volume_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); g_signal_connect(volume_widget, "change-value", G_CALLBACK(volume_widget_change_value_cb), self); - g_signal_connect(volume_widget, "value-changed", G_CALLBACK(volume_widget_value_changed_cb), self); + g_signal_connect(priv->ido_volume_slider, "primary-clicked", G_CALLBACK(volume_widget_primary_clicked), self); + g_signal_connect(priv->ido_volume_slider, "secondary-clicked", G_CALLBACK(volume_widget_secondary_clicked), self); g_signal_connect(priv->ido_volume_slider, "slider-grabbed", G_CALLBACK(volume_widget_slider_grabbed), self); g_signal_connect(priv->ido_volume_slider, "slider-released", G_CALLBACK(volume_widget_slider_released), self); @@ -213,32 +215,6 @@ volume_widget_change_value_cb (GtkRange *range, return FALSE; } -/* - We only want this callback to catch mouse icon press events - which set the slider to 0 or 100. Ignore all other events. -*/ -static gboolean -volume_widget_value_changed_cb (GtkRange *range, gpointer user_data) -{ - - g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); - VolumeWidget* mitem = VOLUME_WIDGET (user_data); - VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); - gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); - - gboolean mute = g_variant_get_boolean (dbusmenu_menuitem_property_get_variant (priv->twin_item, - DBUSMENU_VOLUME_MENUITEM_MUTE)); - if((current_value == 0 && mute == FALSE) || current_value == 100){ -/* - g_debug ("value changed - actual set %f", current_value); -*/ - volume_widget_update (mitem, current_value, "value-changed"); - } - - return FALSE; -} - void volume_widget_update(VolumeWidget* self, gdouble update, gchar* label) { @@ -253,6 +229,30 @@ volume_widget_update(VolumeWidget* self, gdouble update, gchar* label) dbusmenu_menuitem_handle_event (priv->twin_item, source, new_volume, 0); } +static void +volume_widget_update_from_scale (VolumeWidget *self) +{ + g_return_if_fail (IS_VOLUME_WIDGET (self)); + + VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(self); + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + const gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); + g_debug ("%s - setting value to %.0f", G_STRFUNC, current_value); + volume_widget_update (self, current_value, "value-changed"); +} + +static void +volume_widget_primary_clicked (GtkWidget *widget G_GNUC_UNUSED, gpointer user_data) +{ + volume_widget_update_from_scale (VOLUME_WIDGET(user_data)); +} + +static void +volume_widget_secondary_clicked(GtkWidget *widget, gpointer user_data) +{ + volume_widget_update_from_scale (VOLUME_WIDGET(user_data)); +} + GtkWidget* volume_widget_get_ido_slider(VolumeWidget* self) { |