[epiphany] Use a GtkMenuButton for the window menu and remove EphyPageMenuAction
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Use a GtkMenuButton for the window menu and remove EphyPageMenuAction
- Date: Wed, 1 Oct 2014 14:52:59 +0000 (UTC)
commit fd4357f9a78cb7c77d7c375e778457f9015be78b
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Tue Sep 30 17:53:21 2014 -0500
Use a GtkMenuButton for the window menu and remove EphyPageMenuAction
This fixes the style of the button when it is active with GTK+ 3.14.
https://bugzilla.gnome.org/show_bug.cgi?id=737688
src/Makefile.am | 2 -
src/ephy-page-menu-action.c | 181 -------------------------------------------
src/ephy-page-menu-action.h | 55 -------------
src/ephy-toolbar.c | 17 ++--
src/ephy-window.c | 31 +++-----
5 files changed, 19 insertions(+), 267 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 17d8eae..6faebf4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,7 +23,6 @@ NOINST_H_FILES = \
ephy-lockdown.h \
ephy-location-controller.h \
ephy-navigation-history-action.h \
- ephy-page-menu-action.h \
ephy-private.h \
ephy-search-provider.h \
ephy-title-box.h \
@@ -60,7 +59,6 @@ libephymain_la_SOURCES = \
ephy-lockdown.c \
ephy-navigation-history-action.c \
ephy-notebook.c \
- ephy-page-menu-action.c \
ephy-session.c \
ephy-shell.c \
ephy-title-box.c \
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index f9a86e9..12f877b 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -101,7 +101,8 @@ ephy_toolbar_constructed (GObject *object)
EphyToolbarPrivate *priv = EPHY_TOOLBAR (object)->priv;
GtkActionGroup *action_group;
GtkAction *action;
- GtkWidget *toolbar, *box, *button;
+ GtkUIManager *manager;
+ GtkWidget *toolbar, *box, *button, *menu;
G_OBJECT_CLASS (ephy_toolbar_parent_class)->constructed (object);
@@ -180,16 +181,14 @@ ephy_toolbar_constructed (GObject *object)
gtk_widget_show (GTK_WIDGET (priv->title_box));
/* Page Menu */
- button = gtk_button_new ();
+ button = gtk_menu_button_new ();
priv->page_menu_button = button;
- gtk_widget_set_name (button, "ephy-page-menu-button");
- /* FIXME: apparently we need an image inside the button for the action
- * icon to appear. */
- gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
+ gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("open-menu-symbolic",
GTK_ICON_SIZE_BUTTON));
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- action = gtk_action_group_get_action (action_group, "PageMenu");
- gtk_activatable_set_related_action (GTK_ACTIVATABLE (button),
- action);
+ manager = ephy_window_get_ui_manager (priv->window);
+ menu = gtk_ui_manager_get_widget (manager, "/ui/PagePopup");
+ gtk_widget_set_halign (menu, GTK_ALIGN_END);
+ gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 59ec193..50eb6a2 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -44,7 +44,6 @@
#include "ephy-location-entry.h"
#include "ephy-navigation-history-action.h"
#include "ephy-notebook.h"
-#include "ephy-page-menu-action.h"
#include "ephy-prefs.h"
#include "ephy-private.h"
#include "ephy-session.h"
@@ -1219,14 +1218,6 @@ setup_ui_manager (EphyWindow *window)
gtk_action_group_add_action (action_group, action);
g_object_unref (action);
- action = g_object_new (EPHY_TYPE_PAGE_MENU_ACTION,
- "name", "PageMenu",
- "icon-name", "open-menu-symbolic",
- "window", window,
- NULL);
- gtk_action_group_add_action_with_accel (action_group, action, "<alt>E");
- g_object_unref (action);
-
gtk_action_group_set_accel_group (action_group, accel_group);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
window->priv->toolbar_action_group = action_group;
@@ -3413,6 +3404,17 @@ ephy_window_constructor (GType type,
priv->notebook = setup_notebook (window);
+ /* Now load the UI definition (needed by EphyToolbar). */
+ gtk_ui_manager_add_ui_from_resource (priv->manager,
+ "/org/gnome/epiphany/epiphany-ui.xml",
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Could not merge epiphany-ui.xml: %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+
/* Setup the toolbar. */
priv->toolbar = setup_toolbar (window);
priv->location_controller = setup_location_controller (window, EPHY_TOOLBAR (priv->toolbar));
@@ -3431,17 +3433,6 @@ ephy_window_constructor (GType type,
priv->downloads_box, "visible",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- /* Now load the UI definition. */
- gtk_ui_manager_add_ui_from_resource (priv->manager,
- "/org/gnome/epiphany/epiphany-ui.xml",
- &error);
- if (error != NULL)
- {
- g_warning ("Could not merge epiphany-ui.xml: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
-
/* Attach the CSS provider to the window. */
css_provider = gtk_css_provider_new ();
_gtk_css_provider_load_from_resource (css_provider,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]