예제 #1
0
파일: callbacks.c 프로젝트: GNOME/gthumb
void
bookmarks__gth_browser_construct_cb (GthBrowser *browser)
{
    BrowserData *data;

    g_return_if_fail (GTH_IS_BROWSER (browser));

    data = g_new0 (BrowserData, 1);
    g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);

    g_action_map_add_action_entries (G_ACTION_MAP (browser),
                                     actions,
                                     G_N_ELEMENTS (actions),
                                     browser);

    {
        GtkWidget  *button;
        GMenuModel *menu;

        button = _gtk_menu_button_new_for_header_bar ("user-bookmarks-symbolic");
        gtk_widget_set_tooltip_text (button, _("Bookmarks"));

        data->builder = gtk_builder_new_from_resource ("/org/gnome/gThumb/bookmarks/data/ui/bookmarks-menu.ui");
        data->system_bookmarks_menu = G_MENU (gtk_builder_get_object (data->builder, "system-bookmarks"));
        data->entry_points_menu = G_MENU (gtk_builder_get_object (data->builder, "entry-points"));
        data->bookmarks_menu = G_MENU (gtk_builder_get_object (data->builder, "bookmarks"));

        menu = G_MENU_MODEL (gtk_builder_get_object (data->builder, "bookmarks-menu"));
        gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
        _gtk_window_add_accelerators_from_menu ((GTK_WINDOW (browser)), menu);

        gtk_widget_show (button);
        gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS)), button, FALSE, FALSE, 0);
    }

    data->browser = browser;
    data->bookmarks_changed_id = g_signal_connect (gth_main_get_default_monitor (),
                                 "bookmarks-changed",
                                 G_CALLBACK (bookmarks_changed_cb),
                                 data);
    data->entry_points_changed_id = g_signal_connect (gth_main_get_default_monitor (),
                                    "entry-points-changed",
                                    G_CALLBACK (entry_points_changed_cb),
                                    data);
}
예제 #2
0
void
export_tools__gth_browser_construct_cb (GthBrowser *browser)
{
	GtkBuilder *builder;
	GMenuModel *menu;
	GtkWidget  *button;

	g_return_if_fail (GTH_IS_BROWSER (browser));

	builder = gtk_builder_new_from_resource ("/org/gnome/gThumb/export_tools/data/ui/export-menu.ui");
	gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_WEB_EXPORTERS, G_MENU (gtk_builder_get_object (builder, "web-exporters")));
	gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_OTHER_EXPORTERS, G_MENU (gtk_builder_get_object (builder, "other-exporters")));
	menu = G_MENU_MODEL (gtk_builder_get_object (builder, "export-menu"));

	button = _gtk_menu_button_new_for_header_bar ();
	gtk_widget_set_tooltip_text (button, _("Export"));
	gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("export-symbolic", GTK_ICON_SIZE_MENU));
	gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
	gtk_widget_show_all (button);
	gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)), button, FALSE, FALSE, 0);
}
예제 #3
0
void
list_tools__gth_browser_construct_cb (GthBrowser *browser)
{
	BrowserData *data;
	GtkBuilder  *builder;
	GMenuModel  *menu;
	GtkWidget   *button;

	g_return_if_fail (GTH_IS_BROWSER (browser));

	data = g_new0 (BrowserData, 1);
	data->browser = browser;
	g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);

	g_action_map_add_action_entries (G_ACTION_MAP (browser),
					 actions,
					 G_N_ELEMENTS (actions),
					 browser);

	builder = gtk_builder_new_from_resource ("/org/gnome/gThumb/list_tools/data/ui/tools-menu.ui");
	gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS, G_MENU (gtk_builder_get_object (builder, "tools1")));
	gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_MORE_TOOLS, G_MENU (gtk_builder_get_object (builder, "tools2")));
	gth_browser_add_menu_manager_for_menu (browser, GTH_BROWSER_MENU_MANAGER_TOOLS3, G_MENU (gtk_builder_get_object (builder, "tools3")));
	menu = G_MENU_MODEL (gtk_builder_get_object (builder, "tools-menu"));

	/* browser tools */

	button = _gtk_menu_button_new_for_header_bar ();
	g_signal_connect (button, "toggled", G_CALLBACK (tools_menu_button_toggled_cb), data);
	gtk_widget_set_tooltip_text (button, _("Tools"));
	gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("tools-symbolic", GTK_ICON_SIZE_MENU));
	gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
	gtk_widget_show_all (button);
	gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)), button, FALSE, FALSE, 0);

	g_object_unref (builder);
}