Ejemplo n.º 1
0
void
unity_bookmarks_handler_initialize ()
{
	unity_quicklist_handler = unity_quicklist_handler_get_singleton ();
	// get the singleton
	bookmarks = nemo_bookmark_list_new ();
	unity_bookmarks_handler_refresh_bookmarks ();

    /* Recreate dynamic part of menu if bookmark list changes */
	g_signal_connect (bookmarks, "changed",
						G_CALLBACK (unity_bookmarks_handler_refresh_bookmarks), 0);
}
Ejemplo n.º 2
0
static void
update_bookmarks (NemoWindow *window)
{
        NemoBookmarkList *bookmarks;
	NemoBookmark *bookmark;
	guint bookmark_count;
	guint index;
	GtkUIManager *ui_manager;

	g_assert (NEMO_IS_WINDOW (window));
	g_assert (window->details->bookmarks_merge_id == 0);
	g_assert (window->details->bookmarks_action_group == NULL);

	if (window->details->bookmark_list == NULL) {
		window->details->bookmark_list = nemo_bookmark_list_new ();
	}

	bookmarks = window->details->bookmark_list;

	ui_manager = nemo_window_get_ui_manager (NEMO_WINDOW (window));
	
	window->details->bookmarks_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
	window->details->bookmarks_action_group = gtk_action_group_new ("BookmarksGroup");
	g_signal_connect (window->details->bookmarks_action_group, "connect-proxy",
			  G_CALLBACK (connect_proxy_cb), NULL);

	gtk_ui_manager_insert_action_group (ui_manager,
					    window->details->bookmarks_action_group,
					    -1);
	g_object_unref (window->details->bookmarks_action_group);

	/* append new set of bookmarks */
	bookmark_count = nemo_bookmark_list_length (bookmarks);
	for (index = 0; index < bookmark_count; ++index) {
		bookmark = nemo_bookmark_list_item_at (bookmarks, index);

		if (!nemo_bookmark_get_exists (bookmark)) {
			continue;
		}

		nemo_menus_append_bookmark_to_menu
			(NEMO_WINDOW (window),
			 bookmark,
			 MENU_PATH_BOOKMARKS_PLACEHOLDER,
			 "dynamic",
			 index,
			 window->details->bookmarks_action_group,
			 window->details->bookmarks_merge_id,
			 G_CALLBACK (refresh_bookmarks_menu), 
			 show_bogus_bookmark_window);
	}
}