Commit bbf11ca4 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

simplified creation of the menu button

parent 767fc63c
......@@ -321,9 +321,8 @@ bookmarks__gth_browser_construct_cb (GthBrowser *browser)
GtkWidget *button;
GMenuModel *menu;
button = _gtk_menu_button_new_for_header_bar ();
button = _gtk_menu_button_new_for_header_bar ("user-bookmarks-symbolic");
gtk_widget_set_tooltip_text (button, _("Bookmarks"));
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("user-bookmarks-symbolic", GTK_ICON_SIZE_MENU));
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"));
......@@ -334,7 +333,7 @@ bookmarks__gth_browser_construct_cb (GthBrowser *browser)
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
_gtk_window_add_accelerators_from_menu ((GTK_WINDOW (browser)), menu);
gtk_widget_show_all (button);
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);
}
......
......@@ -42,10 +42,9 @@ export_tools__gth_browser_construct_cb (GthBrowser *browser)
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 ();
button = _gtk_menu_button_new_for_header_bar ("export-symbolic");
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_widget_show (button);
gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_TOOLS)), button, FALSE, FALSE, 0);
}
......@@ -169,12 +169,11 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
/* browser tools */
button = _gtk_menu_button_new_for_header_bar ();
button = _gtk_menu_button_new_for_header_bar ("tools-symbolic");
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_widget_show (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);
......
......@@ -4458,7 +4458,7 @@ gth_browser_init (GthBrowser *browser)
builder = _gtk_builder_new_from_resource ("gears-menu.ui");
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
browser->priv->menu_button = _gtk_menu_button_new_for_header_bar ();
browser->priv->menu_button = _gtk_menu_button_new_for_header_bar (NULL);
#if ! GTK_CHECK_VERSION(3,13,0)
gtk_container_add (GTK_CONTAINER (browser->priv->menu_button), gtk_image_new_from_icon_name ("emblem-system-symbolic", GTK_ICON_SIZE_MENU));
#else
......@@ -4503,13 +4503,12 @@ gth_browser_init (GthBrowser *browser)
/* history menu button */
builder = _gtk_builder_new_from_resource ("history-menu.ui");
button = _gtk_menu_button_new_for_header_bar ();
button = _gtk_menu_button_new_for_header_bar ("document-open-recent-symbolic");
gtk_widget_set_tooltip_text (button, _("History"));
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("document-open-recent-symbolic", GTK_ICON_SIZE_MENU));
browser->priv->history_menu = G_MENU (gtk_builder_get_object (builder, "visited-locations"));
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (gtk_builder_get_object (builder, "menu")));
gtk_widget_show_all (button);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION)), button, FALSE, FALSE, 0);
g_object_unref (builder);
......
......@@ -44,8 +44,8 @@ _gtk_message_dialog_new (GtkWindow *parent,
dialog = g_object_new (GTK_TYPE_MESSAGE_DIALOG,
"title", "",
"transient-for", parent,
"modal", (flags & GTK_DIALOG_MODAL),
"destroy-with-parent", (flags & GTK_DIALOG_DESTROY_WITH_PARENT),
"modal", ((flags & GTK_DIALOG_MODAL) == GTK_DIALOG_MODAL),
"destroy-with-parent", ((flags & GTK_DIALOG_DESTROY_WITH_PARENT) == GTK_DIALOG_DESTROY_WITH_PARENT),
"text", message,
NULL);
......@@ -927,11 +927,18 @@ _gtk_menu_button_set_style_for_header_bar (GtkWidget *button)
GtkWidget *
_gtk_menu_button_new_for_header_bar (void)
_gtk_menu_button_new_for_header_bar (const char *icon_name)
{
GtkWidget *button;
button = gtk_menu_button_new ();
if (icon_name != NULL) {
GtkWidget *image;
image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
gtk_container_add (GTK_CONTAINER (button), image);
}
_gtk_menu_button_set_style_for_header_bar (button);
return button;
......
......@@ -134,7 +134,7 @@ void _gtk_combo_box_add_image_sizes (GtkComboBox *co
gboolean _gtk_file_chooser_set_file_parent (GtkFileChooser *chooser,
GFile *file,
GError **error);
GtkWidget * _gtk_menu_button_new_for_header_bar (void);
GtkWidget * _gtk_menu_button_new_for_header_bar (const char *icon_name);
GtkWidget * _gtk_image_button_new_for_header_bar (const char *icon_name);
GtkWidget * _gtk_toggle_image_button_new_for_header_bar(const char *icon_name);
void _gtk_window_add_accelerator_for_action (GtkWindow *window,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment