Esempio n. 1
0
/* When the root menuitem changes we need to resetup things so that
   we're back in the game. */
static void
root_changed (DbusmenuGtkClient * client, DbusmenuMenuitem * newroot, DbusmenuGtkMenu * menu) {
	DbusmenuGtkMenuPrivate * priv = DBUSMENU_GTKMENU_GET_PRIVATE(menu);

	/* Clear out our interest in the old root */
	if (priv->root != NULL) {
		GList * children = dbusmenu_menuitem_get_children(priv->root);
		g_list_foreach(children, remove_child_signals, menu);

		g_signal_handlers_disconnect_by_func(G_OBJECT(priv->root), root_child_added, menu);
		g_signal_handlers_disconnect_by_func(G_OBJECT(priv->root), root_child_moved, menu);
		g_signal_handlers_disconnect_by_func(G_OBJECT(priv->root), root_child_delete, menu);

		dbusmenu_menuitem_foreach(priv->root, popdown_all, client);

		g_object_unref(priv->root);
		priv->root = NULL;
	}

	if (newroot == NULL) {
		gtk_widget_hide(GTK_WIDGET(menu));
		return;
	}

	priv->root = newroot;
	g_object_ref(priv->root);

	g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_ADDED,   G_CALLBACK(root_child_added),  menu);
	g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED,   G_CALLBACK(root_child_moved),  menu);
	g_signal_connect(G_OBJECT(newroot), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(root_child_delete), menu);

	GList * child = NULL;
	guint count = 0;
	for (child = dbusmenu_menuitem_get_children(newroot); child != NULL; child = g_list_next(child)) {
		/* gtk_menu_append(menu, GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(client, child->data))); */
		g_signal_connect(G_OBJECT(child->data), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(child_realized), menu);
		count++;
	}

	if (count > 0) {
		gtk_widget_show(GTK_WIDGET(menu));
	} else {
		gtk_widget_hide(GTK_WIDGET(menu));
	}

	return;
}
Esempio n. 2
0
static void
progress_ui_handler_show_unity_quicklist (NemoProgressUIHandler *self,
                                          UnityLauncherEntry *entry,
                                          gboolean show)
{
	g_return_if_fail (self);
	g_return_if_fail (entry);

	DbusmenuMenuitem *ql;
	GList *children, *l;

	ql = unity_launcher_entry_get_quicklist (entry);
	children = dbusmenu_menuitem_get_children (ql);

	for (l = children; l; l = l->next) {
		DbusmenuMenuitem *child = l->data;
		if (unity_quicklist_handler_menuitem_is_progress_item (child))
			dbusmenu_menuitem_property_set_bool(child,
	                                    DBUSMENU_MENUITEM_PROP_VISIBLE, show);
	}
}
Esempio n. 3
0
/* When a root child item disappears. */
static void
root_child_delete (DbusmenuMenuitem * root, DbusmenuMenuitem * child, DbusmenuGtkMenu * menu)
{
	#ifdef MASSIVEDEBUGGING
	g_debug("Root child deleted");
	#endif

	/* Remove signal for realized */
	remove_child_signals(child, menu);

	DbusmenuGtkMenuPrivate * priv = DBUSMENU_GTKMENU_GET_PRIVATE(menu);
	GtkWidget * item = GTK_WIDGET(dbusmenu_gtkclient_menuitem_get(priv->client, child));
	if (item != NULL) {
		gtk_container_remove(GTK_CONTAINER(menu), item);
	}

	if (g_list_length(dbusmenu_menuitem_get_children(root)) == 0) {
		gtk_widget_hide(GTK_WIDGET(menu));
	}
	return;
}
Esempio n. 4
0
static void
unity_bookmarks_handler_remove_bookmark_quicklists () {

	GList *children, *l;

	/* remove unity quicklist bookmarks to launcher entries */
	for (l = unity_quicklist_get_launcher_entries (unity_quicklist_handler); l; l = l->next) {
		UnityLauncherEntry *entry = l->data;
		DbusmenuMenuitem *ql = unity_launcher_entry_get_quicklist (entry);
		if (!ql)
			break;

		children = dbusmenu_menuitem_get_children (ql);
		while (children) {
			DbusmenuMenuitem *child = children->data;
			children = children->next;
			if (unity_quicklist_handler_menuitem_is_bookmark_item (child)) {
				g_signal_handlers_disconnect_matched (child, G_SIGNAL_MATCH_FUNC, 0, 0, 0, (GCallback) activate_bookmark_by_quicklist, 0);
				dbusmenu_menuitem_child_delete (ql, child);
				g_object_unref(child);
			}
		}
	}
}
static void specific_items_manager_on_root_changed (SpecificItemsManager* self, GObject* newroot) {
	GObject* _tmp0_;
	DbusmenuClient* _tmp19_;
	DbusmenuMenuitem* _tmp20_ = NULL;
	DbusmenuMenuitem* _tmp21_;
	DbusmenuMenuitem* root;
	DbusmenuMenuitem* _tmp22_;
	DbusmenuMenuitem* _tmp23_;
	DbusmenuMenuitem* _tmp24_;
	GList* _tmp25_ = NULL;
	GList* _tmp26_ = NULL;
	GList* children;
	GList* _tmp27_;
	g_return_if_fail (self != NULL);
	_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* _tmp1_;
			GeeArrayList* _tmp2_;
			GeeArrayList* _p_list;
			GeeArrayList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			gint _p_size;
			gint _p_index;
			_tmp1_ = self->priv->_proxy_items;
			_tmp2_ = _g_object_ref0 (_tmp1_);
			_p_list = _tmp2_;
			_tmp3_ = _p_list;
			_tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_p_size = _tmp5_;
			_p_index = -1;
			while (TRUE) {
				gint _tmp6_;
				gint _tmp7_;
				gint _tmp8_;
				GeeArrayList* _tmp9_;
				gint _tmp10_;
				gpointer _tmp11_ = NULL;
				DbusmenuMenuitemProxy* p;
				PlayerController* _tmp12_;
				DbusmenuMenuitem* _tmp13_;
				DbusmenuMenuitemProxy* _tmp14_;
				_tmp6_ = _p_index;
				_p_index = _tmp6_ + 1;
				_tmp7_ = _p_index;
				_tmp8_ = _p_size;
				if (!(_tmp7_ < _tmp8_)) {
					break;
				}
				_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);
		}
		_tmp15_ = self->priv->_proxy_items;
		gee_abstract_collection_clear ((GeeAbstractCollection*) _tmp15_);
		_tmp16_ = self->priv->_proxy_items;
		_tmp17_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp16_);
		_tmp18_ = _tmp17_;
		g_debug ("specific-items-manager.vala:75: array list size is now %i", _tmp18_);
		return;
	}
	_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 = NULL;
		GList* child_it = NULL;
		child_collection = _tmp27_;
		for (child_it = child_collection; child_it != NULL; child_it = child_it->next) {
			void* child = NULL;
			child = child_it->data;
			{
				gint _tmp28_ = 0;
				gint pos;
				void* _tmp29_;
				DbusmenuMenuitem* item;
				DbusmenuMenuitem* _tmp30_;
				DbusmenuMenuitemProxy* _tmp31_;
				DbusmenuMenuitemProxy* proxy;
				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);
			}
		}
	}
	_g_list_free0 (children);
	_g_object_unref0 (root);
}