[epiphany] toolbar: Don't store page menu button's model
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] toolbar: Don't store page menu button's model
- Date: Thu, 28 Jul 2016 12:32:14 +0000 (UTC)
commit cd10cc74c838cc79fced3c277ea526473c99f074
Author: Iulian Radu <iulian radu67 gmail com>
Date: Mon Jul 18 12:51:36 2016 +0300
toolbar: Don't store page menu button's model
src/bookmarks/ephy-bookmarks-ui.c | 12 +++++++-----
src/ephy-toolbar.c | 13 +++----------
src/ephy-toolbar.h | 1 -
3 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 7bb1cff..3170da5 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -62,25 +62,27 @@ static GHashTable *properties_dialogs = 0;
static GMenu *
find_bookmarks_menu (EphyWindow *window)
{
- GMenu *page_menu;
+ GtkWidget *page_menu_button;
+ GMenuModel *page_menu;
gint n_items, i;
/* Page menu */
- page_menu = ephy_toolbar_get_page_menu (EPHY_TOOLBAR (ephy_window_get_toolbar (window)));
+ page_menu_button = ephy_toolbar_get_page_menu_button (EPHY_TOOLBAR (ephy_window_get_toolbar (window)));
+ page_menu = gtk_menu_button_get_menu_model (GTK_MENU_BUTTON (page_menu_button));
/* Number of sections in the model */
- n_items = g_menu_model_get_n_items (G_MENU_MODEL (page_menu));
+ n_items = g_menu_model_get_n_items (page_menu);
for (i = 0; i < n_items; i++) {
GVariant *section_label;
/* Looking for the bookmarks section */
- section_label = g_menu_model_get_item_attribute_value (G_MENU_MODEL (page_menu), i, "id",
G_VARIANT_TYPE_STRING);
+ section_label = g_menu_model_get_item_attribute_value (page_menu, i, "id", G_VARIANT_TYPE_STRING);
if (section_label != NULL && g_strcmp0 (g_variant_get_string (section_label, NULL), "bookmarks-section")
== 0) {
GMenuModel *bookmarks_section_model, *bookmarks_menu_model;
/* Bookmarks section should contain the bookmarks menu */
- bookmarks_section_model = g_menu_model_get_item_link (G_MENU_MODEL (page_menu), i,
G_MENU_LINK_SECTION);
+ bookmarks_section_model = g_menu_model_get_item_link (page_menu, i, G_MENU_LINK_SECTION);
bookmarks_menu_model = g_menu_model_get_item_link (bookmarks_section_model, 0, G_MENU_LINK_SUBMENU);
return G_MENU (bookmarks_menu_model);
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index eddfa0d..7eac7e3 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -63,8 +63,6 @@ struct _EphyToolbar {
GtkWidget *downloads_button;
GtkWidget *downloads_popover;
- GMenu *page_menu;
-
guint navigation_buttons_menu_timeout;
};
@@ -567,6 +565,7 @@ ephy_toolbar_constructed (GObject *object)
EphyToolbar *toolbar = EPHY_TOOLBAR (object);
GtkWidget *box, *button;
GtkMenu *menu;
+ GMenu *page_menu;
EphyDownloadsManager *downloads_manager;
GtkBuilder *builder;
EphyHistoryService *history_service;
@@ -656,10 +655,10 @@ ephy_toolbar_constructed (GObject *object)
gtk_image_new_from_icon_name ("open-menu-symbolic", GTK_ICON_SIZE_BUTTON));
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/menus.ui");
- toolbar->page_menu = G_MENU (gtk_builder_get_object (builder, "page-menu"));
+ page_menu = G_MENU (gtk_builder_get_object (builder, "page-menu"));
gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (button), FALSE);
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button),
- G_MENU_MODEL (toolbar->page_menu));
+ G_MENU_MODEL (page_menu));
menu = gtk_menu_button_get_popup (GTK_MENU_BUTTON (button));
gtk_widget_set_halign (GTK_WIDGET (menu), GTK_ALIGN_END);
gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
@@ -770,12 +769,6 @@ ephy_toolbar_get_title_box (EphyToolbar *toolbar)
return toolbar->title_box;
}
-GMenu *
-ephy_toolbar_get_page_menu (EphyToolbar *toolbar)
-{
- return toolbar->page_menu;
-}
-
GtkWidget *
ephy_toolbar_get_page_menu_button (EphyToolbar *toolbar)
{
diff --git a/src/ephy-toolbar.h b/src/ephy-toolbar.h
index 53434aa..2428ecb 100644
--- a/src/ephy-toolbar.h
+++ b/src/ephy-toolbar.h
@@ -38,7 +38,6 @@ void ephy_toolbar_change_combined_stop_reload_state (GSimpleAction *act
GtkWidget *ephy_toolbar_get_location_entry (EphyToolbar *toolbar);
EphyTitleBox *ephy_toolbar_get_title_box (EphyToolbar *toolbar);
-GMenu *ephy_toolbar_get_page_menu (EphyToolbar *toolbar);
GtkWidget *ephy_toolbar_get_page_menu_button (EphyToolbar *toolbar);
GtkWidget *ephy_toolbar_get_new_tab_button (EphyToolbar *toolbar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]