/* Passes the event signal on through the client. */ static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) { DbusmenuClientMenuitemPrivate * priv = DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(mi); dbusmenu_client_send_event(priv->client, dbusmenu_menuitem_get_id(mi), name, variant, timestamp, mi); return; }
/* Passes the about to show signal on through the client. */ static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data) { DbusmenuClientMenuitemPrivate * priv = DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(mi); if (cb == NULL) { /* Common enough that we don't want to bother with the allocation */ dbusmenu_client_send_about_to_show(priv->client, dbusmenu_menuitem_get_id(mi), NULL, NULL); } else { about_to_show_t * data = g_new0(about_to_show_t, 1); data->mi = mi; data->cb = cb; data->cb_data = cb_data; g_object_ref(mi); dbusmenu_client_send_about_to_show(priv->client, dbusmenu_menuitem_get_id(mi), about_to_show_cb, data); } return; }
static void ____lambda3_ (Block2Data* _data2_) { PlaylistsMenuitem * self; DbusmenuMenuitem* _tmp0_; gint _tmp1_; gint _tmp2_; self = _data2_->self; _tmp0_ = _data2_->menuitem; _tmp1_ = dbusmenu_menuitem_get_id (_tmp0_); _tmp2_ = _tmp1_; playlists_menuitem_submenu_item_activated (self, _tmp2_); }
/* Main, is well, main. It brings everything up and throws us into the mainloop of no return. */ int main (int argc, char ** argv) { g_type_init(); /* Setting up i18n and gettext. Apparently, we need all of these. */ setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); textdomain (GETTEXT_PACKAGE); IndicatorService * service = indicator_service_new_version(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_VERSION); g_signal_connect(G_OBJECT(service), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, G_CALLBACK(service_shutdown), NULL); session_dbus = session_dbus_new(); g_idle_add(lock_screen_setup, NULL); root_menuitem = dbusmenu_menuitem_new(); g_debug("Root ID: %d", dbusmenu_menuitem_get_id(root_menuitem)); dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); rebuild_items (root_menuitem, dbus_interface); g_signal_connect (G_OBJECT (dbus_interface), "user-added", G_CALLBACK (user_change), root_menuitem); g_signal_connect (G_OBJECT (dbus_interface), "user-removed", G_CALLBACK (user_change), root_menuitem); setup_restart_watch(); setup_up(); DbusmenuServer * server = dbusmenu_server_new(INDICATOR_SESSION_DBUS_OBJECT); dbusmenu_server_set_root(server, root_menuitem); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); return 0; }
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1) { PlaylistDetails* _tmp0_; gint _tmp0__length1; g_return_if_fail (self != NULL); _tmp0_ = playlists; _tmp0__length1 = playlists_length1; { PlaylistDetails* detail_collection = NULL; gint detail_collection_length1 = 0; gint _detail_collection_size_ = 0; gint detail_it = 0; detail_collection = _tmp0_; detail_collection_length1 = _tmp0__length1; for (detail_it = 0; detail_it < _tmp0__length1; detail_it = detail_it + 1) { PlaylistDetails _tmp1_ = {0}; PlaylistDetails detail = {0}; playlist_details_copy (&detail_collection[detail_it], &_tmp1_); detail = _tmp1_; { Block2Data* _data2_; gboolean _tmp2_ = FALSE; PlaylistDetails _tmp3_; gboolean _tmp4_ = FALSE; gboolean _tmp7_; DbusmenuMenuitem* _tmp8_; DbusmenuMenuitem* _tmp9_; PlaylistDetails _tmp10_; const gchar* _tmp11_; gchar* _tmp12_ = NULL; gchar* _tmp13_; DbusmenuMenuitem* _tmp14_; DbusmenuMenuitem* _tmp15_; PlaylistDetails _tmp16_; const char* _tmp17_; DbusmenuMenuitem* _tmp18_; DbusmenuMenuitem* _tmp19_; DbusmenuMenuitem* _tmp20_; GeeHashMap* _tmp21_; DbusmenuMenuitem* _tmp22_; gint _tmp23_; gint _tmp24_; DbusmenuMenuitem* _tmp25_; DbusmenuMenuitem* _tmp26_; DbusmenuMenuitem* _tmp27_; PlaylistDetails _tmp28_; const gchar* _tmp29_; _data2_ = g_slice_new0 (Block2Data); _data2_->_ref_count_ = 1; _data2_->self = g_object_ref (self); _tmp3_ = detail; _tmp4_ = playlists_menuitem_already_observed (self, &_tmp3_); if (_tmp4_) { _tmp2_ = TRUE; } else { PlaylistDetails _tmp5_; gboolean _tmp6_ = FALSE; _tmp5_ = detail; _tmp6_ = playlists_menuitem_is_video_related (self, &_tmp5_); _tmp2_ = _tmp6_; } _tmp7_ = _tmp2_; if (_tmp7_) { playlist_details_destroy (&detail); block2_data_unref (_data2_); _data2_ = NULL; continue; } _tmp8_ = dbusmenu_menuitem_new (); _data2_->menuitem = _tmp8_; _tmp9_ = _data2_->menuitem; _tmp10_ = detail; _tmp11_ = _tmp10_.name; _tmp12_ = playlists_menuitem_truncate_item_label_if_needs_be (self, _tmp11_); _tmp13_ = _tmp12_; dbusmenu_menuitem_property_set (_tmp9_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp13_); _g_free0 (_tmp13_); _tmp14_ = _data2_->menuitem; dbusmenu_menuitem_property_set (_tmp14_, DBUSMENU_MENUITEM_PROP_ICON_NAME, "playlist-symbolic"); _tmp15_ = _data2_->menuitem; _tmp16_ = detail; _tmp17_ = _tmp16_.path; dbusmenu_menuitem_property_set (_tmp15_, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) _tmp17_); _tmp18_ = _data2_->menuitem; dbusmenu_menuitem_property_set_bool (_tmp18_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); _tmp19_ = _data2_->menuitem; dbusmenu_menuitem_property_set_bool (_tmp19_, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE); _tmp20_ = _data2_->menuitem; g_signal_connect_data (_tmp20_, "item-activated", (GCallback) _____lambda3__dbusmenu_menuitem_item_activated, block2_data_ref (_data2_), (GClosureNotify) block2_data_unref, 0); _tmp21_ = self->priv->current_playlists; _tmp22_ = _data2_->menuitem; _tmp23_ = dbusmenu_menuitem_get_id (_tmp22_); _tmp24_ = _tmp23_; _tmp25_ = _data2_->menuitem; gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, GINT_TO_POINTER (_tmp24_), _tmp25_); _tmp26_ = self->root_item; _tmp27_ = _data2_->menuitem; dbusmenu_menuitem_child_append (_tmp26_, _tmp27_); _tmp28_ = detail; _tmp29_ = _tmp28_.name; g_debug ("playlists-menu-item.vala:66: populating valid playlists %s", _tmp29_); playlist_details_destroy (&detail); block2_data_unref (_data2_); _data2_ = NULL; } } } { GeeHashMap* _tmp30_; GeeCollection* _tmp31_; GeeCollection* _tmp32_; GeeCollection* _tmp33_; GeeIterator* _tmp34_ = NULL; GeeIterator* _tmp35_; GeeIterator* _item_it; _tmp30_ = self->priv->current_playlists; _tmp31_ = gee_abstract_map_get_values ((GeeMap*) _tmp30_); _tmp32_ = _tmp31_; _tmp33_ = _tmp32_; _tmp34_ = gee_iterable_iterator ((GeeIterable*) _tmp33_); _tmp35_ = _tmp34_; _g_object_unref0 (_tmp33_); _item_it = _tmp35_; while (TRUE) { GeeIterator* _tmp36_; gboolean _tmp37_ = FALSE; GeeIterator* _tmp38_; gpointer _tmp39_ = NULL; DbusmenuMenuitem* item; gboolean within; PlaylistDetails* _tmp40_; gint _tmp40__length1; gboolean _tmp46_; _tmp36_ = _item_it; _tmp37_ = gee_iterator_next (_tmp36_); if (!_tmp37_) { break; } _tmp38_ = _item_it; _tmp39_ = gee_iterator_get (_tmp38_); item = (DbusmenuMenuitem*) _tmp39_; within = FALSE; _tmp40_ = playlists; _tmp40__length1 = playlists_length1; { PlaylistDetails* detail_collection = NULL; gint detail_collection_length1 = 0; gint _detail_collection_size_ = 0; gint detail_it = 0; detail_collection = _tmp40_; detail_collection_length1 = _tmp40__length1; for (detail_it = 0; detail_it < _tmp40__length1; detail_it = detail_it + 1) { PlaylistDetails _tmp41_ = {0}; PlaylistDetails detail = {0}; playlist_details_copy (&detail_collection[detail_it], &_tmp41_); detail = _tmp41_; { PlaylistDetails _tmp42_; const char* _tmp43_; DbusmenuMenuitem* _tmp44_; const gchar* _tmp45_ = NULL; _tmp42_ = detail; _tmp43_ = _tmp42_.path; _tmp44_ = item; _tmp45_ = dbusmenu_menuitem_property_get (_tmp44_, DBUSMENU_PLAYLIST_MENUITEM_PATH); if (g_strcmp0 (_tmp43_, _tmp45_) == 0) { within = TRUE; playlist_details_destroy (&detail); break; } playlist_details_destroy (&detail); } } } _tmp46_ = within; if (_tmp46_ == FALSE) { DbusmenuMenuitem* _tmp47_; const gchar* _tmp48_ = NULL; DbusmenuMenuitem* _tmp49_; const gchar* _tmp50_ = NULL; DbusmenuMenuitem* _tmp53_; DbusmenuMenuitem* _tmp54_; _tmp47_ = self->root_item; _tmp48_ = dbusmenu_menuitem_property_get (_tmp47_, DBUSMENU_PLAYLIST_MENUITEM_PATH); _tmp49_ = item; _tmp50_ = dbusmenu_menuitem_property_get (_tmp49_, DBUSMENU_PLAYLIST_MENUITEM_PATH); if (g_strcmp0 (_tmp48_, _tmp50_) == 0) { DbusmenuMenuitem* _tmp51_; const gchar* _tmp52_ = NULL; _tmp51_ = self->root_item; _tmp52_ = _ ("Choose Playlist"); dbusmenu_menuitem_property_set (_tmp51_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp52_); } _tmp53_ = self->root_item; _tmp54_ = item; dbusmenu_menuitem_child_delete (_tmp53_, _tmp54_); } _g_object_unref0 (item); } _g_object_unref0 (_item_it); } }