diff options
Diffstat (limited to 'src/specific-items-manager.c')
-rw-r--r-- | src/specific-items-manager.c | 315 |
1 files changed, 216 insertions, 99 deletions
diff --git a/src/specific-items-manager.c b/src/specific-items-manager.c index b01e8c1..f39e43d 100644 --- a/src/specific-items-manager.c +++ b/src/specific-items-manager.c @@ -1,4 +1,4 @@ -/* specific-items-manager.c generated by valac 0.12.1, the Vala compiler +/* specific-items-manager.c generated by valac 0.14.0, the Vala compiler * generated from specific-items-manager.vala, do not modify */ /* @@ -134,18 +134,19 @@ static void specific_items_manager_set_owner (SpecificItemsManager* self, Player static PlayerController* specific_items_manager_get_owner (SpecificItemsManager* self); const gchar* player_controller_get_dbus_name (PlayerController* self); static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot); -static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* newroot, gpointer self); +static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self); static gint specific_items_manager_figure_out_positioning (SpecificItemsManager* self); gint player_controller_get_menu_offset (PlayerController* self); +#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4 GeeArrayList* specific_items_manager_get_proxy_items (SpecificItemsManager* self); gint player_controller_track_specific_count (PlayerController* self); GType player_item_get_type (void) G_GNUC_CONST; GType mpris2_controller_get_type (void) G_GNUC_CONST; static gboolean _bool_equal (const gboolean* s1, const gboolean* s2); static void specific_items_manager_on_child_added (SpecificItemsManager* self, GObject* child, guint position); -static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* child, guint position, gpointer self); +static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self); static void specific_items_manager_on_child_removed (SpecificItemsManager* self, GObject* child); -static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* child, gpointer self); +static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self); static void specific_items_manager_set_proxy_items (SpecificItemsManager* self, GeeArrayList* value); static GObject * specific_items_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void specific_items_manager_finalize (GObject* obj); @@ -165,29 +166,43 @@ GType specific_items_manager_category_get_type (void) { } -static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* newroot, gpointer self) { - specific_items_manager_on_root_changed (self, newroot); +static void _specific_items_manager_on_root_changed_dbusmenu_client_root_changed (DbusmenuClient* _sender, GObject* object, gpointer self) { + specific_items_manager_on_root_changed (self, object); } SpecificItemsManager* specific_items_manager_construct (GType object_type, PlayerController* controller, const gchar* path, SpecificItemsManagercategory which_type) { SpecificItemsManager * self = NULL; - gchar* _tmp0_; - const gchar* _tmp1_ = NULL; - DbusmenuClient* _tmp2_ = NULL; + SpecificItemsManagercategory _tmp0_; + PlayerController* _tmp1_; + const gchar* _tmp2_; + gchar* _tmp3_; + PlayerController* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + const gchar* _tmp7_; + DbusmenuClient* _tmp8_; + DbusmenuClient* _tmp9_; g_return_val_if_fail (controller != NULL, NULL); g_return_val_if_fail (path != NULL, NULL); self = (SpecificItemsManager*) g_object_new (object_type, NULL); - self->priv->of_type = (gint) which_type; - specific_items_manager_set_owner (self, controller); - _tmp0_ = g_strdup (path); + _tmp0_ = which_type; + self->priv->of_type = (gint) _tmp0_; + _tmp1_ = controller; + specific_items_manager_set_owner (self, _tmp1_); + _tmp2_ = path; + _tmp3_ = g_strdup (_tmp2_); _g_free0 (self->priv->dbus_path); - self->priv->dbus_path = _tmp0_; - _tmp1_ = player_controller_get_dbus_name (self->priv->_owner); - _tmp2_ = dbusmenu_client_new (_tmp1_, self->priv->dbus_path); + self->priv->dbus_path = _tmp3_; + _tmp4_ = self->priv->_owner; + _tmp5_ = player_controller_get_dbus_name (_tmp4_); + _tmp6_ = _tmp5_; + _tmp7_ = self->priv->dbus_path; + _tmp8_ = dbusmenu_client_new (_tmp6_, _tmp7_); _g_object_unref0 (self->priv->client); - self->priv->client = _tmp2_; - g_signal_connect_object (self->priv->client, "root-changed", (GCallback) _specific_items_manager_on_root_changed_dbusmenu_client_root_changed, self, 0); + self->priv->client = _tmp8_; + _tmp9_ = self->priv->client; + g_signal_connect_object (_tmp9_, "root-changed", (GCallback) _specific_items_manager_on_root_changed_dbusmenu_client_root_changed, self, 0); return self; } @@ -214,35 +229,71 @@ static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) { static gint specific_items_manager_figure_out_positioning (SpecificItemsManager* self) { gint result = 0; gint _result_; + gint _tmp0_; + gint _tmp22_; + gint _tmp23_; g_return_val_if_fail (self != NULL, 0); _result_ = 0; - if (self->priv->of_type == SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK) { - gint _tmp0_; - gint _tmp1_; - _tmp0_ = player_controller_get_menu_offset (self->priv->_owner); - _tmp1_ = gee_collection_get_size ((GeeCollection*) self->priv->_proxy_items); - _result_ = (_tmp0_ + 4) + _tmp1_; + _tmp0_ = self->priv->of_type; + if (_tmp0_ == ((gint) SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK)) { + PlayerController* _tmp1_; + gint _tmp2_; + gint _tmp3_; + PlayerController* _tmp4_; + GeeArrayList* _tmp5_; + gint _tmp6_; + gint _tmp7_; + _tmp1_ = self->priv->_owner; + _tmp2_ = player_controller_get_menu_offset (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = self->priv->_owner; + _tmp5_ = self->priv->_proxy_items; + _tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_); + _tmp7_ = _tmp6_; + _result_ = (_tmp3_ + PLAYER_CONTROLLER_WIDGET_QUANTITY) + _tmp7_; } else { - if (self->priv->of_type == SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER) { - gint _tmp2_; - gint _tmp3_; + gint _tmp8_; + _tmp8_ = self->priv->of_type; + if (_tmp8_ == ((gint) SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER)) { + PlayerController* _tmp9_; + gint _tmp10_; + gint _tmp11_; + PlayerController* _tmp12_; + PlayerController* _tmp13_; + gint _tmp14_ = 0; gint pos; - gint _tmp4_ = 0; - gboolean _tmp5_; - _tmp2_ = player_controller_get_menu_offset (self->priv->_owner); - _tmp3_ = player_controller_track_specific_count (self->priv->_owner); - pos = (_tmp2_ + 4) + _tmp3_; - _tmp5_ = TRUE; - if (_bool_equal (self->priv->_owner->use_playlists, &_tmp5_) == TRUE) { - _tmp4_ = 1; + gint _tmp15_ = 0; + PlayerController* _tmp16_; + gboolean* _tmp17_; + gboolean _tmp18_; + gint _tmp19_; + gint _tmp20_; + gint _tmp21_; + _tmp9_ = self->priv->_owner; + _tmp10_ = player_controller_get_menu_offset (_tmp9_); + _tmp11_ = _tmp10_; + _tmp12_ = self->priv->_owner; + _tmp13_ = self->priv->_owner; + _tmp14_ = player_controller_track_specific_count (_tmp13_); + pos = (_tmp11_ + PLAYER_CONTROLLER_WIDGET_QUANTITY) + _tmp14_; + _tmp16_ = self->priv->_owner; + _tmp17_ = _tmp16_->use_playlists; + _tmp18_ = TRUE; + if (_bool_equal (_tmp17_, &_tmp18_) == TRUE) { + _tmp15_ = 1; } else { - _tmp4_ = 0; + _tmp15_ = 0; } - pos = pos + _tmp4_; - _result_ = pos; + _tmp19_ = pos; + _tmp20_ = _tmp15_; + pos = _tmp19_ + _tmp20_; + _tmp21_ = pos; + _result_ = _tmp21_; } } - g_debug ("specific-items-manager.vala:61: !!!!! Menu pos of type %i is = %i", self->priv->of_type, _result_); + _tmp22_ = self->priv->of_type; + _tmp23_ = _result_; + g_debug ("specific-items-manager.vala:63: !!!!! Menu pos of type %i is = %i", _tmp22_, _tmp23_); result = _result_; return result; } @@ -253,89 +304,147 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* child, guint position, gpointer self) { - specific_items_manager_on_child_added (self, child, position); +static void _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added (DbusmenuMenuitem* _sender, GObject* position, guint p0, gpointer self) { + specific_items_manager_on_child_added (self, position, p0); } -static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* child, gpointer self) { - specific_items_manager_on_child_removed (self, child); +static void _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed (DbusmenuMenuitem* _sender, GObject* object, gpointer self) { + specific_items_manager_on_child_removed (self, object); } static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot) { - DbusmenuMenuitem* _tmp4_ = NULL; - DbusmenuMenuitem* _tmp5_; + GObject* _tmp0_; + DbusmenuClient* _tmp19_; + DbusmenuMenuitem* _tmp20_ = NULL; + DbusmenuMenuitem* _tmp21_; DbusmenuMenuitem* root; - GList* _tmp6_ = NULL; - GList* _tmp7_ = NULL; + DbusmenuMenuitem* _tmp22_; + DbusmenuMenuitem* _tmp23_; + DbusmenuMenuitem* _tmp24_; + GList* _tmp25_ = NULL; + GList* _tmp26_ = NULL; GList* children; + GList* _tmp27_; g_return_if_fail (self != NULL); - if (newroot == NULL) { - gint _tmp3_; - g_debug ("specific-items-manager.vala:68: root disappeared -remove proxyitems"); + _tmp0_ = newroot; + if (_tmp0_ == NULL) { + GeeArrayList* _tmp15_; + GeeArrayList* _tmp16_; + gint _tmp17_; + gint _tmp18_; + g_debug ("specific-items-manager.vala:70: root disappeared -remove proxyitems"); { - GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; + GeeArrayList* _tmp2_; GeeArrayList* _p_list; - gint _tmp1_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; gint _p_size; gint _p_index; - _tmp0_ = _g_object_ref0 (self->priv->_proxy_items); - _p_list = _tmp0_; - _tmp1_ = gee_collection_get_size ((GeeCollection*) _p_list); - _p_size = _tmp1_; + _tmp1_ = self->priv->_proxy_items; + _tmp2_ = _g_object_ref0 (_tmp1_); + _p_list = _tmp2_; + _tmp3_ = _p_list; + _tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + _p_size = _tmp5_; _p_index = -1; while (TRUE) { - gpointer _tmp2_ = NULL; + gint _tmp6_; + gint _tmp7_; + gint _tmp8_; + GeeArrayList* _tmp9_; + gint _tmp10_; + gpointer _tmp11_ = NULL; DbusmenuMenuitemProxy* p; - _p_index = _p_index + 1; - if (!(_p_index < _p_size)) { + PlayerController* _tmp12_; + DbusmenuMenuitem* _tmp13_; + DbusmenuMenuitemProxy* _tmp14_; + _tmp6_ = _p_index; + _p_index = _tmp6_ + 1; + _tmp7_ = _p_index; + _tmp8_ = _p_size; + if (!(_tmp7_ < _tmp8_)) { break; } - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _p_list, _p_index); - p = (DbusmenuMenuitemProxy*) _tmp2_; - dbusmenu_menuitem_child_delete (self->priv->_owner->root_menu, (DbusmenuMenuitem*) p); + _tmp9_ = _p_list; + _tmp10_ = _p_index; + _tmp11_ = gee_abstract_list_get ((GeeAbstractList*) _tmp9_, _tmp10_); + p = (DbusmenuMenuitemProxy*) _tmp11_; + _tmp12_ = self->priv->_owner; + _tmp13_ = _tmp12_->root_menu; + _tmp14_ = p; + dbusmenu_menuitem_child_delete (_tmp13_, (DbusmenuMenuitem*) _tmp14_); _g_object_unref0 (p); } _g_object_unref0 (_p_list); } - gee_abstract_collection_clear ((GeeAbstractCollection*) self->priv->_proxy_items); - _tmp3_ = gee_collection_get_size ((GeeCollection*) self->priv->_proxy_items); - g_debug ("specific-items-manager.vala:73: array list size is now %i", _tmp3_); + _tmp15_ = self->priv->_proxy_items; + gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp15_); + _tmp16_ = self->priv->_proxy_items; + _tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_); + _tmp18_ = _tmp17_; + g_debug ("specific-items-manager.vala:75: array list size is now %i", _tmp18_); return; } - _tmp4_ = dbusmenu_client_get_root (self->priv->client); - _tmp5_ = _g_object_ref0 (_tmp4_); - root = _tmp5_; - g_signal_connect_object (root, "child-added", (GCallback) _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added, self, 0); - g_signal_connect_object (root, "child-removed", (GCallback) _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed, self, 0); - _tmp6_ = dbusmenu_menuitem_get_children (root); - _tmp7_ = g_list_copy (_tmp6_); - children = _tmp7_; + _tmp19_ = self->priv->client; + _tmp20_ = dbusmenu_client_get_root (_tmp19_); + _tmp21_ = _g_object_ref0 (_tmp20_); + root = _tmp21_; + _tmp22_ = root; + g_signal_connect_object (_tmp22_, "child-added", (GCallback) _specific_items_manager_on_child_added_dbusmenu_menuitem_child_added, self, 0); + _tmp23_ = root; + g_signal_connect_object (_tmp23_, "child-removed", (GCallback) _specific_items_manager_on_child_removed_dbusmenu_menuitem_child_removed, self, 0); + _tmp24_ = root; + _tmp25_ = dbusmenu_menuitem_get_children (_tmp24_); + _tmp26_ = g_list_copy (_tmp25_); + children = _tmp26_; + _tmp27_ = children; { - GList* child_collection; - GList* child_it; - child_collection = children; + GList* child_collection = NULL; + GList* child_it = NULL; + child_collection = _tmp27_; for (child_it = child_collection; child_it != NULL; child_it = child_it->next) { - void* child; + void* child = NULL; child = child_it->data; { - gint _tmp8_; + gint _tmp28_ = 0; gint pos; + void* _tmp29_; DbusmenuMenuitem* item; - DbusmenuMenuitemProxy* _tmp9_ = NULL; + DbusmenuMenuitem* _tmp30_; + DbusmenuMenuitemProxy* _tmp31_; DbusmenuMenuitemProxy* proxy; - const gchar* _tmp10_ = NULL; - _tmp8_ = specific_items_manager_figure_out_positioning (self); - pos = _tmp8_; - item = DBUSMENU_MENUITEM (child); - _tmp9_ = dbusmenu_menuitem_proxy_new (item); - proxy = _tmp9_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->_proxy_items, proxy); - _tmp10_ = dbusmenu_menuitem_property_get (item, DBUSMENU_MENUITEM_PROP_LABEL); - g_debug ("specific-items-manager.vala:90: Proxy item of label = %s added to coll" \ -"ection", _tmp10_); - dbusmenu_menuitem_child_add_position (self->priv->_owner->root_menu, (DbusmenuMenuitem*) proxy, (guint) pos); + GeeArrayList* _tmp32_; + DbusmenuMenuitemProxy* _tmp33_; + DbusmenuMenuitem* _tmp34_; + const gchar* _tmp35_ = NULL; + PlayerController* _tmp36_; + DbusmenuMenuitem* _tmp37_; + DbusmenuMenuitemProxy* _tmp38_; + gint _tmp39_; + _tmp28_ = specific_items_manager_figure_out_positioning (self); + pos = _tmp28_; + _tmp29_ = child; + item = DBUSMENU_MENUITEM (_tmp29_); + _tmp30_ = item; + _tmp31_ = dbusmenu_menuitem_proxy_new (_tmp30_); + proxy = _tmp31_; + _tmp32_ = self->priv->_proxy_items; + _tmp33_ = proxy; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp32_, _tmp33_); + _tmp34_ = item; + _tmp35_ = dbusmenu_menuitem_property_get (_tmp34_, DBUSMENU_MENUITEM_PROP_LABEL); + g_debug ("specific-items-manager.vala:92: Proxy item of label = %s added to coll" \ +"ection", _tmp35_); + _tmp36_ = self->priv->_owner; + _tmp37_ = _tmp36_->root_menu; + _tmp38_ = proxy; + _tmp39_ = pos; + dbusmenu_menuitem_child_add_position (_tmp37_, (DbusmenuMenuitem*) _tmp38_, (guint) _tmp39_); _g_object_unref0 (proxy); } } @@ -348,48 +457,56 @@ static void specific_items_manager_on_root_changed (SpecificItemsManager* self, static void specific_items_manager_on_child_added (SpecificItemsManager* self, GObject* child, guint position) { g_return_if_fail (self != NULL); g_return_if_fail (child != NULL); - g_debug ("specific-items-manager.vala:99: On child added Specific root node"); + g_debug ("specific-items-manager.vala:101: On child added Specific root node"); } static void specific_items_manager_on_child_removed (SpecificItemsManager* self, GObject* child) { g_return_if_fail (self != NULL); g_return_if_fail (child != NULL); - g_debug ("specific-items-manager.vala:104: On child removed Specific root node"); + g_debug ("specific-items-manager.vala:106: On child removed Specific root node"); } static PlayerController* specific_items_manager_get_owner (SpecificItemsManager* self) { PlayerController* result; + PlayerController* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_owner; + _tmp0_ = self->priv->_owner; + result = _tmp0_; return result; } static void specific_items_manager_set_owner (SpecificItemsManager* self, PlayerController* value) { PlayerController* _tmp0_; + PlayerController* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_owner); - self->priv->_owner = _tmp0_; + self->priv->_owner = _tmp1_; } GeeArrayList* specific_items_manager_get_proxy_items (SpecificItemsManager* self) { GeeArrayList* result; + GeeArrayList* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_proxy_items; + _tmp0_ = self->priv->_proxy_items; + result = _tmp0_; return result; } static void specific_items_manager_set_proxy_items (SpecificItemsManager* self, GeeArrayList* value) { GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_proxy_items); - self->priv->_proxy_items = _tmp0_; + self->priv->_proxy_items = _tmp1_; g_object_notify ((GObject *) self, "proxy-items"); } @@ -398,12 +515,12 @@ static GObject * specific_items_manager_constructor (GType type, guint n_constru GObject * obj; GObjectClass * parent_class; SpecificItemsManager * self; - GeeArrayList* _tmp0_ = NULL; + GeeArrayList* _tmp0_; GeeArrayList* _tmp1_; parent_class = G_OBJECT_CLASS (specific_items_manager_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = SPECIFIC_ITEMS_MANAGER (obj); - _tmp0_ = gee_array_list_new (DBUSMENU_TYPE_MENUITEM_PROXY, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + _tmp0_ = gee_array_list_new (dbusmenu_menuitem_proxy_get_type (), (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); _tmp1_ = _tmp0_; specific_items_manager_set_proxy_items (self, _tmp1_); _g_object_unref0 (_tmp1_); |