aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-09-15 08:47:48 -0400
committerKen VanDine <ken.vandine@canonical.com>2010-09-15 08:47:48 -0400
commit9c0a0730c61f4e3b515f95a55d0db93e0d3ae21f (patch)
treefc606838e088adb8c394514a6e3cb55ca1b898f9 /src
parent51fbe7e43942f7fb94f6a26fd917cf181cde58af (diff)
parent16e74443cc9f2806f4ef0a0d142f93d921f4aa27 (diff)
downloadayatana-indicator-sound-9c0a0730c61f4e3b515f95a55d0db93e0d3ae21f.tar.gz
ayatana-indicator-sound-9c0a0730c61f4e3b515f95a55d0db93e0d3ae21f.tar.bz2
ayatana-indicator-sound-9c0a0730c61f4e3b515f95a55d0db93e0d3ae21f.zip
Import upstream version 0.4.6
Diffstat (limited to 'src')
-rw-r--r--src/familiar-players-db.c44
-rw-r--r--src/fetch-file.c16
-rw-r--r--src/indicator-sound.c11
-rw-r--r--src/mpris2-controller.c133
-rw-r--r--src/mpris2-controller.vala64
5 files changed, 75 insertions, 193 deletions
diff --git a/src/familiar-players-db.c b/src/familiar-players-db.c
index 96c8e32..2556b6c 100644
--- a/src/familiar-players-db.c
+++ b/src/familiar-players-db.c
@@ -140,10 +140,10 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
_tmp1_ = g_key_file_load_from_file (self->priv->key_file, self->priv->file_name, G_KEY_FILE_NONE, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch10_g_key_file_error;
+ goto __catch6_g_key_file_error;
}
if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch10_g_file_error;
+ goto __catch6_g_file_error;
}
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -151,8 +151,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
}
_result_ = _tmp1_;
}
- goto __finally10;
- __catch10_g_key_file_error:
+ goto __finally6;
+ __catch6_g_key_file_error:
{
GError * e;
e = _inner_error_;
@@ -163,8 +163,8 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
_g_error_free0 (e);
}
}
- goto __finally10;
- __catch10_g_file_error:
+ goto __finally6;
+ __catch6_g_file_error:
{
GError * e;
e = _inner_error_;
@@ -175,7 +175,7 @@ static gboolean familiar_players_db_create_key_file (FamiliarPlayersDB* self) {
_g_error_free0 (e);
}
}
- __finally10:
+ __finally6:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -196,7 +196,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) {
_tmp0_ = g_key_file_has_key (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch11_g_key_file_error;
+ goto __catch7_g_key_file_error;
}
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -207,8 +207,8 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) {
return result;
}
}
- goto __finally11;
- __catch11_g_key_file_error:
+ goto __finally7;
+ __catch7_g_key_file_error:
{
GError * e;
e = _inner_error_;
@@ -219,7 +219,7 @@ static gboolean familiar_players_db_check_for_keys (FamiliarPlayersDB* self) {
return result;
}
}
- __finally11:
+ __finally7:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -245,7 +245,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB*
desktops = (_tmp1_ = g_key_file_get_string_list (self->priv->key_file, FAMILIAR_PLAYERS_DB_GROUP_NAME, FAMILIAR_PLAYERS_DB_KEY_NAME, &_tmp0_, &_inner_error_), desktops_length1 = _tmp0_, _desktops_size_ = desktops_length1, _tmp1_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_KEY_FILE_ERROR) {
- goto __catch12_g_key_file_error;
+ goto __catch8_g_key_file_error;
}
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -270,8 +270,8 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB*
desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
return result;
}
- goto __finally12;
- __catch12_g_key_file_error:
+ goto __finally8;
+ __catch8_g_key_file_error:
{
GError * _error_;
_error_ = _inner_error_;
@@ -283,7 +283,7 @@ static gboolean familiar_players_db_load_data_from_key_file (FamiliarPlayersDB*
return result;
}
}
- __finally12:
+ __finally8:
{
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -338,8 +338,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
char* _tmp4_;
data = (_tmp4_ = g_key_file_to_data (keyfile, &data_length, NULL), _g_free0 (data), _tmp4_);
}
- goto __finally13;
- __catch13_g_key_file_error:
+ goto __finally9;
+ __catch9_g_key_file_error:
{
GError * e;
e = _inner_error_;
@@ -354,7 +354,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
return result;
}
}
- __finally13:
+ __finally9:
if (_inner_error_ != NULL) {
_g_free0 (data);
desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
@@ -376,7 +376,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
_tmp5_ = g_file_set_contents (self->priv->file_name, data, (gssize) data_length, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_FILE_ERROR) {
- goto __catch14_g_file_error;
+ goto __catch10_g_file_error;
}
_g_free0 (data);
desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
@@ -389,8 +389,8 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
g_warning ("familiar-players-db.vala:125: Unable to write out file '%s'", self->priv->file_name);
}
}
- goto __finally14;
- __catch14_g_file_error:
+ goto __finally10;
+ __catch10_g_file_error:
{
GError * err;
err = _inner_error_;
@@ -400,7 +400,7 @@ static gboolean familiar_players_db_write_db (FamiliarPlayersDB* self) {
_g_error_free0 (err);
}
}
- __finally14:
+ __finally10:
if (_inner_error_ != NULL) {
_g_free0 (data);
desktops = (_vala_array_free (desktops, desktops_length1, (GDestroyNotify) g_free), NULL);
diff --git a/src/fetch-file.c b/src/fetch-file.c
index 4b8941b..4a8d595 100644
--- a/src/fetch-file.c
+++ b/src/fetch-file.c
@@ -187,14 +187,14 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) {
{
data->_tmp0_ = g_file_read (data->self->priv->file, NULL, &data->_inner_error_);
if (data->_inner_error_ != NULL) {
- goto __catch15_g_error;
+ goto __catch11_g_error;
}
data->self->priv->stream = (data->_tmp2_ = g_data_input_stream_new ((GInputStream*) (data->_tmp1_ = data->_tmp0_)), _g_object_unref0 (data->self->priv->stream), data->_tmp2_);
_g_object_unref0 (data->_tmp1_);
g_data_input_stream_set_byte_order (data->self->priv->stream, G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN);
}
- goto __finally15;
- __catch15_g_error:
+ goto __finally11;
+ __catch11_g_error:
{
data->e = data->_inner_error_;
data->_inner_error_ = NULL;
@@ -203,7 +203,7 @@ static gboolean fetch_file_fetch_data_co (FetchFileFetchDataData* data) {
_g_error_free0 (data->e);
}
}
- __finally15:
+ __finally11:
if (data->_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
g_clear_error (&data->_inner_error_);
@@ -283,7 +283,7 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD
_state_1:
data->_tmp2_ = g_input_stream_read_finish ((GInputStream*) data->self->priv->stream, data->_res_, &data->_inner_error_);
if (data->_inner_error_ != NULL) {
- goto __catch16_g_error;
+ goto __catch12_g_error;
}
data->bufsize = data->_tmp2_;
if (data->bufsize < 1) {
@@ -298,8 +298,8 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD
g_byte_array_append (data->self->priv->data, data->buffer, data->buffer_length1);
}
}
- goto __finally16;
- __catch16_g_error:
+ goto __finally12;
+ __catch12_g_error:
{
data->e = data->_inner_error_;
data->_inner_error_ = NULL;
@@ -308,7 +308,7 @@ static gboolean fetch_file_read_something_async_co (FetchFileReadSomethingAsyncD
_g_error_free0 (data->e);
}
}
- __finally16:
+ __finally12:
if (data->_inner_error_ != NULL) {
data->buffer = (g_free (data->buffer), NULL);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, data->_inner_error_->message, g_quark_to_string (data->_inner_error_->domain), data->_inner_error_->code);
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/mpris2-controller.c b/src/mpris2-controller.c
index 945fc7b..ac90fc4 100644
--- a/src/mpris2-controller.c
+++ b/src/mpris2-controller.c
@@ -122,8 +122,8 @@ typedef struct _TransportMenuitemClass TransportMenuitemClass;
#define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
#define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ())
-#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL)))
+#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
struct _MprisRootIface {
GTypeInterface parent_iface;
@@ -419,6 +419,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
GeeHashSet* metadata_menuitem_attributes_format (void);
void player_item_update (PlayerItem* self, GHashTable* data, GeeHashSet* attributes);
+gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
static void _vala_GValue_free (GValue* self);
static char** _vala_array_dup1 (char** self, int length);
void mpris2_controller_initial_update (Mpris2Controller* self);
@@ -4457,7 +4458,6 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char*
char* _tmp0_;
gboolean _tmp1_ = FALSE;
GValue* play_v;
- GValue* pos_v;
GValue* meta_v;
g_return_if_fail (self != NULL);
g_return_if_fail (interface_source != NULL);
@@ -4482,36 +4482,30 @@ void mpris2_controller_property_changed_cb (Mpris2Controller* self, const char*
PlayerItem* _tmp2_;
TransportMenuitem* _tmp3_;
state = mpris_player_get_PlaybackStatus (self->priv->_player);
- g_debug ("mpris2-controller.vala:104: new playback state = %s", state);
p = (TransportMenuitemstate) mpris2_controller_determine_play_state (self, state);
transport_menuitem_change_play_state (_tmp3_ = (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp2_) ? ((TransportMenuitem*) _tmp2_) : NULL), p);
_g_object_unref0 (_tmp3_);
_g_free0 (state);
}
- pos_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Position"));
- if (pos_v != NULL) {
- gint64 pos;
- pos = g_value_get_int64 (pos_v);
- g_debug ("mpris2-controller.vala:112: new position = %i", (gint) pos);
- }
meta_v = __g_value_dup0 ((GValue*) g_hash_table_lookup (changed_properties, "Metadata"));
if (meta_v != NULL) {
GHashTable* changed_updates;
- PlayerItem* _tmp4_;
+ PlayerItem* metadata;
+ GeeHashSet* _tmp4_;
GeeHashSet* _tmp5_;
- PlayerItem* _tmp6_;
- GeeHashSet* _tmp7_;
+ GeeHashSet* _tmp6_;
changed_updates = mpris2_controller_clean_metadata (self);
- player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ());
- _g_object_unref0 (_tmp5_);
+ metadata = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ player_item_reset (metadata, _tmp4_ = metadata_menuitem_attributes_format ());
_g_object_unref0 (_tmp4_);
- player_item_update (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), changed_updates, _tmp7_ = metadata_menuitem_attributes_format ());
- _g_object_unref0 (_tmp7_);
+ player_item_update (metadata, changed_updates, _tmp5_ = metadata_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp5_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) metadata, DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (metadata, _tmp6_ = metadata_menuitem_attributes_format ()));
_g_object_unref0 (_tmp6_);
+ _g_object_unref0 (metadata);
_g_hash_table_unref0 (changed_updates);
}
__vala_GValue_free0 (meta_v);
- __vala_GValue_free0 (pos_v);
__vala_GValue_free0 (play_v);
}
@@ -4552,7 +4546,7 @@ static GHashTable* mpris2_controller_clean_metadata (Mpris2Controller* self) {
artists = (_tmp5_ = (_tmp4_ = (_tmp3_ = g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist")), (_tmp3_ == NULL) ? ((gpointer) _tmp3_) : _vala_array_dup1 (_tmp3_, g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))))), _g_hash_table_unref0 (_tmp2_), _tmp4_), artists_length1 = g_strv_length (g_value_get_boxed ((GValue*) g_hash_table_lookup (_tmp2_ = mpris_player_get_Metadata (self->priv->_player), "xesam:artist"))), _artists_size_ = artists_length1, _tmp5_);
display_artists = g_strjoinv (", ", artists);
g_hash_table_replace (changed_updates, g_strdup ("xesam:artist"), (_tmp6_ = g_new0 (GValue, 1), g_value_init (_tmp6_, G_TYPE_STRING), g_value_set_string (_tmp6_, display_artists), _tmp6_));
- g_debug ("mpris2-controller.vala:132: artist : %s", display_artists);
+ g_debug ("mpris2-controller.vala:128: artist : %s", display_artists);
_g_free0 (display_artists);
artists = (_vala_array_free (artists, artists_length1, (GDestroyNotify) g_free), NULL);
}
@@ -4587,7 +4581,6 @@ static TransportMenuitemstate mpris2_controller_determine_play_state (Mpris2Cont
_tmp0_ = FALSE;
}
if (_tmp0_) {
- g_debug ("mpris2-controller.vala:148: determine play state - state = %s", status);
result = TRANSPORT_MENUITEM_STATE_PLAYING;
return result;
}
@@ -4613,7 +4606,6 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
update = mpris2_controller_determine_play_state (self, _tmp2_ = mpris_player_get_PlaybackStatus (self->priv->_player));
_g_free0 (_tmp2_);
}
- g_debug ("mpris2-controller.vala:163: initial update - play state %i", (gint) update);
transport_menuitem_change_play_state (_tmp4_ = (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), IS_TRANSPORT_MENUITEM (_tmp3_) ? ((TransportMenuitem*) _tmp3_) : NULL), update);
_g_object_unref0 (_tmp4_);
cleaned_metadata = mpris2_controller_clean_metadata (self);
@@ -4625,78 +4617,16 @@ void mpris2_controller_initial_update (Mpris2Controller* self) {
void mpris2_controller_transport_update (Mpris2Controller* self, TransportMenuitemaction command) {
- GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
- g_debug ("mpris2-controller.vala:173: transport_event input = %i", (gint) command);
+ g_debug ("mpris2-controller.vala:165: transport_event input = %i", (gint) command);
if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) {
- g_debug ("mpris2-controller.vala:175: transport_event PLAY_PAUSE");
- {
- mpris_player_PlayPause (self->priv->_player, NULL, NULL);
- }
- goto __finally5;
- __catch5_dbus_gerror:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- {
- g_warning ("mpris2-controller.vala:180: DBus Error calling the player objects Play" \
-"Pause method %s", _error_->message);
- _g_error_free0 (_error_);
- }
- }
- __finally5:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
+ mpris_player_PlayPause (self->priv->_player, NULL, NULL);
} else {
if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) {
- {
- mpris_player_Previous (self->priv->_player, NULL, NULL);
- }
- goto __finally6;
- __catch6_dbus_gerror:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- {
- g_warning ("mpris2-controller.vala:189: DBus Error calling the player objects Prev" \
-"ious method %s", _error_->message);
- _g_error_free0 (_error_);
- }
- }
- __finally6:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
+ mpris_player_Previous (self->priv->_player, NULL, NULL);
} else {
if (command == TRANSPORT_MENUITEM_ACTION_NEXT) {
- {
- mpris_player_Next (self->priv->_player, NULL, NULL);
- }
- goto __finally7;
- __catch7_dbus_gerror:
- {
- GError * _error_;
- _error_ = _inner_error_;
- _inner_error_ = NULL;
- {
- g_warning ("mpris2-controller.vala:198: DBus Error calling the player objects Next" \
-" method %s", _error_->message);
- _g_error_free0 (_error_);
- }
- }
- __finally7:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
+ mpris_player_Next (self->priv->_player, NULL, NULL);
}
}
}
@@ -4736,30 +4666,9 @@ gboolean mpris2_controller_was_successfull (Mpris2Controller* self) {
void mpris2_controller_expose (Mpris2Controller* self) {
- GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
if (mpris2_controller_connected (self) == TRUE) {
- {
- mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL);
- }
- goto __finally8;
- __catch8_dbus_gerror:
- {
- GError * e;
- e = _inner_error_;
- _inner_error_ = NULL;
- {
- g_error ("mpris2-controller.vala:224: Exception thrown while calling function Ra" \
-"ise - %s", e->message);
- _g_error_free0 (e);
- }
- }
- __finally8:
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
+ mpris_root_Raise (self->priv->_mpris2_root, NULL, NULL);
}
}
@@ -4869,7 +4778,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_);
if (_inner_error_ != NULL) {
if (_inner_error_->domain == DBUS_GERROR) {
- goto __catch9_dbus_gerror;
+ goto __catch5_dbus_gerror;
}
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -4896,8 +4805,8 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
g_signal_connect_object (self->priv->_properties_interface, "properties-changed", (GCallback) _mpris2_controller_property_changed_cb_free_desktop_properties_properties_changed, self, 0);
_dbus_g_connection_unref0 (connection);
}
- goto __finally9;
- __catch9_dbus_gerror:
+ goto __finally5;
+ __catch5_dbus_gerror:
{
GError * e;
e = _inner_error_;
@@ -4907,7 +4816,7 @@ static GObject * mpris2_controller_constructor (GType type, guint n_construct_pr
_g_error_free0 (e);
}
}
- __finally9:
+ __finally5:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala
index 2f5bcde..54e1868 100644
--- a/src/mpris2-controller.vala
+++ b/src/mpris2-controller.vala
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using DBus;
-
+using Dbusmenu;
[DBus (name = "org.mpris.MediaPlayer2")]
public interface MprisRoot : DBus.Object {
@@ -81,7 +81,7 @@ public class Mpris2Controller : GLib.Object
this.player = (MprisPlayer) connection.get_object (root_interface.concat(".").concat(this.owner.name.down()),
"/org/mpris/MediaPlayer2",
root_interface.concat(".Player"));
- this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",//root_interface.concat(".").concat(this.owner.name.down()),
+ this.properties_interface = (FreeDesktopProperties) connection.get_object("org.freedesktop.Properties.PropertiesChanged",
"/org/mpris/MediaPlayer2");
this.properties_interface.PropertiesChanged += property_changed_cb;
@@ -101,24 +101,20 @@ public class Mpris2Controller : GLib.Object
Value? play_v = changed_properties.lookup("PlaybackStatus");
if(play_v != null){
string state = this.player.PlaybackStatus;
- debug("new playback state = %s", state);
TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state);
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p);
}
- Value? pos_v = changed_properties.lookup("Position");
- if(pos_v != null){
- int64 pos = pos_v.get_int64();
- debug("new position = %i", (int)pos);
- }
-
Value? meta_v = changed_properties.lookup("Metadata");
if(meta_v != null){
- 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());
- }
+ GLib.HashTable<string, Value?> changed_updates = clean_metadata();
+ PlayerItem metadata = this.owner.custom_items[PlayerController.widget_order.METADATA];
+ metadata.reset(MetadataMenuitem.attributes_format());
+ metadata.update(changed_updates,
+ MetadataMenuitem.attributes_format());
+ metadata.property_set_bool(MENUITEM_PROP_VISIBLE,
+ metadata.populated(MetadataMenuitem.attributes_format()));
+ }
}
private GLib.HashTable<string, Value?> clean_metadata()
@@ -139,13 +135,11 @@ public class Mpris2Controller : GLib.Object
return changed_updates;
}
-
private TransportMenuitem.state determine_play_state(string status){
if(status == null)
return TransportMenuitem.state.PAUSED;
if(status != null && status == "Playing"){
- debug("determine play state - state = %s", status);
return TransportMenuitem.state.PLAYING;
}
return TransportMenuitem.state.PAUSED;
@@ -159,9 +153,7 @@ public class Mpris2Controller : GLib.Object
}
else{
update = determine_play_state(this.player.PlaybackStatus);
- }
- debug("initial update - play state %i", (int)update);
-
+ }
(this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(update);
GLib.HashTable<string, Value?> cleaned_metadata = this.clean_metadata();
this.owner.custom_items[PlayerController.widget_order.METADATA].update(cleaned_metadata,
@@ -172,32 +164,13 @@ public class Mpris2Controller : GLib.Object
{
debug("transport_event input = %i", (int)command);
if(command == TransportMenuitem.action.PLAY_PAUSE){
- debug("transport_event PLAY_PAUSE");
- try{
- this.player.PlayPause.begin();
- }
- catch(DBus.Error error){
- warning("DBus Error calling the player objects PlayPause method %s",
- error.message);
- }
+ this.player.PlayPause.begin();
}
else if(command == TransportMenuitem.action.PREVIOUS){
- try{
- this.player.Previous.begin();
- }
- catch(DBus.Error error){
- warning("DBus Error calling the player objects Previous method %s",
- error.message);
- }
+ this.player.Previous.begin();
}
else if(command == TransportMenuitem.action.NEXT){
- try{
- this.player.Next.begin();
- }
- catch(DBus.Error error){
- warning("DBus Error calling the player objects Next method %s",
- error.message);
- }
+ this.player.Next.begin();
}
}
@@ -208,7 +181,7 @@ public class Mpris2Controller : GLib.Object
public bool was_successfull(){
- if(this.mpris2_root == null ||this.player == null){
+ if(this.mpris2_root == null || this.player == null){
return false;
}
return true;
@@ -217,12 +190,7 @@ public class Mpris2Controller : GLib.Object
public void expose()
{
if(this.connected() == true){
- try{
- this.mpris2_root.Raise.begin();
- }
- catch(DBus.Error e){
- error("Exception thrown while calling function Raise - %s", e.message);
- }
+ this.mpris2_root.Raise.begin();
}
}
}