diff options
author | Ken VanDine <ken.vandine@canonical.com> | 2010-11-18 11:13:31 -0500 |
---|---|---|
committer | Ken VanDine <ken.vandine@canonical.com> | 2010-11-18 11:13:31 -0500 |
commit | 13bc64e0a3c144740c30e2469fdb5f605d58ee39 (patch) | |
tree | 21b2af1f4d2d796bdbf2af16761de5be769e87fa /src/player-controller.c | |
parent | 908222c0681fba3c6e1265d0f85a0b667927c169 (diff) | |
parent | 0d5c60e9161f4b1b4315bbfac7862ef662f577ee (diff) | |
download | ayatana-indicator-sound-13bc64e0a3c144740c30e2469fdb5f605d58ee39.tar.gz ayatana-indicator-sound-13bc64e0a3c144740c30e2469fdb5f605d58ee39.tar.bz2 ayatana-indicator-sound-13bc64e0a3c144740c30e2469fdb5f605d58ee39.zip |
Import upstream version 0.5.2
Diffstat (limited to 'src/player-controller.c')
-rw-r--r-- | src/player-controller.c | 422 |
1 files changed, 280 insertions, 142 deletions
diff --git a/src/player-controller.c b/src/player-controller.c index ee477e7..e4a2172 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.10.0, the Vala compiler +/* player-controller.c generated by valac 0.11.2, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -115,11 +115,11 @@ struct _PlayerControllerClass { struct _PlayerControllerPrivate { DbusmenuMenuitem* root_menu; - char* _name; - char* _mpris_name; + gchar* _name; + gchar* _mpris_name; GAppInfo* _app_info; gint _menu_offset; - char* _icon_name; + gchar* _icon_name; }; typedef enum { @@ -155,20 +155,20 @@ enum { GType player_controller_widget_order_get_type (void) G_GNUC_CONST; GType player_controller_state_get_type (void) G_GNUC_CONST; #define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const char* mpris_name, const char* icon_name, gint offset, PlayerControllerstate initial_state); -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const char* mpris_name, const char* icon_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state); void player_controller_set_app_info (PlayerController* self, GAppInfo* value); -static char* player_controller_format_player_name (char* app_info_name); +static gchar* player_controller_format_player_name (gchar* app_info_name); GAppInfo* player_controller_get_app_info (PlayerController* self); -void player_controller_set_name (PlayerController* self, const char* value); -void player_controller_set_mpris_name (PlayerController* self, const char* value); -void player_controller_set_icon_name (PlayerController* self, const char* value); +void player_controller_set_name (PlayerController* self, const gchar* value); +void player_controller_set_mpris_name (PlayerController* self, const gchar* value); +void player_controller_set_icon_name (PlayerController* self, const gchar* value); void player_controller_set_menu_offset (PlayerController* self, gint value); static void player_controller_construct_widgets (PlayerController* self); static void player_controller_establish_mpris_connection (PlayerController* self); void player_controller_update_layout (PlayerController* self); void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state); -const char* player_controller_get_name (PlayerController* self); +const gchar* player_controller_get_name (PlayerController* self); void player_controller_activate (PlayerController* self); void player_controller_instantiate (PlayerController* self); Mpris2Controller* mpris2_controller_new (PlayerController* ctrl); @@ -182,8 +182,8 @@ GeeHashSet* metadata_menuitem_attributes_format (void); GType title_menuitem_get_type (void) G_GNUC_CONST; void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update); gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs); -PlayerItem* player_item_new (const char* type); -PlayerItem* player_item_construct (GType object_type, const char* type); +PlayerItem* player_item_new (const gchar* type); +PlayerItem* player_item_construct (GType object_type, const gchar* type); TitleMenuitem* title_menuitem_new (PlayerController* parent); TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent); MetadataMenuitem* metadata_menuitem_new (void); @@ -195,17 +195,16 @@ GType transport_menuitem_get_type (void) G_GNUC_CONST; gint player_controller_get_menu_offset (PlayerController* self); gboolean mpris2_controller_connected (Mpris2Controller* self); void mpris2_controller_initial_update (Mpris2Controller* self); -const char* player_controller_get_mpris_name (PlayerController* self); -const char* player_controller_get_icon_name (PlayerController* self); +const gchar* player_controller_get_mpris_name (PlayerController* self); +const gchar* player_controller_get_icon_name (PlayerController* self); static void player_controller_finalize (GObject* obj); -static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); -static void player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +static void _vala_player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); static gint _vala_array_length (gpointer array); - GType player_controller_widget_order_get_type (void) { static volatile gsize player_controller_widget_order_type_id__volatile = 0; if (g_once_init_enter (&player_controller_widget_order_type_id__volatile)) { @@ -235,23 +234,38 @@ static gpointer _g_object_ref0 (gpointer self) { } -PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const char* mpris_name, const char* icon_name, gint offset, PlayerControllerstate initial_state) { - PlayerController * self; +PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) { + PlayerController * self = NULL; DbusmenuMenuitem* _tmp0_; - char* _tmp1_; - GeeArrayList* _tmp2_; + DbusmenuMenuitem* _tmp1_; + const gchar* _tmp2_ = NULL; + gchar* _tmp3_; + gchar* _tmp4_ = NULL; + gchar* _tmp5_; + GeeArrayList* _tmp6_ = NULL; + GeeArrayList* _tmp7_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (app != NULL, NULL); g_return_val_if_fail (mpris_name != NULL, NULL); g_return_val_if_fail (icon_name != NULL, NULL); self = (PlayerController*) g_object_new (object_type, NULL); - self->priv->root_menu = (_tmp0_ = _g_object_ref0 (root), _g_object_unref0 (self->priv->root_menu), _tmp0_); + _tmp0_ = _g_object_ref0 (root); + _tmp1_ = _tmp0_; + _g_object_unref0 (self->priv->root_menu); + self->priv->root_menu = _tmp1_; player_controller_set_app_info (self, app); - player_controller_set_name (self, _tmp1_ = player_controller_format_player_name (g_strdup (g_app_info_get_name (self->priv->_app_info)))); - _g_free0 (_tmp1_); + _tmp2_ = g_app_info_get_name (self->priv->_app_info); + _tmp3_ = g_strdup (_tmp2_); + _tmp4_ = player_controller_format_player_name (_tmp3_); + _tmp5_ = _tmp4_; + player_controller_set_name (self, _tmp5_); + _g_free0 (_tmp5_); player_controller_set_mpris_name (self, mpris_name); player_controller_set_icon_name (self, icon_name); - self->custom_items = (_tmp2_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->custom_items), _tmp2_); + _tmp6_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + _tmp7_ = _tmp6_; + _g_object_unref0 (self->custom_items); + self->custom_items = _tmp7_; self->current_state = (gint) initial_state; player_controller_set_menu_offset (self, offset); player_controller_construct_widgets (self); @@ -261,7 +275,7 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit } -PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const char* mpris_name, const char* icon_name, gint offset, PlayerControllerstate initial_state) { +PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* mpris_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) { return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, mpris_name, icon_name, offset, initial_state); } @@ -285,24 +299,20 @@ void player_controller_instantiate (PlayerController* self) { GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); g_debug ("player-controller.vala:94: instantiate in player controller for %s", self->priv->_name); - { - g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch4_g_error; - } - player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); + g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch4_g_error; } + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); goto __finally4; __catch4_g_error: { GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; - { - g_warning ("player-controller.vala:100: Failed to launch app %s with error message" \ + g_warning ("player-controller.vala:100: Failed to launch app %s with error message" \ ": %s", self->priv->_name, _error_->message); - _g_error_free0 (_error_); - } + _g_error_free0 (_error_); } __finally4: if (_inner_error_ != NULL) { @@ -314,14 +324,18 @@ void player_controller_instantiate (PlayerController* self) { static void player_controller_establish_mpris_connection (PlayerController* self) { - Mpris2Controller* _tmp0_; + Mpris2Controller* _tmp0_ = NULL; + Mpris2Controller* _tmp1_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { g_debug ("player-controller.vala:107: establish_mpris_connection - Not ready to " \ "connect"); return; } - self->mpris_bridge = (_tmp0_ = mpris2_controller_new (self), _g_object_unref0 (self->mpris_bridge), _tmp0_); + _tmp0_ = mpris2_controller_new (self); + _tmp1_ = _tmp0_; + _g_object_unref0 (self->mpris_bridge); + self->mpris_bridge = _tmp1_; player_controller_determine_state (self); } @@ -329,94 +343,161 @@ static void player_controller_establish_mpris_connection (PlayerController* self void player_controller_vanish (PlayerController* self) { g_return_if_fail (self != NULL); { - GeeIterator* _item_it; - _item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items); + GeeArrayList* _tmp0_; + GeeArrayList* _item_list; + gint _tmp1_; + gint _item_size; + gint _item_index; + _tmp0_ = _g_object_ref0 (self->custom_items); + _item_list = _tmp0_; + _tmp1_ = gee_collection_get_size ((GeeCollection*) _item_list); + _item_size = _tmp1_; + _item_index = -1; while (TRUE) { + gpointer _tmp2_ = NULL; DbusmenuMenuitem* item; - if (!gee_iterator_next (_item_it)) { + _item_index = _item_index + 1; + if (!(_item_index < _item_size)) { break; } - item = (DbusmenuMenuitem*) ((PlayerItem*) gee_iterator_get (_item_it)); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); + item = (DbusmenuMenuitem*) ((PlayerItem*) _tmp2_); dbusmenu_menuitem_child_delete (self->priv->root_menu, item); _g_object_unref0 (item); } - _g_object_unref0 (_item_it); + _g_object_unref0 (_item_list); } } void player_controller_hibernate (PlayerController* self) { - PlayerItem* _tmp0_; - GeeHashSet* _tmp1_; - PlayerItem* _tmp2_; + gpointer _tmp0_ = NULL; + PlayerItem* _tmp1_; + GeeHashSet* _tmp2_ = NULL; GeeHashSet* _tmp3_; - PlayerItem* _tmp4_; + gpointer _tmp4_ = NULL; + PlayerItem* _tmp5_; + GeeHashSet* _tmp6_ = NULL; + GeeHashSet* _tmp7_; + gpointer _tmp8_ = NULL; + PlayerItem* _tmp9_; TitleMenuitem* title; g_return_if_fail (self != NULL); player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE); - player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), _tmp1_ = transport_menuitem_attributes_format ()); - _g_object_unref0 (_tmp1_); - _g_object_unref0 (_tmp0_); - player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp3_ = metadata_menuitem_attributes_format ()); + _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp1_ = (PlayerItem*) _tmp0_; + _tmp2_ = transport_menuitem_attributes_format (); + _tmp3_ = _tmp2_; + player_item_reset (_tmp1_, _tmp3_); _g_object_unref0 (_tmp3_); - _g_object_unref0 (_tmp2_); - title = (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE), IS_TITLE_MENUITEM (_tmp4_) ? ((TitleMenuitem*) _tmp4_) : NULL); + _g_object_unref0 (_tmp1_); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp5_ = (PlayerItem*) _tmp4_; + _tmp6_ = metadata_menuitem_attributes_format (); + _tmp7_ = _tmp6_; + player_item_reset (_tmp5_, _tmp7_); + _g_object_unref0 (_tmp7_); + _g_object_unref0 (_tmp5_); + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE); + title = (_tmp9_ = (PlayerItem*) _tmp8_, IS_TITLE_MENUITEM (_tmp9_) ? ((TitleMenuitem*) _tmp9_) : NULL); title_menuitem_toggle_active_triangle (title, FALSE); _g_object_unref0 (title); } void player_controller_update_layout (PlayerController* self) { - PlayerItem* _tmp2_; - PlayerItem* _tmp3_; - GeeHashSet* _tmp4_; + gpointer _tmp4_ = NULL; PlayerItem* _tmp5_; + gpointer _tmp6_ = NULL; + PlayerItem* _tmp7_; + GeeHashSet* _tmp8_ = NULL; + GeeHashSet* _tmp9_; + gboolean _tmp10_; + gpointer _tmp11_ = NULL; + PlayerItem* _tmp12_; g_return_if_fail (self != NULL); if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { - PlayerItem* _tmp0_; + gpointer _tmp0_ = NULL; PlayerItem* _tmp1_; - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - _g_object_unref0 (_tmp0_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + gpointer _tmp2_ = NULL; + PlayerItem* _tmp3_; + _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp1_ = (PlayerItem*) _tmp0_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp1_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); _g_object_unref0 (_tmp1_); + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp3_ = (PlayerItem*) _tmp2_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp3_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + _g_object_unref0 (_tmp3_); return; } - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ())); - _g_object_unref0 (_tmp4_); - _g_object_unref0 (_tmp3_); - _g_object_unref0 (_tmp2_); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp5_ = (PlayerItem*) _tmp4_; + _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp7_ = (PlayerItem*) _tmp6_; + _tmp8_ = metadata_menuitem_attributes_format (); + _tmp9_ = _tmp8_; + _tmp10_ = player_item_populated (_tmp7_, _tmp9_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp5_, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp10_); + _g_object_unref0 (_tmp9_); + _g_object_unref0 (_tmp7_); _g_object_unref0 (_tmp5_); + _tmp11_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp12_ = (PlayerItem*) _tmp11_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp12_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _g_object_unref0 (_tmp12_); } static void player_controller_construct_widgets (PlayerController* self) { - PlayerItem* _tmp0_; + PlayerItem* _tmp0_ = NULL; + PlayerItem* _tmp1_; + TitleMenuitem* _tmp2_ = NULL; TitleMenuitem* title_menu_item; + MetadataMenuitem* _tmp3_ = NULL; MetadataMenuitem* metadata_item; + TransportMenuitem* _tmp4_ = NULL; TransportMenuitem* transport_item; g_return_if_fail (self != NULL); - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR)); - _g_object_unref0 (_tmp0_); - title_menu_item = title_menuitem_new (self); + _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR); + _tmp1_ = _tmp0_; + gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp1_); + _g_object_unref0 (_tmp1_); + _tmp2_ = title_menuitem_new (self); + title_menu_item = _tmp2_; gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) title_menu_item); - metadata_item = metadata_menuitem_new (); + _tmp3_ = metadata_menuitem_new (); + metadata_item = _tmp3_; gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) metadata_item); - transport_item = transport_menuitem_new (self); + _tmp4_ = transport_menuitem_new (self); + transport_item = _tmp4_; gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); { - GeeIterator* _item_it; - _item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items); + GeeArrayList* _tmp5_; + GeeArrayList* _item_list; + gint _tmp6_; + gint _item_size; + gint _item_index; + _tmp5_ = _g_object_ref0 (self->custom_items); + _item_list = _tmp5_; + _tmp6_ = gee_collection_get_size ((GeeCollection*) _item_list); + _item_size = _tmp6_; + _item_index = -1; while (TRUE) { + gpointer _tmp7_ = NULL; PlayerItem* item; - if (!gee_iterator_next (_item_it)) { + gint _tmp8_; + _item_index = _item_index + 1; + if (!(_item_index < _item_size)) { break; } - item = (PlayerItem*) gee_iterator_get (_item_it); - dbusmenu_menuitem_child_add_position (self->priv->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item))); + _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); + item = (PlayerItem*) _tmp7_; + _tmp8_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); + dbusmenu_menuitem_child_add_position (self->priv->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + _tmp8_)); _g_object_unref0 (item); } - _g_object_unref0 (_item_it); + _g_object_unref0 (_item_list); } _g_object_unref0 (transport_item); _g_object_unref0 (metadata_item); @@ -424,33 +505,40 @@ static void player_controller_construct_widgets (PlayerController* self) { } -static char* string_strip (const char* self) { - char* result = NULL; - char* _result_; +static gchar* string_strip (const gchar* self) { + gchar* result = NULL; + gchar* _tmp0_ = NULL; + gchar* _result_; g_return_val_if_fail (self != NULL, NULL); - _result_ = g_strdup (self); + _tmp0_ = g_strdup (self); + _result_ = _tmp0_; g_strstrip (_result_); result = _result_; return result; } -static glong string_get_length (const char* self) { - glong result; - g_return_val_if_fail (self != NULL, 0L); - result = g_utf8_strlen (self, (gssize) (-1)); +static const gchar* string_offset (const gchar* self, glong offset) { + const gchar* result = NULL; + g_return_val_if_fail (self != NULL, NULL); + result = (const gchar*) (((gchar*) self) + offset); return result; } -static char* string_slice (const char* self, glong start, glong end) { - char* result = NULL; +static gchar* string_slice (const gchar* self, glong start, glong end) { + gchar* result = NULL; + glong _tmp0_; glong string_length; - gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; - const char* start_string; + gboolean _tmp2_ = FALSE; + const gchar* _tmp3_ = NULL; + const gchar* start_string; + const gchar* _tmp4_ = NULL; + gchar* _tmp5_ = NULL; g_return_val_if_fail (self != NULL, NULL); - string_length = string_get_length (self); + _tmp0_ = strlen (self); + string_length = _tmp0_; if (start < 0) { start = string_length + start; } @@ -458,48 +546,79 @@ static char* string_slice (const char* self, glong start, glong end) { end = string_length + end; } if (start >= 0) { - _tmp0_ = start <= string_length; + _tmp1_ = start <= string_length; } else { - _tmp0_ = FALSE; + _tmp1_ = FALSE; } - g_return_val_if_fail (_tmp0_, NULL); + g_return_val_if_fail (_tmp1_, NULL); if (end >= 0) { - _tmp1_ = end <= string_length; + _tmp2_ = end <= string_length; } else { - _tmp1_ = FALSE; + _tmp2_ = FALSE; } - g_return_val_if_fail (_tmp1_, NULL); + g_return_val_if_fail (_tmp2_, NULL); g_return_val_if_fail (start <= end, NULL); - start_string = g_utf8_offset_to_pointer (self, start); - result = g_strndup (start_string, ((gchar*) g_utf8_offset_to_pointer (start_string, end - start)) - ((gchar*) start_string)); + _tmp3_ = string_offset (self, start); + start_string = _tmp3_; + _tmp4_ = string_offset (start_string, end - start); + _tmp5_ = g_strndup (start_string, ((gchar*) _tmp4_) - ((gchar*) start_string)); + result = _tmp5_; return result; } -static char* player_controller_format_player_name (char* app_info_name) { - char* result = NULL; - char* _tmp0_; - char* _tmp1_; - char* _result_; +static gchar* player_controller_format_player_name (gchar* app_info_name) { + gchar* result = NULL; + gchar* _tmp0_ = NULL; + gchar* _tmp1_; + gchar* _tmp2_ = NULL; + gchar* _tmp3_; + gchar* _result_; + gchar** _tmp4_; + gchar** _tmp5_ = NULL; gint tokens_length1; gint _tokens_size_; - char** _tmp3_; - char** _tmp2_; - char** tokens; + gchar** _tmp6_; + gchar** tokens; + glong _tmp9_; g_return_val_if_fail (app_info_name != NULL, NULL); - _result_ = (_tmp1_ = string_strip (_tmp0_ = g_utf8_strdown (app_info_name, -1)), _g_free0 (_tmp0_), _tmp1_); - tokens = (_tmp3_ = _tmp2_ = g_strsplit (_result_, " ", 0), tokens_length1 = _vala_array_length (_tmp2_), _tokens_size_ = tokens_length1, _tmp3_); + _tmp0_ = g_utf8_strdown (app_info_name, (gssize) (-1)); + _tmp1_ = _tmp0_; + _tmp2_ = string_strip (_tmp1_); + _result_ = (_tmp3_ = _tmp2_, _g_free0 (_tmp1_), _tmp3_); + _tmp5_ = _tmp4_ = g_strsplit (_result_, " ", 0); + _tmp6_ = _tmp5_; + tokens_length1 = _vala_array_length (_tmp4_); + _tokens_size_ = tokens_length1; + tokens = _tmp6_; if (tokens_length1 > 1) { - char* _tmp4_; - _result_ = (_tmp4_ = g_strdup (tokens[0]), _g_free0 (_result_), _tmp4_); + gchar* _tmp7_; + gchar* _tmp8_; + _tmp7_ = g_strdup (tokens[0]); + _tmp8_ = _tmp7_; + _g_free0 (_result_); + _result_ = _tmp8_; } - if (string_get_length (_result_) > 1) { - char* _tmp5_; - char* _tmp6_; - char* _tmp7_; - _result_ = (_tmp7_ = g_strconcat (_tmp5_ = g_utf8_strup (_result_, (gssize) 1), _tmp6_ = string_slice (_result_, (glong) 1, string_get_length (_result_)), NULL), _g_free0 (_result_), _tmp7_); - _g_free0 (_tmp6_); - _g_free0 (_tmp5_); + _tmp9_ = strlen (_result_); + if (_tmp9_ > 1) { + gchar* _tmp10_ = NULL; + gchar* _tmp11_; + glong _tmp12_; + gchar* _tmp13_ = NULL; + gchar* _tmp14_; + gchar* _tmp15_ = NULL; + gchar* _tmp16_; + _tmp10_ = g_utf8_strup (_result_, (gssize) 1); + _tmp11_ = _tmp10_; + _tmp12_ = strlen (_result_); + _tmp13_ = string_slice (_result_, (glong) 1, _tmp12_); + _tmp14_ = _tmp13_; + _tmp15_ = g_strconcat (_tmp11_, _tmp14_, NULL); + _tmp16_ = _tmp15_; + _g_free0 (_result_); + _result_ = _tmp16_; + _g_free0 (_tmp14_); + _g_free0 (_tmp11_); g_debug ("player-controller.vala:176: PlayerController->format_player_name - : %" \ "s", _result_); } @@ -511,12 +630,16 @@ static char* player_controller_format_player_name (char* app_info_name) { void player_controller_determine_state (PlayerController* self) { + gboolean _tmp0_; g_return_if_fail (self != NULL); - if (mpris2_controller_connected (self->mpris_bridge) == TRUE) { - PlayerItem* _tmp0_; + _tmp0_ = mpris2_controller_connected (self->mpris_bridge); + if (_tmp0_ == TRUE) { + gpointer _tmp1_ = NULL; + PlayerItem* _tmp2_; TitleMenuitem* title; player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); - title = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE), IS_TITLE_MENUITEM (_tmp0_) ? ((TitleMenuitem*) _tmp0_) : NULL); + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TITLE); + title = (_tmp2_ = (PlayerItem*) _tmp1_, IS_TITLE_MENUITEM (_tmp2_) ? ((TitleMenuitem*) _tmp2_) : NULL); title_menuitem_toggle_active_triangle (title, TRUE); mpris2_controller_initial_update (self->mpris_bridge); _g_object_unref0 (title); @@ -526,34 +649,42 @@ void player_controller_determine_state (PlayerController* self) { } -const char* player_controller_get_name (PlayerController* self) { - const char* result; +const gchar* player_controller_get_name (PlayerController* self) { + const gchar* result; g_return_val_if_fail (self != NULL, NULL); result = self->priv->_name; return result; } -void player_controller_set_name (PlayerController* self, const char* value) { - char* _tmp0_; +void player_controller_set_name (PlayerController* self, const gchar* value) { + gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - self->priv->_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_name), _tmp0_); + _tmp0_ = g_strdup (value); + _tmp1_ = _tmp0_; + _g_free0 (self->priv->_name); + self->priv->_name = _tmp1_; g_object_notify ((GObject *) self, "name"); } -const char* player_controller_get_mpris_name (PlayerController* self) { - const char* result; +const gchar* player_controller_get_mpris_name (PlayerController* self) { + const gchar* result; g_return_val_if_fail (self != NULL, NULL); result = self->priv->_mpris_name; return result; } -void player_controller_set_mpris_name (PlayerController* self, const char* value) { - char* _tmp0_; +void player_controller_set_mpris_name (PlayerController* self, const gchar* value) { + gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - self->priv->_mpris_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_mpris_name), _tmp0_); + _tmp0_ = g_strdup (value); + _tmp1_ = _tmp0_; + _g_free0 (self->priv->_mpris_name); + self->priv->_mpris_name = _tmp1_; g_object_notify ((GObject *) self, "mpris-name"); } @@ -568,8 +699,12 @@ GAppInfo* player_controller_get_app_info (PlayerController* self) { void player_controller_set_app_info (PlayerController* self, GAppInfo* value) { GAppInfo* _tmp0_; + GAppInfo* _tmp1_; g_return_if_fail (self != NULL); - self->priv->_app_info = (_tmp0_ = _g_object_ref0 (value), _g_object_unref0 (self->priv->_app_info), _tmp0_); + _tmp0_ = _g_object_ref0 (value); + _tmp1_ = _tmp0_; + _g_object_unref0 (self->priv->_app_info); + self->priv->_app_info = _tmp1_; g_object_notify ((GObject *) self, "app-info"); } @@ -589,18 +724,22 @@ void player_controller_set_menu_offset (PlayerController* self, gint value) { } -const char* player_controller_get_icon_name (PlayerController* self) { - const char* result; +const gchar* player_controller_get_icon_name (PlayerController* self) { + const gchar* result; g_return_val_if_fail (self != NULL, NULL); result = self->priv->_icon_name; return result; } -void player_controller_set_icon_name (PlayerController* self, const char* value) { - char* _tmp0_; +void player_controller_set_icon_name (PlayerController* self, const gchar* value) { + gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - self->priv->_icon_name = (_tmp0_ = g_strdup (value), _g_free0 (self->priv->_icon_name), _tmp0_); + _tmp0_ = g_strdup (value); + _tmp1_ = _tmp0_; + _g_free0 (self->priv->_icon_name); + self->priv->_icon_name = _tmp1_; g_object_notify ((GObject *) self, "icon-name"); } @@ -608,8 +747,8 @@ void player_controller_set_icon_name (PlayerController* self, const char* value) static void player_controller_class_init (PlayerControllerClass * klass) { player_controller_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (PlayerControllerPrivate)); - G_OBJECT_CLASS (klass)->get_property = player_controller_get_property; - G_OBJECT_CLASS (klass)->set_property = player_controller_set_property; + G_OBJECT_CLASS (klass)->get_property = _vala_player_controller_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_player_controller_set_property; G_OBJECT_CLASS (klass)->finalize = player_controller_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MPRIS_NAME, g_param_spec_string ("mpris-name", "mpris-name", "mpris-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); @@ -651,7 +790,7 @@ GType player_controller_get_type (void) { } -static void player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { +static void _vala_player_controller_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { PlayerController * self; self = PLAYER_CONTROLLER (object); switch (property_id) { @@ -677,7 +816,7 @@ static void player_controller_get_property (GObject * object, guint property_id, } -static void player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { +static void _vala_player_controller_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { PlayerController * self; self = PLAYER_CONTROLLER (object); switch (property_id) { @@ -734,4 +873,3 @@ static gint _vala_array_length (gpointer array) { - |