[epiphany/wip/gtkaction-to-gaction: 2/4] Port zoom actions to GAction
- From: Iulian Radu <iulianradu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/gtkaction-to-gaction: 2/4] Port zoom actions to GAction
- Date: Sat, 14 May 2016 15:19:42 +0000 (UTC)
commit 6bb1e07d4b61be65019d1e9e9cb2e4df8588974e
Author: Iulian Radu <iulian radu67 gmail com>
Date: Fri May 13 17:00:38 2016 +0300
Port zoom actions to GAction
lib/widgets/Makefile.am | 2 -
lib/widgets/ephy-zoom-action.c | 232 ----------------------------------------
lib/widgets/ephy-zoom-action.h | 60 ----------
src/ephy-action-helper.c | 40 +++++++
src/ephy-action-helper.h | 4 +
src/ephy-toolbar.c | 17 +++
src/ephy-window.c | 121 ++++++++++++---------
src/ephy-window.h | 4 +-
src/resources/epiphany-ui.xml | 9 +-
src/resources/gtk/menus.ui | 48 ++++-----
src/window-commands.c | 21 ++--
src/window-commands.h | 15 ++-
12 files changed, 180 insertions(+), 393 deletions(-)
---
diff --git a/lib/widgets/Makefile.am b/lib/widgets/Makefile.am
index 0d78f8c..090c36a 100644
--- a/lib/widgets/Makefile.am
+++ b/lib/widgets/Makefile.am
@@ -83,8 +83,6 @@ libephywidgets_la_SOURCES = \
ephy-tree-model-node.h \
ephy-tree-model-sort.c \
ephy-tree-model-sort.h \
- ephy-zoom-action.h \
- ephy-zoom-action.c \
nautilus-floating-bar.c \
nautilus-floating-bar.h
diff --git a/src/ephy-action-helper.c b/src/ephy-action-helper.c
index a810672..6f99ce6 100644
--- a/src/ephy-action-helper.c
+++ b/src/ephy-action-helper.c
@@ -60,3 +60,43 @@ ephy_action_change_sensitivity_flags (GtkAction *action,
gtk_action_set_sensitive (GTK_ACTION (action), value == 0);
}
+
+/**
+ * ephy_action_change_sensitivity_flags:
+ * @action: a #GAction object
+ * @flags: arbitrary combination of bit flags, defined by the user
+ * @set: %TRUE if @flags should be added to @action
+ *
+ * This helper function provides an extra layer on top of #GAction to
+ * manage its sensitivity. It uses bit @flags defined by the user, like
+ * in ephy-window.c, SENS_FLAG_*.
+ *
+ * Effectively, the @action won't be sensitive until it has no flags
+ * set. This means you can stack @flags for different events or
+ * conditions at the same time.
+ */
+void
+new_ephy_action_change_sensitivity_flags (GSimpleAction *action,
+ guint flags,
+ gboolean set)
+{
+ static GQuark sensitivity_quark = 0;
+ GObject *object = (GObject *)action;
+ guint value;
+
+ if (G_UNLIKELY (sensitivity_quark == 0)) {
+ sensitivity_quark = g_quark_from_static_string (SENSITIVITY_KEY);
+ }
+
+ value = GPOINTER_TO_UINT (g_object_get_qdata (object, sensitivity_quark));
+
+ if (set) {
+ value |= flags;
+ } else {
+ value &= ~flags;
+ }
+
+ g_object_set_qdata (object, sensitivity_quark, GUINT_TO_POINTER (value));
+
+ g_simple_action_set_enabled (action, value == 0);
+}
diff --git a/src/ephy-action-helper.h b/src/ephy-action-helper.h
index 82faa56..c397241 100644
--- a/src/ephy-action-helper.h
+++ b/src/ephy-action-helper.h
@@ -31,6 +31,10 @@ void ephy_action_change_sensitivity_flags (GtkAction *action,
guint flags,
gboolean set);
+void new_ephy_action_change_sensitivity_flags (GSimpleAction *action,
+ guint flags,
+ gboolean set);
+
G_END_DECLS
#endif /* !EPHY_ACTION_HELPER_H */
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 7b21dd1..b463ad6 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -42,10 +42,13 @@ struct _EphyToolbar {
GtkWidget *entry;
GtkWidget *navigation_box;
GtkWidget *page_menu_button;
+ GtkWidget *new_page_menu_button;
GtkWidget *new_tab_button;
GtkWidget *downloads_revealer;
GtkWidget *downloads_button;
GtkWidget *downloads_popover;
+
+ GMenu *page_menu;
};
G_DEFINE_TYPE (EphyToolbar, ephy_toolbar, GTK_TYPE_HEADER_BAR)
@@ -133,6 +136,7 @@ sync_chromes_visibility (EphyToolbar *toolbar)
gtk_widget_set_visible (toolbar->navigation_box, chrome & EPHY_WINDOW_CHROME_TOOLBAR);
gtk_widget_set_visible (toolbar->page_menu_button, chrome & EPHY_WINDOW_CHROME_MENU);
+ gtk_widget_set_visible (toolbar->new_page_menu_button, chrome & EPHY_WINDOW_CHROME_MENU);
gtk_widget_set_visible (toolbar->new_tab_button, chrome & EPHY_WINDOW_CHROME_TABSBAR);
}
@@ -145,6 +149,7 @@ ephy_toolbar_constructed (GObject *object)
GtkUIManager *manager;
GtkWidget *box, *button, *menu;
EphyDownloadsManager *downloads_manager;
+ GtkBuilder *builder;
G_OBJECT_CLASS (ephy_toolbar_parent_class)->constructed (object);
@@ -231,6 +236,18 @@ ephy_toolbar_constructed (GObject *object)
gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
+ /* Page Menu */
+ button = gtk_menu_button_new ();
+ toolbar->new_page_menu_button = button;
+ 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);
+ builder = gtk_builder_new_from_resource ("/org/gnome/epiphany/gtk/menus.ui");
+ toolbar->page_menu = G_MENU (gtk_builder_get_object (builder, "page-menu"));
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (toolbar->new_page_menu_button),
+ G_MENU_MODEL (toolbar->page_menu));
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (toolbar), button);
+
/* Downloads */
downloads_manager = ephy_embed_shell_get_downloads_manager (ephy_embed_shell_get_default ());
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 96ef978..1a38ef6 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -49,7 +49,6 @@
#include "ephy-toolbar.h"
#include "ephy-type-builtins.h"
#include "ephy-web-view.h"
-#include "ephy-zoom-action.h"
#include "ephy-zoom.h"
#include "popup-commands.h"
#include "window-commands.h"
@@ -146,12 +145,6 @@ static const GtkActionEntry ephy_menu_entries [] = {
NULL, G_CALLBACK (window_cmd_view_stop) },
{ "ViewReload", NULL, N_("_Reload"), "<control>R", NULL,
G_CALLBACK (window_cmd_view_reload) },
- { "ViewZoomIn", NULL, N_("Zoom _In"), "<control>plus", NULL,
- G_CALLBACK (window_cmd_view_zoom_in) },
- { "ViewZoomOut", NULL, N_("Zoom O_ut"), "<control>minus", NULL,
- G_CALLBACK (window_cmd_view_zoom_out) },
- { "ViewZoomNormal", NULL, N_("_Normal Size"), "<control>0", NULL,
- G_CALLBACK (window_cmd_view_zoom_normal) },
{ "ViewEncoding", NULL, N_("Text _Encoding"), NULL, NULL,
G_CALLBACK (window_cmd_view_encoding) },
{ "ViewPageSource", NULL, N_("_Page Source"), "<control>U", NULL,
@@ -274,9 +267,6 @@ static const struct {
{ GDK_KEY_Home, GDK_MOD1_MASK, "FileHome", TRUE },
/* FIXME: these are not in any menu for now, so add them here. */
{ GDK_KEY_F11, 0, "ViewFullscreen", FALSE },
- { GDK_KEY_plus, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_minus, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
- { GDK_KEY_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
{ GDK_KEY_g, GDK_CONTROL_MASK, "EditFindNext", FALSE },
{ GDK_KEY_G, GDK_CONTROL_MASK |
GDK_SHIFT_MASK, "EditFindPrev", FALSE },
@@ -302,10 +292,6 @@ static const struct {
{ GDK_KEY_F5, GDK_SHIFT_MASK, "ViewReload", FALSE },
{ GDK_KEY_F5, GDK_CONTROL_MASK |
GDK_SHIFT_MASK, "ViewReload", FALSE },
- { GDK_KEY_KP_Add, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_KP_Subtract, GDK_CONTROL_MASK, "ViewZoomOut", FALSE },
- { GDK_KEY_equal, GDK_CONTROL_MASK, "ViewZoomIn", FALSE },
- { GDK_KEY_KP_0, GDK_CONTROL_MASK, "ViewZoomNormal", FALSE },
/* These keys are a bit strange: when pressed with no modifiers, they emit
* KP_PageUp/Down Control; when pressed with Control+Shift they are KP_9/3,
* when NumLock is on they are KP_9/3 and with NumLock and Control+Shift
@@ -332,8 +318,6 @@ static const struct {
{ XF86XK_Search, 0, "EditFind", FALSE },
{ XF86XK_Send, 0, "FileSendTo", FALSE },
{ XF86XK_Stop, 0, "ViewStop", FALSE },
- { XF86XK_ZoomIn, 0, "ViewZoomIn", FALSE },
- { XF86XK_ZoomOut, 0, "ViewZoomOut", FALSE }
/* FIXME: what about ScrollUp, ScrollDown, Menu*, Option, LogOff, Save,.. any others? */
#endif /* HAVE_X11_XF86KEYSYM_H */
}, navigation_keybindings_ltr [] = {
@@ -348,6 +332,15 @@ static const struct {
{ GDK_KEY_KP_Right, GDK_MOD1_MASK /*Alt*/, "NavigationBack", TRUE }
}, *navigation_keybindings_rtl_ltr;
+const struct {
+ const gchar *action_and_target;
+ const gchar *accelerators[5];
+} accels [] = {
+ { "win.zoom-in", { "<control>plus", "<control>KP_Add", "<control>equal", "ZoomIn", NULL } },
+ { "win.zoom-out", { "<control>minus", "<control>KP_Subtract", "ZoomOut", NULL } },
+ { "win.zoom-normal", { "<control>0", "<control>KP_0", NULL } }
+};
+
#define SETTINGS_CONNECTION_DATA_KEY "EphyWindowSettings"
struct _EphyWindow {
@@ -1105,12 +1098,6 @@ setup_ui_manager (EphyWindow *window)
action = gtk_action_group_get_action (action_group, "ViewEncoding");
g_object_set (action, "short_label", _("Encodings…"), NULL);
- action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- /* Translators: This refers to text size */
- g_object_set (action, "short-label", _("Larger"), NULL);
- action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- /* Translators: This refers to text size */
- g_object_set (action, "short-label", _("Smaller"), NULL);
action_group = gtk_action_group_new ("PopupsActions");
gtk_action_group_set_translation_domain (action_group, NULL);
@@ -1153,15 +1140,6 @@ setup_ui_manager (EphyWindow *window)
"<alt>Right");
g_object_unref (action);
- action =
- g_object_new (EPHY_TYPE_ZOOM_ACTION,
- "name", "Zoom",
- "label", _("Zoom"),
- "zoom", 1.0,
- NULL);
- gtk_action_group_add_action (action_group, action);
- g_object_unref (action);
-
action = g_object_new (EPHY_TYPE_HOME_ACTION,
"name", "FileNewTab",
"icon-name", "tab-new-symbolic",
@@ -1217,11 +1195,15 @@ _ephy_window_set_default_actions_sensitive (EphyWindow *window,
{
GtkActionGroup *action_group;
GtkAction *action;
+ GAction *new_action;
int i;
const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint",
"FileSendTo", "FileBookmarkPage", "EditFind",
"EditFindPrev", "EditFindNext", "ViewEncoding",
- "ViewZoomIn", "ViewZoomOut", "ViewPageSource",
+ "ViewPageSource",
+ NULL };
+
+ const char *new_action_group_actions[] = { "zoom-in", "zoom-out",
NULL };
action_group = window->action_group;
@@ -1234,6 +1216,13 @@ _ephy_window_set_default_actions_sensitive (EphyWindow *window,
flags, set);
}
+ for (i = 0; new_action_group_actions[i] != NULL; i++) {
+ new_action = g_action_map_lookup_action (G_ACTION_MAP (window),
+ new_action_group_actions[i]);
+ new_ephy_action_change_sensitivity_flags (G_SIMPLE_ACTION (new_action),
+ flags, set);
+ }
+
/* Page context popup */
action = gtk_action_group_get_action (window->popups_action_group,
"ContextBookmarkPage");
@@ -1273,8 +1262,7 @@ sync_tab_address (EphyWebView *view,
static void
sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
{
- GtkActionGroup *action_group;
- GtkAction *action;
+ GAction *action;
gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
double zoom;
@@ -1294,13 +1282,12 @@ sync_tab_zoom (WebKitWebView *web_view, GParamSpec *pspec, EphyWindow *window)
can_zoom_normal = TRUE;
}
- action_group = window->action_group;
- action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- gtk_action_set_sensitive (action, can_zoom_in);
- action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- gtk_action_set_sensitive (action, can_zoom_out);
- action = gtk_action_group_get_action (action_group, "ViewZoomNormal");
- gtk_action_set_sensitive (action, can_zoom_normal);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-in");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_zoom_in);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-out");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_zoom_out);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "zoom-normal");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), can_zoom_normal);
}
static void
@@ -2936,11 +2923,11 @@ sync_user_input_cb (EphyLocationController *action,
}
static void
-zoom_to_level_cb (GtkAction *action,
- float zoom,
- EphyWindow *window)
+zoom_to_level_cb (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data)
{
- ephy_window_set_zoom (window, zoom);
+ ephy_window_set_zoom (EPHY_WINDOW (user_data), g_variant_get_double (user_data));
}
static void
@@ -3026,11 +3013,6 @@ setup_toolbar (EphyWindow *window)
g_signal_connect_swapped (action, "open-link",
G_CALLBACK (ephy_link_open), window);
- action = gtk_action_group_get_action (window->toolbar_action_group,
- "Zoom");
- g_signal_connect (action, "zoom-to-level",
- G_CALLBACK (zoom_to_level_cb), window);
-
title_box = ephy_toolbar_get_title_box (EPHY_TOOLBAR (toolbar));
g_signal_connect (title_box, "lock-clicked",
G_CALLBACK (title_box_lock_clicked_cb), window);
@@ -3117,6 +3099,30 @@ ephy_window_toggle_visibility_for_app_menu (EphyWindow *window)
}
}
+static const GActionEntry new_ephy_page_menu_entries [] =
+{
+ // { "new-tab", },
+ // { "open", },
+ // { "save-as", }
+ // { "save-as-application", }
+ // { "undo", },
+ // { "redo", },
+ // { "cut", },
+ // { "copy", },
+ // { "paste", },
+ { "zoom-in", window_cmd_view_zoom_in },
+ { "zoom-out", window_cmd_view_zoom_out },
+ { "zoom-normal", window_cmd_view_zoom_normal },
+ { "zoom", NULL, "d", "1.0", zoom_to_level_cb }
+ // { "print", },
+ // { "find", },
+ // { "bookmarks", },
+ // { "bookmark-page", },
+ // { "view-encoding", },
+ // { "view-page-source", },
+ // { "close-tab", }
+};
+
static GObject *
ephy_window_constructor (GType type,
guint n_construct_properties,
@@ -3133,12 +3139,24 @@ ephy_window_constructor (GType type,
guint i;
EphyEmbedShellMode mode;
EphyWindowChrome chrome = EPHY_WINDOW_CHROME_DEFAULT;
+ GApplication *app;
object = G_OBJECT_CLASS (ephy_window_parent_class)->constructor
(type, n_construct_properties, construct_params);
window = EPHY_WINDOW (object);
+ g_action_map_add_action_entries (G_ACTION_MAP (window),
+ new_ephy_page_menu_entries,
+ G_N_ELEMENTS (new_ephy_page_menu_entries),
+ window);
+
+ app = g_application_get_default ();
+ for (i = 0; i < G_N_ELEMENTS (accels); i++)
+ gtk_application_set_accels_for_action (GTK_APPLICATION (app),
+ accels[i].action_and_target,
+ accels[i].accelerators);
+
ephy_gui_ensure_window_group (GTK_WINDOW (window));
/* initialize the listener for the key theme
@@ -3173,6 +3191,7 @@ ephy_window_constructor (GType type,
error = NULL;
}
+
/* Setup the toolbar. */
window->toolbar = setup_toolbar (window);
window->location_controller = setup_location_controller (window, EPHY_TOOLBAR (window->toolbar));
@@ -3443,7 +3462,7 @@ ephy_window_activate_location (EphyWindow *window)
**/
void
ephy_window_set_zoom (EphyWindow *window,
- float zoom)
+ double zoom)
{
EphyEmbed *embed;
double current_zoom = 1.0;
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 3d0f335..711008c 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -46,8 +46,8 @@ GtkWidget *ephy_window_get_notebook (EphyWindow *window);
void ephy_window_load_url (EphyWindow *window,
const char *url);
-void ephy_window_set_zoom (EphyWindow *window,
- float zoom);
+void ephy_window_set_zoom (EphyWindow *window,
+ double zoom);
void ephy_window_activate_location (EphyWindow *window);
const char *ephy_window_get_location (EphyWindow *window);
diff --git a/src/resources/epiphany-ui.xml b/src/resources/epiphany-ui.xml
index efe51a4..aa3e324 100644
--- a/src/resources/epiphany-ui.xml
+++ b/src/resources/epiphany-ui.xml
@@ -25,23 +25,20 @@
<menuitem name="EditCopyMenu" action="EditCopy"/>
<menuitem name="EditPasteMenu" action="EditPaste"/>
<separator name="EditSep3"/>
- <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
- <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/>
- <separator name="EditSep4"/>
<menuitem name="FilePrintMenu" action="FilePrint"/>
<menuitem name="EditFindMenu" action="EditFind"/>
<menuitem name="EditPreferencesMenu" action="EditPreferences"/>
- <separator name="FileSep5"/>
+ <separator name="FileSep4"/>
<menuitem name="HistoryEditMenu" action="EditHistory"/>
<menuitem name="BookmarksEditMenu" action="EditBookmarks"/>
<menu name="BookmarksMenu" action="Bookmarks">
<menuitem name="BookmarksAddBookmarkMenu" action="FileBookmarkPage"/>
<separator name="BookmarksSep1"/>
</menu>
- <separator name="FileSep6"/>
+ <separator name="FileSep5"/>
<menuitem name="ViewEncodingMenu" action="ViewEncoding"/>
<menuitem name="ViewPageSourceMenu" action="ViewPageSource"/>
- <separator name="FileSep7"/>
+ <separator name="FileSep6"/>
<menuitem name="HelpContentsMenu" action="HelpContents"/>
<menuitem name="HelpAboutMenu" action="HelpAbout"/>
<menuitem name="FileCloseWindowMenu" action="FileCloseTab"/>
diff --git a/src/resources/gtk/menus.ui b/src/resources/gtk/menus.ui
index 730b3d4..86165ea 100644
--- a/src/resources/gtk/menus.ui
+++ b/src/resources/gtk/menus.ui
@@ -2,48 +2,46 @@
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="page-menu">
- <section>
- <item>
- <attribute name="label" translatable="yes">_New Window</attribute>
- <attribute name="action">win.file-new-window</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">New _Incognito Window</attribute>
- <attribute name="action">win.file-new-window-incognito</attribute>
- </item>
+ <!-- <section>
<item>
<attribute name="label" translatable="yes">New Tab</attribute>
- <attribute name="action">win.file-new-tab</attribute>
+ <attribute name="action">win.new-tab</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open…</attribute>
- <attribute name="action">win.file-open</attribute>
+ <attribute name="action">win.open</attribute>
</item>
</section>
<section>
+ <attribute name="label" translatable="yes">Save _As…</attribute>
+ <attribute name="action">win.save-as</attribute>
+ <attribute name="label" translatable="yes">Save As _Web Application…</attribute>
+ <attribute name="action">win.save-as-application</attribute>
+ </section>
+ <section>
<item>
<attribute name="label" translatable="yes">_Undo</attribute>
- <attribute name="action">win.edit-undo</attribute>
+ <attribute name="action">win.undo</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Re_do</attribute>
- <attribute name="action">win.edit-redo</attribute>
+ <attribute name="action">win.redo</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Cu_t</attribute>
- <attribute name="action">win.edit-cut</attribute>
+ <attribute name="action">win.cut</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Copy</attribute>
- <attribute name="action">win.edit-copy</attribute>
+ <attribute name="action">win.copy</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Paste</attribute>
- <attribute name="action">win</attribute>
+ <attribute name="action">win.paste</attribute>
</item>
- </section>
+ </section> -->
<section>
<item>
<attribute name="label" translatable="yes">Zoom _In</attribute>
@@ -54,43 +52,43 @@
<attribute name="action">win.zoom-out</attribute>
</item>
</section>
- <section>
+<!-- <section>
<item>
<attribute name="label" translatable="yes">Print…</attribute>
<attribute name="action">win.file-print</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Find…</attribute>
- <attribute name="action">win.edit-find</attribute>
+ <attribute name="action">win.find</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Edit _Bookmarks</attribute>
- <attribute name="action">win.edit-bookmarks</attribute>
+ <attribute name="action">win.bookmarks</attribute>
</item>
<submenu id="bookmarkks-menu">
<item>
<attribute name="label" translatable="yes">_Add Bookmark…</attribute>
- <attribute name="action">win.file-bookmark-page</attribute>
+ <attribute name="action">win.bookmark-page</attribute>
</item>
</submenu>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Text _Encoding</attribute>
- <attribute name="action">win.view-encoding</attribute>
+ <attribute name="action">win.encoding</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Page Source</attribute>
- <attribute name="action">win.view-page-source</attribute>
+ <attribute name="action">win.page-source</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Close</attribute>
- <attribute name="action">win.file-close-tab</attribute>
+ <attribute name="action">win.close-tab</attribute>
</item>
- </section>
+ </section> -->
</menu>
</interface>
diff --git a/src/window-commands.c b/src/window-commands.c
index be9744c..c58005e 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1108,24 +1108,27 @@ window_cmd_view_fullscreen (GtkAction *action,
}
void
-window_cmd_view_zoom_in (GtkAction *action,
- EphyWindow *window)
+window_cmd_view_zoom_in (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data)
{
- ephy_window_set_zoom (window, ZOOM_IN);
+ ephy_window_set_zoom (EPHY_WINDOW (user_data), ZOOM_IN);
}
void
-window_cmd_view_zoom_out (GtkAction *action,
- EphyWindow *window)
+window_cmd_view_zoom_out (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data)
{
- ephy_window_set_zoom (window, ZOOM_OUT);
+ ephy_window_set_zoom (EPHY_WINDOW (user_data), ZOOM_OUT);
}
void
-window_cmd_view_zoom_normal (GtkAction *action,
- EphyWindow *window)
+window_cmd_view_zoom_normal (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data)
{
- ephy_window_set_zoom (window, 1.0);
+ ephy_window_set_zoom (EPHY_WINDOW (user_data), 1.0);
}
static void
diff --git a/src/window-commands.h b/src/window-commands.h
index 1db5a47..192c30a 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -70,12 +70,15 @@ void window_cmd_view_encoding (GtkAction *action,
EphyWindow *window);
void window_cmd_view_fullscreen (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_zoom_in (GtkAction *action,
- EphyWindow *window);
-void window_cmd_view_zoom_out (GtkAction *action,
- EphyWindow *window);
-void window_cmd_view_zoom_normal (GtkAction *action,
- EphyWindow *window);
+void window_cmd_view_zoom_in (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data);
+void window_cmd_view_zoom_out (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data);
+void window_cmd_view_zoom_normal (GSimpleAction *action,
+ GVariant *value,
+ gpointer user_data);
void window_cmd_view_page_source (GtkAction *action,
EphyWindow *window);
void window_cmd_help_contents (GtkAction *action,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]