[evince/wip/gmenu: 3/6] Use GMenuModel for action and view menus
- From: Lars Uebernickel <larsu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/gmenu: 3/6] Use GMenuModel for action and view menus
- Date: Mon, 10 Feb 2014 16:33:53 +0000 (UTC)
commit d282f1cf0cdc4147359272675e7a35a4773e1644
Author: Lars Uebernickel <lars uebernickel canonical com>
Date: Thu Jan 30 15:13:29 2014 +0100
Use GMenuModel for action and view menus
shell/Makefile.am | 6 +-
shell/ev-application.c | 60 ++-
shell/ev-bookmarks.c | 8 +
shell/ev-bookmarks.h | 1 +
shell/ev-recent-menu-model.c | 108 ++++
shell/ev-recent-menu-model.h | 30 +
shell/ev-sidebar-bookmarks.c | 32 +-
shell/ev-toolbar.c | 113 +++-
shell/ev-utils.c | 1 -
shell/ev-window.c | 1228 +++++++++++++++---------------------------
shell/ev-window.h | 2 +-
shell/evince-ui.xml | 88 ---
shell/evince.gresource.xml | 2 +-
shell/menus.ui | 188 +++++++
14 files changed, 928 insertions(+), 939 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 5106511..25773f4 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -75,6 +75,8 @@ evince_SOURCES= \
ev-sidebar-page.h \
ev-sidebar-thumbnails.c \
ev-sidebar-thumbnails.h \
+ ev-recent-menu-model.c \
+ ev-recent-menu-model.h \
main.c
nodist_evince_SOURCES = \
@@ -172,12 +174,12 @@ endif
EXTRA_DIST = \
evince.css \
- evince-appmenu.ui \
evince-icon.rc \
evince-ui.xml \
evince.gresource.xml \
ev-gdbus.xml \
- ev-daemon-gdbus.xml
+ ev-daemon-gdbus.xml \
+ menus.ui
ev-resources.c: evince.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies
--sourcedir $(srcdir) $(srcdir)/evince.gresource.xml)
$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)
--generate-source --c-name ev $<
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 6630c36..b808385 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -1034,6 +1034,18 @@ app_open_cb (GSimpleAction *action,
}
static void
+app_open_file_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ EvApplication *application = user_data;
+
+ ev_application_open_uri_at_dest (application, g_variant_get_string (parameter, NULL),
+ gdk_screen_get_default (), NULL, 0, NULL,
+ GDK_CURRENT_TIME);
+}
+
+static void
ev_application_dispose (GObject *object)
{
EvApplication *app = EV_APPLICATION (object);
@@ -1048,13 +1060,52 @@ ev_application_startup (GApplication *gapplication)
{
const GActionEntry app_menu_actions[] = {
{ "open", app_open_cb, NULL, NULL, NULL },
+ { "open-file", app_open_file_cb, "s", NULL, NULL },
{ "about", app_about_cb, NULL, NULL, NULL },
{ "help", app_help_cb, NULL, NULL, NULL },
};
+ const gchar *action_accels[] = {
+ "app.open", "<Ctrl>O", NULL,
+ "win.open-copy", "<Ctrl>N", NULL,
+ "win.save-copy", "<Ctrl>S", NULL,
+ "win.print", "<Ctrl>P", NULL,
+ "win.copy", "<Ctrl>C", "<Ctrl>Insert", NULL,
+ "win.select-all", "<Ctrl>A", NULL,
+ "win.save-settings", "<Ctrl>T", NULL,
+ "win.go-first-page", "<Ctrl>Home", NULL,
+ "win.go-last-page", "<Ctrl>End", NULL,
+ "win.add-bookmark", "<Ctrl>D", NULL,
+ "win.close", "<Ctrl>W", NULL,
+ "win.escape", "Escape", NULL,
+ "win.find", "<Ctrl>F", "slash", NULL,
+ "win.find-next", "<Ctrl>G", NULL,
+ "win.find-previous", "<Ctrl><Shift>G", NULL,
+ "win.select-page", "<Ctrl>L", NULL,
+ "win.go-backward", "<Shift>Page_Up", NULL,
+ "win.go-forward", "<Shift>Page_Down", NULL,
+ "win.go-next-page", "n", NULL,
+ "win.go-previous-page", "p", NULL,
+ "win.sizing-mode::fit-page", "f", NULL,
+ "win.sizing-mode::fit-width", "w", NULL,
+ "win.open-menu", "F10", NULL,
+ "win.caret-navigation", "F7", NULL,
+ "win.zoom-in", "plus", "<Ctrl>plus", "KP_Add", "<Ctrl>KP_Add", NULL,
+ "win.zoom-out", "minus", "<Ctrl>minus", "KP_Subtract", "<Ctrl>KP_Subtract", NULL,
+ "win.show-side-pane", "F9", NULL,
+ "win.fullscreen", "F11", NULL,
+ "win.presentation", "F5", NULL,
+ "win.rotate-left", "<Ctrl>Left", NULL,
+ "win.rotate-right", "<Ctrl>Right", NULL,
+ "win.inverted-colors", "<Ctrl>I", NULL,
+ "win.reload", "<Ctrl>R", NULL,
+ NULL
+ };
+
EvApplication *application = EV_APPLICATION (gapplication);
GtkBuilder *builder;
GError *error = NULL;
+ const gchar **it;
G_APPLICATION_CLASS (ev_application_parent_class)->startup (gapplication);
@@ -1063,12 +1114,19 @@ ev_application_startup (GApplication *gapplication)
application);
builder = gtk_builder_new ();
- gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/appmenu.ui", &error);
+ gtk_builder_add_from_resource (builder, "/org/gnome/evince/shell/ui/menus.ui", &error);
g_assert_no_error (error);
gtk_application_set_app_menu (GTK_APPLICATION (application),
G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu")));
g_object_unref (builder);
+
+ it = action_accels;
+ while (it[0])
+ {
+ gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
+ it += g_strv_length ((gchar **) it) + 1;
+ }
}
static void
diff --git a/shell/ev-bookmarks.c b/shell/ev-bookmarks.c
index 22d3274..d172b2a 100644
--- a/shell/ev-bookmarks.c
+++ b/shell/ev-bookmarks.c
@@ -224,6 +224,14 @@ ev_bookmarks_get_bookmarks (EvBookmarks *bookmarks)
return g_list_copy (bookmarks->items);
}
+gboolean
+ev_bookmarks_has_bookmarks (EvBookmarks *bookmarks)
+{
+ g_return_val_if_fail (EV_IS_BOOKMARKS (bookmarks), NULL);
+
+ return bookmarks->items != NULL;
+}
+
void
ev_bookmarks_add (EvBookmarks *bookmarks,
EvBookmark *bookmark)
diff --git a/shell/ev-bookmarks.h b/shell/ev-bookmarks.h
index d15ebad..c861352 100644
--- a/shell/ev-bookmarks.h
+++ b/shell/ev-bookmarks.h
@@ -43,6 +43,7 @@ typedef struct _EvBookmark {
GType ev_bookmarks_get_type (void) G_GNUC_CONST;
EvBookmarks *ev_bookmarks_new (EvMetadata *metadata);
GList *ev_bookmarks_get_bookmarks (EvBookmarks *bookmarks);
+gboolean ev_bookmarks_has_bookmarks (EvBookmarks *bookmarks);
void ev_bookmarks_add (EvBookmarks *bookmarks,
EvBookmark *bookmark);
void ev_bookmarks_delete (EvBookmarks *bookmarks,
diff --git a/shell/ev-recent-menu-model.c b/shell/ev-recent-menu-model.c
new file mode 100644
index 0000000..44d6393
--- /dev/null
+++ b/shell/ev-recent-menu-model.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2014 Canonical Ltd
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author: Lars Uebernickel <lars uebernickel canonical com>
+ */
+
+#include "ev-recent-menu-model.h"
+
+typedef struct
+{
+ GMenu *menu;
+ GtkRecentManager *manager;
+ gchar *action_name;
+ gchar *application;
+} EvRecentMenuModel;
+
+static void
+ev_recent_menu_model_update (GtkRecentManager *manager,
+ gpointer data)
+{
+ EvRecentMenuModel *recent_menu = data;
+ GList *items, *it;
+ guint n_items = 0;
+
+ g_menu_remove_all (recent_menu->menu);
+
+ items = gtk_recent_manager_get_items (recent_menu->manager);
+
+ for (it = items; it && n_items < 5; it = it->next)
+ {
+ GtkRecentInfo *info = it->data;
+ gchar *label;
+ GIcon *icon;
+ GMenuItem *item;
+
+ if (!gtk_recent_info_has_application (info, recent_menu->application))
+ continue;
+
+ label = g_strdup_printf ("_%d. %s", n_items + 1, gtk_recent_info_get_display_name (info));
+
+ item = g_menu_item_new (label, NULL);
+ g_menu_item_set_action_and_target (item, recent_menu->action_name,
+ "s", gtk_recent_info_get_uri (info));
+
+ icon = gtk_recent_info_get_gicon (info);
+ if (icon)
+ {
+ g_menu_item_set_icon (item, icon);
+ g_object_unref (icon);
+ }
+
+ g_menu_append_item (recent_menu->menu, item);
+
+ g_free (label);
+ g_object_unref (item);
+
+ n_items++;
+ }
+
+ g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref);
+}
+
+static void
+ev_recent_menu_model_destroy (gpointer data,
+ GObject *menu)
+{
+ EvRecentMenuModel *recent_menu = data;
+
+ g_signal_handlers_disconnect_by_func (recent_menu->manager, ev_recent_menu_model_update, recent_menu);
+ g_object_unref (recent_menu->manager);
+ g_free (recent_menu->application);
+ g_free (recent_menu->action_name);
+
+ g_slice_free (EvRecentMenuModel, recent_menu);
+}
+
+GMenuModel *
+ev_recent_menu_model_new (GtkRecentManager *manager,
+ const gchar *action_name,
+ const gchar *application)
+{
+ EvRecentMenuModel *recent_menu;
+
+ recent_menu = g_slice_new0 (EvRecentMenuModel);
+ recent_menu->menu = g_menu_new ();
+ recent_menu->manager = g_object_ref (manager);
+ recent_menu->action_name = g_strdup (action_name);
+ recent_menu->application = g_strdup (application);
+
+ g_object_weak_ref (G_OBJECT (recent_menu->menu), ev_recent_menu_model_destroy, recent_menu);
+ g_signal_connect (manager, "changed", G_CALLBACK (ev_recent_menu_model_update), recent_menu);
+
+ return G_MENU_MODEL (recent_menu->menu);
+}
diff --git a/shell/ev-recent-menu-model.h b/shell/ev-recent-menu-model.h
new file mode 100644
index 0000000..949f91b
--- /dev/null
+++ b/shell/ev-recent-menu-model.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2014 Canonical Ltd
+ *
+ * Evince is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Evince is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author: Lars Uebernickel <lars uebernickel canonical com>
+ */
+
+#ifndef EV_RECENT_MENU_MODEL_H
+#define EV_RECENT_MENU_MODEL_H
+
+#include <gtk/gtk.h>
+
+GMenuModel * ev_recent_menu_model_new (GtkRecentManager *manager,
+ const gchar *action_name,
+ const gchar *application);
+
+#endif
diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c
index 3f3b775..c131bce 100644
--- a/shell/ev-sidebar-bookmarks.c
+++ b/shell/ev-sidebar-bookmarks.c
@@ -40,11 +40,6 @@ enum {
N_COLUMNS
};
-enum {
- ADD_BOOKMARK,
- N_SIGNALS
-};
-
struct _EvSidebarBookmarksPrivate {
EvDocumentModel *model;
EvBookmarks *bookmarks;
@@ -68,8 +63,6 @@ G_DEFINE_TYPE_EXTENDED (EvSidebarBookmarks,
G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE,
ev_sidebar_bookmarks_page_iface_init))
-static guint signals[N_SIGNALS];
-
static const gchar popup_menu_ui[] =
"<popup name=\"BookmarksPopup\" action=\"BookmarksPopupAction\">\n"
" <menuitem name=\"OpenBookmark\" action=\"OpenBookmark\"/>\n"
@@ -224,16 +217,6 @@ ev_sidebar_bookmarks_selection_changed (GtkTreeSelection *selection,
}
static void
-ev_sidebar_bookmarks_add_clicked (GtkWidget *button,
- EvSidebarBookmarks *sidebar_bookmarks)
-{
- /* Let the window add the bookmark since
- * since we don't know the page title
- */
- g_signal_emit (sidebar_bookmarks, signals[ADD_BOOKMARK], 0);
-}
-
-static void
ev_sidebar_bookmarks_del_clicked (GtkWidget *button,
EvSidebarBookmarks *sidebar_bookmarks)
{
@@ -469,9 +452,8 @@ ev_sidebar_bookmarks_init (EvSidebarBookmarks *sidebar_bookmarks)
hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
priv->add_button = gtk_button_new_from_stock (GTK_STOCK_ADD);
- g_signal_connect (priv->add_button, "clicked",
- G_CALLBACK (ev_sidebar_bookmarks_add_clicked),
- sidebar_bookmarks);
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (priv->add_button),
+ "win.add-bookmark");
gtk_widget_set_sensitive (priv->add_button, FALSE);
gtk_box_pack_start (GTK_BOX (hbox), priv->add_button, TRUE, TRUE, 6);
gtk_widget_show (priv->add_button);
@@ -534,16 +516,6 @@ ev_sidebar_bookmarks_class_init (EvSidebarBookmarksClass *klass)
g_type_class_add_private (g_object_class, sizeof (EvSidebarBookmarksPrivate));
g_object_class_override_property (g_object_class, PROP_WIDGET, "main-widget");
-
- signals[ADD_BOOKMARK] =
- g_signal_new ("add-bookmark",
- G_TYPE_FROM_CLASS (g_object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (EvSidebarBookmarksClass, add_bookmark),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0,
- G_TYPE_NONE);
}
GtkWidget *
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index a6fcbde..1383d69 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -29,6 +29,8 @@
#include "ev-stock-icons.h"
#include "ev-zoom-action.h"
#include "ev-history-action.h"
+#include "ev-application.h"
+#include "ev-recent-menu-model.h"
#include <math.h>
enum
@@ -42,6 +44,7 @@ struct _EvToolbarPrivate {
GtkWidget *view_menu_button;
GtkWidget *action_menu_button;
+ GMenu *bookmarks_section;
};
G_DEFINE_TYPE (EvToolbar, ev_toolbar, GTK_TYPE_TOOLBAR)
@@ -64,38 +67,49 @@ ev_toolbar_set_property (GObject *object,
}
static void
-ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
- GtkButton *button,
- GtkAction *action)
+ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
+ GtkButton *button,
+ const gchar *action_name,
+ const gchar *tooltip)
{
- gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);
+ gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
gtk_button_set_label (button, NULL);
gtk_button_set_focus_on_click (button, FALSE);
- gtk_widget_set_tooltip_text (GTK_WIDGET (button), gtk_action_get_tooltip (action));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
}
static GtkWidget *
-ev_toolbar_create_button (EvToolbar *ev_toolbar,
- GtkAction *action)
+ev_toolbar_create_button (EvToolbar *ev_toolbar,
+ const gchar *action_name,
+ const gchar *icon_name,
+ const gchar *tooltip)
{
GtkWidget *button = gtk_button_new ();
+ GtkWidget *image;
+
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
- ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action_name, tooltip);
return button;
}
static GtkWidget *
ev_toolbar_create_toggle_button (EvToolbar *ev_toolbar,
- GtkAction *action)
+ const gchar *action_name,
+ const gchar *icon_name,
+ const gchar *tooltip)
{
GtkWidget *button = gtk_toggle_button_new ();
+ GtkWidget *image;
+
+ image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
- gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
- ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ ev_toolbar_set_button_action (ev_toolbar, GTK_BUTTON (button), action_name, tooltip);
return button;
}
@@ -103,17 +117,21 @@ ev_toolbar_create_toggle_button (EvToolbar *ev_toolbar,
static GtkWidget *
ev_toolbar_create_menu_button (EvToolbar *ev_toolbar,
const gchar *icon_name,
- GtkWidget *menu,
+ GMenuModel *menu,
GtkAlign menu_align)
{
- GtkWidget *button = gtk_menu_button_new ();
+ GtkWidget *button;
+ GtkMenu *popup;
+ button = gtk_menu_button_new ();
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON (button))),
icon_name, GTK_ICON_SIZE_MENU);
- gtk_widget_set_halign (menu, menu_align);
- gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu);
+ gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
+
+ popup = gtk_menu_button_get_popup (GTK_MENU_BUTTON (button));
+ gtk_widget_set_halign (GTK_WIDGET (popup), menu_align);
return button;
}
@@ -134,17 +152,43 @@ ev_toolbar_create_button_group (EvToolbar *ev_toolbar)
}
static void
+ev_toolbar_update_bookmarks (EvToolbar *toolbar)
+{
+ GMenu *bookmarks_section;
+ GMenuModel *bookmarks_submenu;
+
+ /* The bookmarks section has one or two items: "Add Bookmark"
+ * and the "Bookmarks" submenu item. Hide the latter when there
+ * are no bookmarks.
+ */
+
+ bookmarks_section = toolbar->priv->bookmarks_section;
+ bookmarks_submenu = ev_window_get_bookmarks_menu (toolbar->priv->window);
+
+ if (g_menu_model_get_n_items (bookmarks_submenu) > 0) {
+ if (g_menu_model_get_n_items (G_MENU_MODEL (bookmarks_section)) == 1)
+ g_menu_append_submenu (bookmarks_section, _("Bookmarks"), bookmarks_submenu);
+ }
+ else {
+ if (g_menu_model_get_n_items (G_MENU_MODEL (bookmarks_section)) == 2)
+ g_menu_remove (bookmarks_section, 1);
+ }
+}
+
+static void
ev_toolbar_constructed (GObject *object)
{
EvToolbar *ev_toolbar = EV_TOOLBAR (object);
- GtkUIManager *ui_manager;
+ GtkBuilder *builder;
GtkActionGroup *action_group;
GtkWidget *tool_item;
GtkWidget *hbox;
GtkAction *action;
GtkWidget *button;
- GtkWidget *menu;
gboolean rtl;
+ GMenuModel *menu;
+ GMenu *recent_submenu;
+ GMenuModel *recent_menu_model;
G_OBJECT_CLASS (ev_toolbar_parent_class)->constructed (object);
@@ -156,18 +200,18 @@ ev_toolbar_constructed (GObject *object)
GTK_STYLE_CLASS_MENUBAR);
action_group = ev_window_get_main_action_group (ev_toolbar->priv->window);
- ui_manager = ev_window_get_ui_manager (ev_toolbar->priv->window);
+ builder = gtk_builder_new_from_resource ("/org/gnome/evince/shell/ui/menus.ui");
/* Navigation */
hbox = ev_toolbar_create_button_group (ev_toolbar);
- action = gtk_action_group_get_action (action_group, "GoPreviousPage");
- button = ev_toolbar_create_button (ev_toolbar, action);
+ button = ev_toolbar_create_button (ev_toolbar, "win.go-previous-page",
+ "go-up-symbolic", _("Go to the next page"));
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_widget_show (button);
- action = gtk_action_group_get_action (action_group, "GoNextPage");
- button = ev_toolbar_create_button (ev_toolbar, action);
+ button = ev_toolbar_create_button (ev_toolbar, "win.go-next-page",
+ "go-down-symbolic", _("Go to the previous page"));
gtk_container_add (GTK_CONTAINER (hbox), button);
gtk_widget_show (button);
@@ -209,8 +253,8 @@ ev_toolbar_constructed (GObject *object)
gtk_widget_show (tool_item);
/* Find */
- action = gtk_action_group_get_action (action_group, "EditFind");
- button = ev_toolbar_create_toggle_button (ev_toolbar, action);
+ button = ev_toolbar_create_toggle_button (ev_toolbar, "win.find", "edit-find-symbolic",
+ _("Find a word or phrase in the document"));
tool_item = GTK_WIDGET (gtk_tool_item_new ());
gtk_container_add (GTK_CONTAINER (tool_item), button);
gtk_widget_show (button);
@@ -232,7 +276,7 @@ ev_toolbar_constructed (GObject *object)
gtk_widget_show (tool_item);
/* View Menu */
- menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenuPopup");
+ menu = G_MENU_MODEL (gtk_builder_get_object (builder, "view-menu"));
button = ev_toolbar_create_menu_button (ev_toolbar, "document-properties-symbolic",
menu, GTK_ALIGN_END);
gtk_widget_set_tooltip_text (button, _("View options"));
@@ -249,7 +293,7 @@ ev_toolbar_constructed (GObject *object)
gtk_widget_show (tool_item);
/* Action Menu */
- menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu");
+ menu = G_MENU_MODEL (gtk_builder_get_object (builder, "action-menu"));
button = ev_toolbar_create_menu_button (ev_toolbar, "emblem-system-symbolic",
menu, GTK_ALIGN_END);
gtk_widget_set_tooltip_text (button, _("File options"));
@@ -260,6 +304,21 @@ ev_toolbar_constructed (GObject *object)
gtk_container_add (GTK_CONTAINER (ev_toolbar), tool_item);
gtk_widget_show (tool_item);
+
+ recent_menu_model = ev_recent_menu_model_new (gtk_recent_manager_get_default (),
+ "app.open-file",
+ g_get_application_name ());
+
+ recent_submenu = G_MENU (gtk_builder_get_object (builder, "recent"));
+ g_menu_append_section (recent_submenu, NULL, recent_menu_model);
+
+ ev_toolbar->priv->bookmarks_section = G_MENU (gtk_builder_get_object (builder, "bookmarks"));
+ g_signal_connect_swapped (ev_window_get_bookmarks_menu (ev_toolbar->priv->window), "items-changed",
+ G_CALLBACK (ev_toolbar_update_bookmarks), ev_toolbar);
+ ev_toolbar_update_bookmarks (ev_toolbar);
+
+ g_object_unref (recent_menu_model);
+ g_object_unref (builder);
}
static void
diff --git a/shell/ev-utils.c b/shell/ev-utils.c
index 760a8e9..cf42561 100644
--- a/shell/ev-utils.c
+++ b/shell/ev-utils.c
@@ -478,5 +478,4 @@ ev_file_chooser_restore_folder (GtkFileChooser *file_chooser,
}
g_free (folder_uri);
- g_free (parent_uri);
}
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 43a0034..388bbda 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -87,10 +87,10 @@
#include "ev-print-operation.h"
#include "ev-progress-message-area.h"
#include "ev-annotation-properties-dialog.h"
-#include "ev-bookmarks.h"
#include "ev-bookmark-action.h"
#include "ev-zoom-action.h"
#include "ev-toolbar.h"
+#include "ev-bookmarks.h"
#ifdef ENABLE_DBUS
#include "ev-gdbus-generated.h"
@@ -175,8 +175,6 @@ struct _EvWindowPrivate {
GtkActionGroup *attachment_popup_action_group;
GtkActionGroup *zoom_selector_popup_action_group;
GtkRecentManager *recent_manager;
- GtkActionGroup *recent_action_group;
- guint recent_ui_id;
GtkActionGroup *bookmarks_action_group;
guint bookmarks_ui_id;
GtkUIManager *ui_manager;
@@ -206,6 +204,7 @@ struct _EvWindowPrivate {
EvWindowTitle *title;
EvMetadata *metadata;
EvBookmarks *bookmarks;
+ GMenu *bookmarks_menu;
/* Load params */
EvLinkDest *dest;
@@ -326,13 +325,9 @@ static void ev_window_add_recent (EvWindow *windo
static void ev_window_run_fullscreen (EvWindow *window);
static void ev_window_stop_fullscreen (EvWindow *window,
gboolean unfullscreen_window);
-static void ev_window_cmd_view_fullscreen (GtkAction *action,
- EvWindow *window);
static void ev_window_run_presentation (EvWindow *window);
static void ev_window_stop_presentation (EvWindow *window,
gboolean unfullscreen_window);
-static void ev_window_cmd_view_presentation (GtkAction *action,
- EvWindow *window);
static void ev_view_popup_cmd_open_link (GtkAction *action,
EvWindow *window);
static void ev_view_popup_cmd_open_link_new_window (GtkAction *action,
@@ -359,8 +354,6 @@ static void view_handle_link_cb (EvView *view,
EvLink *link,
EvWindow *window);
static void ev_window_update_find_status_message (EvWindow *ev_window);
-static void ev_window_cmd_edit_find (GtkAction *action,
- EvWindow *ev_window);
static void find_bar_search_changed_cb (EggFindBar *find_bar,
GParamSpec *param,
EvWindow *ev_window);
@@ -395,6 +388,17 @@ get_screen_dpi (EvWindow *window)
}
static void
+ev_window_set_action_enabled (EvWindow *ev_window,
+ const char *name,
+ gboolean enabled)
+{
+ GAction *action;
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (ev_window), name);
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled);
+}
+
+static void
ev_window_set_action_sensitive (EvWindow *ev_window,
const char *name,
gboolean sensitive)
@@ -462,33 +466,31 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
}
/* File menu */
- ev_window_set_action_sensitive (ev_window, "FileOpenCopy", has_document);
- ev_window_set_action_sensitive (ev_window, "FileSaveAs", has_document && ok_to_copy);
- ev_window_set_action_sensitive (ev_window, "FilePrint", has_pages && ok_to_print);
- ev_window_set_action_sensitive (ev_window, "FileProperties", has_document && has_properties);
- ev_window_set_action_sensitive (ev_window, "FileOpenContainingFolder", has_document);
- ev_window_set_action_sensitive (ev_window, "FileSendTo",
- has_document && ev_window->priv->has_mailto_handler);
- ev_window_set_action_sensitive (ev_window, "ViewPresentation", has_document);
+ ev_window_set_action_enabled (ev_window, "open-copy", has_document);
+ ev_window_set_action_enabled (ev_window, "save-copy", has_document && ok_to_copy);
+ ev_window_set_action_enabled (ev_window, "print", has_pages && ok_to_print);
+ ev_window_set_action_enabled (ev_window, "show-properties", has_document && has_properties);
+ ev_window_set_action_enabled (ev_window, "open-containing-folder", has_document);
+ ev_window_set_action_enabled (ev_window, "send-to",
+ has_document && ev_window->priv->has_mailto_handler);
+ ev_window_set_action_enabled (ev_window, "presentation", has_document);
/* Edit menu */
- ev_window_set_action_sensitive (ev_window, "EditSelectAll", has_pages && can_get_text);
- ev_window_set_action_sensitive (ev_window, "EditFind", can_find);
- ev_window_set_action_sensitive (ev_window, "Slash", can_find);
- ev_window_set_action_sensitive (ev_window, "CtrlF", can_find);
- ev_window_set_action_sensitive (ev_window, "EditRotateLeft", has_pages);
- ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages);
+ ev_window_set_action_enabled (ev_window, "select-all", has_pages && can_get_text);
+ ev_window_set_action_enabled (ev_window, "find", can_find);
+ ev_window_set_action_enabled (ev_window, "rotate-left", has_pages);
+ ev_window_set_action_enabled (ev_window, "rotate-right", has_pages);
/* View menu */
- ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages);
- ev_window_set_action_sensitive (ev_window, "ViewDual", has_pages);
- ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", has_pages);
- ev_window_set_action_sensitive (ev_window, "ViewReload", has_pages);
- ev_window_set_action_sensitive (ev_window, "ViewAutoscroll", has_pages);
- ev_window_set_action_sensitive (ev_window, "ViewInvertedColors", has_pages);
+ ev_window_set_action_enabled (ev_window, "continuous", has_pages);
+ ev_window_set_action_enabled (ev_window, "dual-page", has_pages);
+ ev_window_set_action_enabled (ev_window, "dual-odd-left", has_pages);
+ ev_window_set_action_enabled (ev_window, "reload", has_pages);
+ ev_window_set_action_enabled (ev_window, "auto-scroll", has_pages);
+ ev_window_set_action_enabled (ev_window, "inverted-colors", has_pages);
/* Bookmarks menu */
- ev_window_set_action_sensitive (ev_window, "BookmarksAdd",
+ ev_window_set_action_enabled (ev_window, "add-bookmark",
has_pages && ev_window->priv->bookmarks);
/* Toolbar-specific actions: */
@@ -506,62 +508,58 @@ ev_window_update_actions_sensitivity (EvWindow *ev_window)
gboolean has_pages = FALSE;
gboolean presentation_mode;
gboolean can_find_in_page = FALSE;
- gboolean dual_mode = FALSE;
if (ev_window->priv->document) {
page = ev_document_model_get_page (ev_window->priv->model);
n_pages = ev_document_get_n_pages (ev_window->priv->document);
has_pages = n_pages > 0;
- dual_mode = ev_document_model_get_dual_page (ev_window->priv->model);
}
can_find_in_page = (ev_window->priv->find_job &&
ev_job_find_has_results (EV_JOB_FIND (ev_window->priv->find_job)));
- ev_window_set_action_sensitive (ev_window, "EditCopy",
+ ev_window_set_action_enabled (ev_window, "copy",
has_pages &&
ev_view_get_has_selection (view));
- ev_window_set_action_sensitive (ev_window, "CtrlG",
- has_pages && can_find_in_page);
- ev_window_set_action_sensitive (ev_window, "ShiftCtrlG",
- has_pages && can_find_in_page);
- ev_window_set_action_sensitive (ev_window, "F3",
- has_pages && can_find_in_page);
+ ev_window_set_action_enabled (ev_window, "find-next",
+ has_pages && can_find_in_page);
+ ev_window_set_action_enabled (ev_window, "find-previous",
+ has_pages && can_find_in_page);
presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window);
- ev_window_set_action_sensitive (ev_window, "ViewZoomIn",
- has_pages &&
- ev_view_can_zoom_in (view) &&
- !presentation_mode);
- ev_window_set_action_sensitive (ev_window, "ViewZoomOut",
- has_pages &&
- ev_view_can_zoom_out (view) &&
- !presentation_mode);
- ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", dual_mode);
+ ev_window_set_action_enabled (ev_window, "zoom-in",
+ has_pages &&
+ ev_view_can_zoom_in (view) &&
+ !presentation_mode);
+ ev_window_set_action_enabled (ev_window, "zoom-out",
+ has_pages &&
+ ev_view_can_zoom_out (view) &&
+ !presentation_mode);
+ // ev_window_set_action_sensitive (ev_window, "ViewDualOddLeft", dual_mode);
/* Go menu */
if (has_pages) {
- ev_window_set_action_sensitive (ev_window, "GoPreviousPage", page > 0);
- ev_window_set_action_sensitive (ev_window, "GoNextPage", page < n_pages - 1);
- ev_window_set_action_sensitive (ev_window, "GoFirstPage", page > 0);
- ev_window_set_action_sensitive (ev_window, "GoLastPage", page < n_pages - 1);
- ev_window_set_action_sensitive (ev_window, "GoToPage", TRUE);
+ ev_window_set_action_enabled (ev_window, "go-previous-page", page > 0);
+ ev_window_set_action_enabled (ev_window, "go-next-page", page < n_pages - 1);
+ ev_window_set_action_enabled (ev_window, "go-first-page", page > 0);
+ ev_window_set_action_enabled (ev_window, "go-last-page", page < n_pages - 1);
+ ev_window_set_action_enabled (ev_window, "select-page", TRUE);
} else {
- ev_window_set_action_sensitive (ev_window, "GoFirstPage", FALSE);
- ev_window_set_action_sensitive (ev_window, "GoPreviousPage", FALSE);
- ev_window_set_action_sensitive (ev_window, "GoNextPage", FALSE);
- ev_window_set_action_sensitive (ev_window, "GoLastPage", FALSE);
- ev_window_set_action_sensitive (ev_window, "GoToPage", FALSE);
+ ev_window_set_action_enabled (ev_window, "go-first-page", FALSE);
+ ev_window_set_action_enabled (ev_window, "go-previous-page", FALSE);
+ ev_window_set_action_enabled (ev_window, "go-next-page", FALSE);
+ ev_window_set_action_enabled (ev_window, "go-last-page", FALSE);
+ ev_window_set_action_enabled (ev_window, "select-page", FALSE);
}
ev_window_set_action_sensitive (ev_window, "History",
!ev_history_is_frozen (ev_window->priv->history));
- ev_window_set_action_sensitive (ev_window, "F7",
- has_pages &&
- ev_view_supports_caret_navigation (view) &&
- !presentation_mode);
+ ev_window_set_action_enabled (ev_window, "caret-navigation",
+ has_pages &&
+ ev_view_supports_caret_navigation (view) &&
+ !presentation_mode);
}
static void
@@ -891,7 +889,7 @@ static void
view_selection_changed_cb (EvView *view,
EvWindow *window)
{
- ev_window_set_action_sensitive (window, "EditCopy",
+ ev_window_set_action_enabled (window, "copy",
ev_view_get_has_selection (view));
}
@@ -2410,26 +2408,13 @@ ev_window_open_copy_at_dest (EvWindow *window,
}
static void
-ev_window_cmd_file_open_copy (GtkAction *action, EvWindow *window)
-{
- ev_window_open_copy_at_dest (window, NULL);
-}
-
-static void
-ev_window_cmd_recent_file_activate (GtkAction *action,
- EvWindow *window)
+ev_window_activate_open_copy_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GtkRecentInfo *info;
- const gchar *uri;
+ EvWindow *window = user_data;
- info = g_object_get_data (G_OBJECT (action), "gtk-recent-info");
- g_assert (info != NULL);
-
- uri = gtk_recent_info_get_uri (info);
-
- ev_application_open_uri_at_dest (EV_APP, uri,
- gtk_window_get_screen (GTK_WINDOW (window)),
- NULL, 0, NULL, gtk_get_current_event_time ());
+ ev_window_open_copy_at_dest (window, NULL);
}
static void
@@ -2448,185 +2433,6 @@ ev_window_add_recent (EvWindow *window, const char *filename)
gtk_recent_manager_add_item (window->priv->recent_manager, filename);
}
-static gint
-compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b)
-{
- gboolean has_ev_a, has_ev_b;
- const gchar *evince = g_get_application_name ();
-
- has_ev_a = gtk_recent_info_has_application (a, evince);
- has_ev_b = gtk_recent_info_has_application (b, evince);
-
- if (has_ev_a && has_ev_b) {
- time_t time_a, time_b;
-
- time_a = gtk_recent_info_get_modified (a);
- time_b = gtk_recent_info_get_modified (b);
-
- return (time_b - time_a);
- } else if (has_ev_a) {
- return -1;
- } else if (has_ev_b) {
- return 1;
- }
-
- return 0;
-}
-
-/*
- * Doubles underscore to avoid spurious menu accels.
- */
-static gchar *
-ev_window_get_recent_file_label (gint index, const gchar *filename)
-{
- GString *str;
- gint length;
- const gchar *p;
- const gchar *end;
- gboolean is_rtl;
-
- is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- length = strlen (filename);
- str = g_string_sized_new (length + 10);
- g_string_printf (str, "%s_%d. ", is_rtl ? "\xE2\x80\x8F" : "", index);
-
- p = filename;
- end = filename + length;
-
- while (p != end) {
- const gchar *next;
- next = g_utf8_next_char (p);
-
- switch (*p) {
- case '_':
- g_string_append (str, "__");
- break;
- default:
- g_string_append_len (str, p, next - p);
- break;
- }
-
- p = next;
- }
-
- return g_string_free (str, FALSE);
-}
-
-static void
-ev_window_recent_action_connect_proxy_cb (GtkActionGroup *action_group,
- GtkAction *action,
- GtkWidget *proxy,
- gpointer data)
-{
- GtkLabel *label;
-
- if (!GTK_IS_MENU_ITEM (proxy))
- return;
-
- label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (proxy)));
-
- gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_MIDDLE);
- gtk_label_set_max_width_chars (label, MAX_RECENT_ITEM_LEN);
-}
-
-static void
-ev_window_setup_recent (EvWindow *ev_window)
-{
- GList *items, *l;
- guint n_items = 0;
- const gchar *evince = g_get_application_name ();
- static guint i = 0;
-
- if (ev_window->priv->recent_ui_id > 0) {
- gtk_ui_manager_remove_ui (ev_window->priv->ui_manager,
- ev_window->priv->recent_ui_id);
- gtk_ui_manager_ensure_update (ev_window->priv->ui_manager);
- }
- ev_window->priv->recent_ui_id = gtk_ui_manager_new_merge_id (ev_window->priv->ui_manager);
-
- if (ev_window->priv->recent_action_group) {
- gtk_ui_manager_remove_action_group (ev_window->priv->ui_manager,
- ev_window->priv->recent_action_group);
- g_object_unref (ev_window->priv->recent_action_group);
- }
- ev_window->priv->recent_action_group = gtk_action_group_new ("RecentFilesActions");
- g_signal_connect (ev_window->priv->recent_action_group, "connect-proxy",
- G_CALLBACK (ev_window_recent_action_connect_proxy_cb), NULL);
-
- gtk_ui_manager_insert_action_group (ev_window->priv->ui_manager,
- ev_window->priv->recent_action_group, -1);
-
- items = gtk_recent_manager_get_items (ev_window->priv->recent_manager);
- items = g_list_sort (items, (GCompareFunc) compare_recent_items);
-
- for (l = items; l && l->data; l = g_list_next (l)) {
- GtkRecentInfo *info;
- GtkAction *action;
- gchar *action_name;
- gchar *label;
- const gchar *mime_type;
- gchar *content_type;
- GIcon *icon = NULL;
-
- info = (GtkRecentInfo *) l->data;
-
- if (!gtk_recent_info_has_application (info, evince))
- continue;
-
- action_name = g_strdup_printf ("RecentFile%u", i++);
- label = ev_window_get_recent_file_label (
- n_items + 1, gtk_recent_info_get_display_name (info));
-
- mime_type = gtk_recent_info_get_mime_type (info);
- content_type = g_content_type_from_mime_type (mime_type);
- if (content_type != NULL) {
- icon = g_content_type_get_icon (content_type);
- g_free (content_type);
- }
-
- action = g_object_new (GTK_TYPE_ACTION,
- "name", action_name,
- "label", label,
- "gicon", icon,
- "always-show-image", TRUE,
- NULL);
-
- g_object_set_data_full (G_OBJECT (action),
- "gtk-recent-info",
- gtk_recent_info_ref (info),
- (GDestroyNotify) gtk_recent_info_unref);
-
- g_signal_connect (action, "activate",
- G_CALLBACK (ev_window_cmd_recent_file_activate),
- (gpointer) ev_window);
-
- gtk_action_group_add_action (ev_window->priv->recent_action_group,
- action);
- g_object_unref (action);
-
- gtk_ui_manager_add_ui (ev_window->priv->ui_manager,
- ev_window->priv->recent_ui_id,
- "/ActionMenu/RecentFilesMenu/RecentFiles",
- label,
- action_name,
- GTK_UI_MANAGER_MENUITEM,
- FALSE);
- g_free (action_name);
- g_free (label);
- if (icon != NULL)
- g_object_unref (icon);
-
- if (++n_items == 5)
- break;
- }
-
- g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
- g_list_free (items);
-}
-
static gboolean
show_saving_progress (GFile *dst)
{
@@ -2840,7 +2646,7 @@ file_save_dialog_response_cb (GtkWidget *fc,
}
static void
-ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
+ev_window_save_copy (EvWindow *ev_window)
{
GtkWidget *fc;
gchar *base_name;
@@ -2880,9 +2686,21 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_send_to (GtkAction *action,
- EvWindow *ev_window)
+ev_window_activate_save_copy_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ EvWindow *window = user_data;
+
+ ev_window_save_copy (window);
+}
+
+static void
+ev_window_activate_send_to_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
GAppInfo *app_info;
gchar *command;
const char *uri;
@@ -2917,8 +2735,11 @@ ev_window_cmd_send_to (GtkAction *action,
}
static void
-ev_window_cmd_open_containing_folder (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_open_containing_folder_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
GtkWidget *ev_window_widget;
GFile *file;
GFile *parent;
@@ -3454,14 +3275,22 @@ ev_window_print (EvWindow *window)
}
static void
-ev_window_cmd_file_print (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_print_action (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
+
ev_window_print (ev_window);
}
static void
-ev_window_cmd_file_properties (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_show_properties_action (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
+
if (ev_window->priv->properties == NULL) {
ev_window->priv->properties = ev_properties_dialog_new ();
ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
@@ -3487,7 +3316,7 @@ document_modified_confirmation_dialog_response (GtkDialog *dialog,
switch (response) {
case GTK_RESPONSE_YES:
- ev_window_cmd_save_as (NULL, ev_window);
+ ev_window_save_copy (ev_window);
break;
case GTK_RESPONSE_NO:
gtk_widget_destroy (GTK_WIDGET (ev_window));
@@ -3688,64 +3517,81 @@ ev_window_close (EvWindow *ev_window)
}
static void
-ev_window_cmd_file_close_window (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_close_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
+
if (ev_window_close (ev_window))
gtk_widget_destroy (GTK_WIDGET (ev_window));
}
static void
-ev_window_cmd_focus_page_selector (GtkAction *act, EvWindow *window)
+ev_window_activate_select_page_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GtkAction *action;
-
+ EvWindow *window = user_data;
+
update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, TRUE);
update_chrome_visibility (window);
-
- action = gtk_action_group_get_action (window->priv->action_group,
- PAGE_SELECTOR_ACTION);
- ev_page_action_grab_focus (EV_PAGE_ACTION (action));
}
static void
-ev_window_cmd_scroll_forward (GtkAction *action, EvWindow *window)
+ev_window_activate_scroll_forward_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
+
g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_FORWARD,
GTK_ORIENTATION_VERTICAL);
}
static void
-ev_window_cmd_scroll_backward (GtkAction *action, EvWindow *window)
+ev_window_activate_scroll_backwards_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
+
g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_BACKWARD,
GTK_ORIENTATION_VERTICAL);
}
static void
-ev_window_cmd_continuous (GtkAction *action, EvWindow *ev_window)
+ev_window_change_continuous_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean continuous;
+ EvWindow *window = user_data;
- ev_window_stop_presentation (ev_window, TRUE);
- continuous = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- ev_document_model_set_continuous (ev_window->priv->model, continuous);
+ ev_window_stop_presentation (window, TRUE);
+ ev_document_model_set_continuous (window->priv->model, g_variant_get_boolean (state));
+ g_simple_action_set_state (action, state);
}
static void
-ev_window_cmd_dual (GtkAction *action, EvWindow *ev_window)
+ev_window_change_dual_page_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean dual_page;
+ EvWindow *window = user_data;
- ev_window_stop_presentation (ev_window, TRUE);
- dual_page = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- ev_document_model_set_dual_page (ev_window->priv->model, dual_page);
+ ev_window_stop_presentation (window, TRUE);
+ ev_document_model_set_dual_page (window->priv->model, g_variant_get_boolean (state));
+ g_simple_action_set_state (action, state);
}
static void
-ev_window_cmd_dual_odd_pages_left (GtkAction *action, EvWindow *ev_window)
+ev_window_change_dual_odd_left_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean dual_page_odd_left;
+ EvWindow *window = user_data;
- dual_page_odd_left = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- ev_document_model_set_dual_page_odd_pages_left (ev_window->priv->model, dual_page_odd_left);
+ ev_document_model_set_dual_page_odd_pages_left (window->priv->model,
+ g_variant_get_boolean (state));
+ g_simple_action_set_state (action, state);
}
static void
@@ -3762,9 +3608,27 @@ ev_window_cmd_view_fit_page (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_fit_page (GtkAction *action, EvWindow *ev_window)
+ev_window_change_sizing_mode_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FIT_PAGE);
+ EvWindow *window = user_data;
+ const gchar *mode;
+
+ mode = g_variant_get_string (state, NULL);
+
+ if (g_str_equal (mode, "fit-page"))
+ ev_document_model_set_sizing_mode (window->priv->model, EV_SIZING_FIT_PAGE);
+ else if (g_str_equal (mode, "fit-width"))
+ ev_document_model_set_sizing_mode (window->priv->model, EV_SIZING_FIT_WIDTH);
+ else if (g_str_equal (mode, "automatic"))
+ ev_document_model_set_sizing_mode (window->priv->model, EV_SIZING_AUTOMATIC);
+ else if (g_str_equal (mode, "free"))
+ ev_document_model_set_sizing_mode (window->priv->model, EV_SIZING_FREE);
+ else
+ g_assert_not_reached ();
+
+ g_simple_action_set_state (action, state);
}
static void
@@ -3781,12 +3645,6 @@ ev_window_cmd_view_fit_width (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_fit_width (GtkAction *action, EvWindow *ev_window)
-{
- ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FIT_WIDTH);
-}
-
-static void
ev_window_cmd_view_zoom_automatic (GtkAction *action,
EvWindow *ev_window)
{
@@ -3822,29 +3680,28 @@ ev_window_cmd_view_zoom_activate (GtkAction *action,
}
static void
-ev_window_cmd_edit_select_all (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_select_all_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *ev_window = user_data;
ev_view_select_all (EV_VIEW (ev_window->priv->view));
}
static void
-ev_window_cmd_toggle_find (GtkAction *action, EvWindow *ev_window)
+ev_window_change_find_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean show_find_bar;
+ EvWindow *ev_window = user_data;
- show_find_bar = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (show_find_bar)
+ if (g_variant_get_boolean (state))
ev_window_show_find_bar (ev_window, TRUE);
else
ev_window_close_find_bar (ev_window);
-}
-static void
-ev_window_cmd_edit_find (GtkAction *action, EvWindow *ev_window)
-{
- ev_window_show_find_bar (ev_window, TRUE);
+ g_simple_action_set_state (action, state);
}
static void
@@ -3879,8 +3736,11 @@ find_next_idle_cb (EvWindow *ev_window)
}
static void
-ev_window_cmd_edit_find_next (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_find_next_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
gboolean find_bar_hidden;
if (EV_WINDOW_IS_PRESENTATION (ev_window))
@@ -3904,8 +3764,11 @@ find_previous_idle_cb (EvWindow *ev_window)
}
static void
-ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_find_previous_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
gboolean find_bar_hidden;
if (EV_WINDOW_IS_PRESENTATION (ev_window))
@@ -3922,9 +3785,11 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_copy_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *ev_window = user_data;
ev_view_copy (EV_VIEW (ev_window->priv->view));
}
@@ -3942,15 +3807,12 @@ ev_window_sidebar_position_change_cb (GObject *object,
static void
ev_window_update_fullscreen_action (EvWindow *window)
{
- GtkAction *action;
+ GAction *action;
+ gboolean fullscreen;
- action = gtk_action_group_get_action (window->priv->action_group, "ViewFullscreen");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_fullscreen (window->priv->model));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_view_fullscreen), window);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "fullscreen");
+ fullscreen = ev_document_model_get_fullscreen (window->priv->model);
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (fullscreen));
}
static void
@@ -4167,16 +4029,19 @@ ev_window_stop_fullscreen (EvWindow *window,
}
static void
-ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *window)
+ev_window_change_fullscreen_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean fullscreen;
+ EvWindow *window = user_data;
- fullscreen = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (fullscreen) {
+ if (g_variant_get_boolean (state)) {
ev_window_run_fullscreen (window);
} else {
ev_window_stop_fullscreen (window, TRUE);
}
+
+ g_simple_action_set_state (action, state);
}
static void
@@ -4211,15 +4076,11 @@ ev_window_uninhibit_screensaver (EvWindow *window)
static void
ev_window_update_presentation_action (EvWindow *window)
{
- GtkAction *action;
+ GAction *action;
- action = gtk_action_group_get_action (window->priv->action_group, "ViewPresentation");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_view_presentation), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- EV_WINDOW_IS_PRESENTATION (window));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_view_presentation), window);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "presentation");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action),
+ g_variant_new_boolean (EV_WINDOW_IS_PRESENTATION (window)));
}
static void
@@ -4334,14 +4195,17 @@ ev_window_stop_presentation (EvWindow *window,
}
static void
-ev_window_cmd_view_presentation (GtkAction *action, EvWindow *window)
+ev_window_change_presentation_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean presentation;
+ EvWindow *window = user_data;
- presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (presentation) {
+ if (g_variant_get_boolean (state)) {
ev_window_run_presentation (window);
}
+
+ g_simple_action_set_state (action, state);
}
static gboolean
@@ -4405,10 +4269,12 @@ ev_window_set_page_mode (EvWindow *window,
ev_window_update_actions_sensitivity (window);
}
-
static void
-ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_rotate_left_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
gint rotation;
if (EV_WINDOW_IS_PRESENTATION (ev_window)) {
@@ -4423,8 +4289,11 @@ ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_rotate_right_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
gint rotation;
if (EV_WINDOW_IS_PRESENTATION (ev_window)) {
@@ -4439,16 +4308,23 @@ ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_view_inverted_colors (GtkAction *action, EvWindow *ev_window)
+ev_window_change_inverted_colors_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- gboolean inverted_colors = ev_document_model_get_inverted_colors (ev_window->priv->model);
+ EvWindow *ev_window = user_data;
- ev_document_model_set_inverted_colors (ev_window->priv->model, !inverted_colors);
+ ev_document_model_set_inverted_colors (ev_window->priv->model,
+ g_variant_get_boolean (state));
+ g_simple_action_set_state (action, state);
}
static void
-ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_save_settings_action (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
EvWindowPrivate *priv = ev_window->priv;
EvDocumentModel *model = priv->model;
GSettings *settings = priv->default_settings;
@@ -4457,7 +4333,7 @@ ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
g_settings_set_boolean (settings, "continuous",
ev_document_model_get_continuous (model));
g_settings_set_boolean (settings, "dual-page",
- ev_document_model_get_dual_page (model));
+ ev_document_model_get_dual_page (model));
g_settings_set_boolean (settings, "dual-page-odd-left",
ev_document_model_get_dual_page_odd_pages_left (model));
g_settings_set_boolean (settings, "fullscreen",
@@ -4482,59 +4358,78 @@ ev_window_cmd_edit_save_settings (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_view_zoom_in (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_zoom_in_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *ev_window = user_data;
+
+ g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
ev_view_zoom_in (EV_VIEW (ev_window->priv->view));
}
static void
-ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_zoom_out_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *ev_window = user_data;
+
+ g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_document_model_set_sizing_mode (ev_window->priv->model, EV_SIZING_FREE);
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
}
static void
-ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_previous_page_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *window = user_data;
- ev_view_previous_page (EV_VIEW (ev_window->priv->view));
+ ev_view_previous_page (EV_VIEW (window->priv->view));
}
static void
-ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_next_page_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *window = user_data;
- ev_view_next_page (EV_VIEW (ev_window->priv->view));
+ ev_view_next_page (EV_VIEW (window->priv->view));
}
static void
-ev_window_cmd_go_first_page (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_first_page_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *window = user_data;
- ev_document_model_set_page (ev_window->priv->model, 0);
+ ev_document_model_set_page (window->priv->model, 0);
}
static void
-ev_window_cmd_go_last_page (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_last_page_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+ EvWindow *window = user_data;
- ev_document_model_set_page (ev_window->priv->model,
- ev_document_get_n_pages (ev_window->priv->document) - 1);
+ ev_document_model_set_page (window->priv->model,
+ ev_document_get_n_pages (window->priv->document) - 1);
}
static void
-ev_window_cmd_go_forward (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_forward_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
int n_pages, current_page;
g_return_if_fail (EV_IS_WINDOW (ev_window));
@@ -4548,11 +4443,14 @@ ev_window_cmd_go_forward (GtkAction *action, EvWindow *ev_window)
}
static void
-ev_window_cmd_go_backward (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_go_backward_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
int current_page;
-
- g_return_if_fail (EV_IS_WINDOW (ev_window));
+
+ g_return_if_fail (EV_IS_WINDOW (ev_window));
current_page = ev_document_model_get_page (ev_window->priv->model);
@@ -4561,15 +4459,6 @@ ev_window_cmd_go_backward (GtkAction *action, EvWindow *ev_window)
}
}
-static void
-ev_window_cmd_bookmark_activate (GtkAction *action,
- EvWindow *window)
-{
- guint page = ev_bookmark_action_get_page (EV_BOOKMARK_ACTION (action));
-
- ev_document_model_set_page (window->priv->model, page);
-}
-
static gint
compare_bookmarks (EvBookmark *a,
EvBookmark *b)
@@ -4580,59 +4469,33 @@ compare_bookmarks (EvBookmark *a,
static void
ev_window_setup_bookmarks (EvWindow *window)
{
- GList *items, *l;
-
- if (!window->priv->bookmarks)
- return;
-
- if (window->priv->bookmarks_ui_id > 0) {
- gtk_ui_manager_remove_ui (window->priv->ui_manager,
- window->priv->bookmarks_ui_id);
- gtk_ui_manager_ensure_update (window->priv->ui_manager);
- }
- window->priv->bookmarks_ui_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
+ GList *items, *it;
- if (window->priv->bookmarks_action_group) {
- gtk_ui_manager_remove_action_group (window->priv->ui_manager,
- window->priv->bookmarks_action_group);
- g_object_unref (window->priv->bookmarks_action_group);
- }
- window->priv->bookmarks_action_group = gtk_action_group_new ("BookmarksActions");
- gtk_ui_manager_insert_action_group (window->priv->ui_manager,
- window->priv->bookmarks_action_group, -1);
+ g_menu_remove_all (window->priv->bookmarks_menu);
- items = ev_bookmarks_get_bookmarks (window->priv->bookmarks);
- items = g_list_sort (items, (GCompareFunc)compare_bookmarks);
+ items = g_list_sort (ev_bookmarks_get_bookmarks (window->priv->bookmarks),
+ (GCompareFunc) compare_bookmarks);
- for (l = items; l && l->data; l = g_list_next (l)) {
- EvBookmark *bm = (EvBookmark *)l->data;
- GtkAction *action;
+ for (it = items; it; it = it->next) {
+ EvBookmark *bookmark = it->data;
+ GMenuItem *item;
- action = ev_bookmark_action_new (bm);
- g_signal_connect (action, "activate",
- G_CALLBACK (ev_window_cmd_bookmark_activate),
- window);
- gtk_action_group_add_action (window->priv->bookmarks_action_group,
- action);
+ item = g_menu_item_new (bookmark->title, NULL);
+ g_menu_item_set_action_and_target (item, "win.goto-bookmark", "u", bookmark->page);
+ g_menu_append_item (window->priv->bookmarks_menu, item);
- gtk_ui_manager_add_ui (window->priv->ui_manager,
- window->priv->bookmarks_ui_id,
- "/ActionMenu/BookmarksMenu/BookmarksItems",
- gtk_action_get_label (action),
- gtk_action_get_name (action),
- GTK_UI_MANAGER_MENUITEM,
- FALSE);
-
- g_object_unref (action);
+ g_object_unref (item);
}
g_list_free (items);
}
static void
-ev_window_cmd_bookmarks_add (GtkAction *action,
- EvWindow *window)
+ev_window_activate_add_bookmark_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
EvBookmark bm;
gchar *page_label;
@@ -4646,32 +4509,41 @@ ev_window_cmd_bookmarks_add (GtkAction *action,
}
static void
-ev_window_cmd_view_reload (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_goto_bookmark_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- ev_window_reload_document (ev_window, NULL);
-}
+ EvWindow *window = user_data;
-static void
-ev_window_cmd_view_autoscroll (GtkAction *action, EvWindow *ev_window)
-{
- ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
+ ev_document_model_set_page (window->priv->model, g_variant_get_uint32 (parameter));
}
static void
-ev_window_cmd_leave_fullscreen (GtkAction *action, EvWindow *window)
+ev_window_activate_reload_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- ev_window_stop_fullscreen (window, TRUE);
+ EvWindow *ev_window = user_data;
+
+ ev_window_reload_document (ev_window, NULL);
}
static void
-ev_window_cmd_start_presentation (GtkAction *action, EvWindow *window)
+ev_window_activate_auto_scroll_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- ev_window_run_presentation (window);
+ EvWindow *ev_window = user_data;
+
+ ev_view_autoscroll_start (EV_VIEW (ev_window->priv->view));
}
static void
-ev_window_cmd_escape (GtkAction *action, EvWindow *window)
+ev_window_activate_escape_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
ev_view_autoscroll_stop (EV_VIEW (window->priv->view));
if (gtk_widget_get_visible (window->priv->find_bar))
@@ -4765,29 +4637,20 @@ ev_window_max_zoom_changed_cb (EvDocumentModel *model, GParamSpec *pspec, EvWind
}
static void
-ev_window_update_continuous_action (EvWindow *window)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->action_group, "ViewContinuous");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_continuous), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_continuous (window->priv->model));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_continuous), window);
-}
-
-static void
ev_window_continuous_changed_cb (EvDocumentModel *model,
GParamSpec *pspec,
EvWindow *ev_window)
{
- ev_window_update_continuous_action (ev_window);
+ gboolean continuous;
+ GAction *action;
+
+ continuous = ev_document_model_get_continuous (model);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (ev_window), "continuous");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (continuous));
if (ev_window->priv->metadata && !ev_window_is_empty (ev_window))
- ev_metadata_set_boolean (ev_window->priv->metadata, "continuous",
- ev_document_model_get_continuous (model));
+ ev_metadata_set_boolean (ev_window->priv->metadata, "continuous", continuous);
}
static void
@@ -4805,27 +4668,16 @@ ev_window_rotation_changed_cb (EvDocumentModel *model,
}
static void
-ev_window_update_inverted_colors_action (EvWindow *window)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->action_group, "ViewInvertedColors");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_view_inverted_colors), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_inverted_colors (window->priv->model));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_view_inverted_colors), window);
-}
-
-static void
ev_window_inverted_colors_changed_cb (EvDocumentModel *model,
GParamSpec *pspec,
EvWindow *window)
{
gboolean inverted_colors = ev_document_model_get_inverted_colors (model);
+ GAction *action;
- ev_window_update_inverted_colors_action (window);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "inverted-colors");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action),
+ g_variant_new_boolean (inverted_colors));
if (window->priv->metadata && !ev_window_is_empty (window))
ev_metadata_set_boolean (window->priv->metadata, "inverted-colors",
@@ -4835,43 +4687,20 @@ ev_window_inverted_colors_changed_cb (EvDocumentModel *model,
}
static void
-ev_window_update_dual_page_action (EvWindow *window)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (window->priv->action_group, "ViewDual");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_dual), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_dual_page (window->priv->model));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_dual), window);
-}
-
-static void
ev_window_dual_mode_changed_cb (EvDocumentModel *model,
GParamSpec *pspec,
EvWindow *ev_window)
{
- ev_window_update_dual_page_action (ev_window);
+ gboolean dual_page;
+ GAction *action;
- if (ev_window->priv->metadata && !ev_window_is_empty (ev_window))
- ev_metadata_set_boolean (ev_window->priv->metadata, "dual-page",
- ev_document_model_get_dual_page (model));
-}
+ dual_page = ev_document_model_get_dual_page (model);
-static void
-ev_window_update_dual_page_odd_pages_left_action (EvWindow *window)
-{
- GtkAction *action;
+ action = g_action_map_lookup_action (G_ACTION_MAP (ev_window), "dual-page");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (dual_page));
- action = gtk_action_group_get_action (window->priv->action_group, "ViewDualOddLeft");
- g_signal_handlers_block_by_func
- (action, G_CALLBACK (ev_window_cmd_dual_odd_pages_left), window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
- ev_document_model_get_dual_page_odd_pages_left (window->priv->model));
- g_signal_handlers_unblock_by_func
- (action, G_CALLBACK (ev_window_cmd_dual_odd_pages_left), window);
+ if (ev_window->priv->metadata && !ev_window_is_empty (ev_window))
+ ev_metadata_set_boolean (ev_window->priv->metadata, "dual-page", dual_page);
}
static void
@@ -4879,33 +4708,36 @@ ev_window_dual_mode_odd_pages_left_changed_cb (EvDocumentModel *model,
GParamSpec *pspec,
EvWindow *ev_window)
{
- ev_window_update_dual_page_odd_pages_left_action (ev_window);
-
if (ev_window->priv->metadata && !ev_window_is_empty (ev_window))
ev_metadata_set_boolean (ev_window->priv->metadata, "dual-page-odd-left",
ev_document_model_get_dual_page_odd_pages_left (model));
}
static void
-ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
+ev_window_activate_open_menu_command (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- ev_application_show_about (EV_APP);
-}
+ EvWindow *ev_window = user_data;
-static void
-ev_window_cmd_action_menu (GtkAction *action, EvWindow *ev_window)
-{
ev_toolbar_action_menu_popup (EV_TOOLBAR (ev_window->priv->toolbar));
}
static void
-ev_window_view_sidebar_cb (GtkAction *action, EvWindow *ev_window)
+ev_window_change_show_side_pane_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
+ EvWindow *ev_window = user_data;
+ gboolean show_side_pane;
+
if (EV_WINDOW_IS_PRESENTATION (ev_window))
return;
-
- update_chrome_flag (ev_window, EV_CHROME_SIDEBAR,
- gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+
+ show_side_pane = g_variant_get_boolean (state);
+ g_simple_action_set_state (action, g_variant_new_boolean (show_side_pane));
+
+ update_chrome_flag (ev_window, EV_CHROME_SIDEBAR, show_side_pane);
update_chrome_visibility (ev_window);
}
@@ -4926,14 +4758,11 @@ ev_window_sidebar_visibility_changed_cb (EvSidebar *ev_sidebar,
GParamSpec *pspec,
EvWindow *ev_window)
{
- GtkAction *action;
-
- action = gtk_action_group_get_action (ev_window->priv->action_group, "ViewSidebar");
-
if (!EV_WINDOW_IS_PRESENTATION (ev_window)) {
gboolean visible = gtk_widget_get_visible (GTK_WIDGET (ev_sidebar));
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), visible);
+ g_action_group_change_action_state (G_ACTION_GROUP (ev_window), "show-side-pane",
+ g_variant_new_boolean (visible));
if (ev_window->priv->metadata)
ev_metadata_set_boolean (ev_window->priv->metadata, "sidebar_visibility",
@@ -5331,21 +5160,6 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar,
}
static void
-update_toggle_find_action (EvWindow *ev_window,
- gboolean active)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (ev_window->priv->action_group, "EditFind");
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)) == active)
- return;
-
- g_signal_handlers_block_by_func (action, G_CALLBACK (ev_window_cmd_toggle_find), ev_window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
- g_signal_handlers_unblock_by_func (action, G_CALLBACK (ev_window_cmd_toggle_find), ev_window);
-}
-
-static void
ev_window_show_find_bar (EvWindow *ev_window,
gboolean restart)
{
@@ -5373,7 +5187,7 @@ ev_window_show_find_bar (EvWindow *ev_window,
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, TRUE);
update_chrome_visibility (ev_window);
gtk_widget_grab_focus (ev_window->priv->find_bar);
- update_toggle_find_action (ev_window, TRUE);
+ g_action_group_change_action_state (G_ACTION_GROUP (ev_window), "find", g_variant_new_boolean (TRUE));
if (restart && ev_window->priv->find_job)
ev_window_find_restart (ev_window);
@@ -5394,7 +5208,7 @@ ev_window_close_find_bar (EvWindow *ev_window)
update_chrome_flag (ev_window, EV_CHROME_FINDBAR, FALSE);
update_chrome_visibility (ev_window);
gtk_widget_grab_focus (ev_window->priv->view);
- update_toggle_find_action (ev_window, FALSE);
+ g_action_group_change_action_state (G_ACTION_GROUP (ev_window), "find", g_variant_new_boolean
(FALSE));
ev_history_thaw (ev_window->priv->history);
}
@@ -5444,10 +5258,15 @@ static void
ev_window_set_caret_navigation_enabled (EvWindow *window,
gboolean enabled)
{
+ GAction *action;
+
if (window->priv->metadata)
ev_metadata_set_boolean (window->priv->metadata, "caret-navigation", enabled);
ev_view_set_caret_navigation_enabled (EV_VIEW (window->priv->view), enabled);
+
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "caret-navigation");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_boolean (enabled));
}
static void
@@ -5471,9 +5290,11 @@ ev_window_caret_navigation_message_area_response_cb (EvMessageArea *area,
}
static void
-ev_window_cmd_view_toggle_caret_navigation (GtkAction *action,
- EvWindow *window)
+ev_window_change_caret_navigation_action_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
GtkWidget *message_area;
GtkWidget *box;
GtkWidget *hbox;
@@ -5598,20 +5419,12 @@ ev_window_dispose (GObject *object)
g_clear_object (&priv->zoom_selector_popup_action_group);
- if (priv->recent_action_group) {
- g_object_unref (priv->recent_action_group);
- priv->recent_action_group = NULL;
- }
-
if (priv->bookmarks_action_group) {
g_object_unref (priv->bookmarks_action_group);
priv->bookmarks_action_group = NULL;
}
if (priv->recent_manager) {
- g_signal_handlers_disconnect_by_func (priv->recent_manager,
- ev_window_setup_recent,
- window);
priv->recent_manager = NULL;
}
@@ -5631,8 +5444,6 @@ ev_window_dispose (GObject *object)
priv->lockdown_settings = NULL;
}
- priv->recent_ui_id = 0;
-
if (priv->model) {
g_signal_handlers_disconnect_by_func (priv->model,
ev_window_page_changed_cb,
@@ -5748,7 +5559,6 @@ ev_window_dispose (GObject *object)
G_OBJECT_CLASS (ev_window_parent_class)->dispose (object);
}
-
/*
* GtkWindow catches keybindings for the menu items _before_ passing them to
* the focused widget. This is unfortunate and means that pressing Ctrl+a,
@@ -5805,184 +5615,10 @@ ev_window_class_init (EvWindowClass *ev_window_class)
g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
}
-/* Normal items */
-static const GtkActionEntry entries[] = {
- { "Bookmarks", NULL, N_("_Bookmarks") },
- { "RecentFiles", NULL, N_("_Recent") },
-
- /* File menu */
- { "FileOpen", GTK_STOCK_OPEN, N_("_Open…"), "<control>O",
- N_("Open an existing document"),
- G_CALLBACK (ev_window_cmd_file_open) },
- { "FileOpenCopy", NULL, N_("Op_en a Copy"), "<control>N",
- N_("Open a copy of the current document in a new window"),
- G_CALLBACK (ev_window_cmd_file_open_copy) },
- { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy…"), "<control>S",
- N_("Save a copy of the current document"),
- G_CALLBACK (ev_window_cmd_save_as) },
- { "FileSendTo", EV_STOCK_SEND_TO, N_("Send _To…"), NULL,
- N_("Send current document by mail, instant message…"),
- G_CALLBACK (ev_window_cmd_send_to) },
- { "FileOpenContainingFolder", GTK_STOCK_DIRECTORY, N_("Open Containing _Folder"), NULL,
- N_("Show the folder which contains this file in the file manager"),
- G_CALLBACK (ev_window_cmd_open_containing_folder) },
- { "FilePrint", GTK_STOCK_PRINT, N_("_Print…"), "<control>P",
- N_("Print this document"),
- G_CALLBACK (ev_window_cmd_file_print) },
- { "FileProperties", GTK_STOCK_PROPERTIES, N_("P_roperties"), "<alt>Return", NULL,
- G_CALLBACK (ev_window_cmd_file_properties) },
- { "FileCloseWindow", GTK_STOCK_CLOSE, NULL, "<control>W", NULL,
- G_CALLBACK (ev_window_cmd_file_close_window) },
-
- /* Edit menu */
- { "EditCopy", GTK_STOCK_COPY, NULL, "<control>C", NULL,
- G_CALLBACK (ev_window_cmd_edit_copy) },
- { "EditSelectAll", GTK_STOCK_SELECT_ALL, N_("Select _All"), "<control>A", NULL,
- G_CALLBACK (ev_window_cmd_edit_select_all) },
- { "EditRotateLeft", EV_STOCK_ROTATE_LEFT, N_("Rotate _Left"), "<control>Left", NULL,
- G_CALLBACK (ev_window_cmd_edit_rotate_left) },
- { "EditRotateRight", EV_STOCK_ROTATE_RIGHT, N_("Rotate _Right"), "<control>Right", NULL,
- G_CALLBACK (ev_window_cmd_edit_rotate_right) },
- { "EditSaveSettings", NULL, N_("Save Current Settings as _Default"), "<control>T", NULL,
- G_CALLBACK (ev_window_cmd_edit_save_settings) },
-
-
- /* View menu */
- { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "<control>plus",
- N_("Enlarge the document"),
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus",
- N_("Shrink the document"),
- G_CALLBACK (ev_window_cmd_view_zoom_out) },
- { "ViewReload", GTK_STOCK_REFRESH, N_("_Reload"), "<control>R",
- N_("Reload the document"),
- G_CALLBACK (ev_window_cmd_view_reload) },
-
- { "ViewAutoscroll", GTK_STOCK_MEDIA_PLAY, N_("Auto_scroll"), NULL, NULL,
- G_CALLBACK (ev_window_cmd_view_autoscroll) },
-
- /* Go menu */
- { "GoPreviousPage", "go-up-symbolic", N_("_Previous Page"), "<control>Page_Up",
- N_("Go to the previous page"),
- G_CALLBACK (ev_window_cmd_go_previous_page) },
- { "GoNextPage", "go-down-symbolic", N_("_Next Page"), "<control>Page_Down",
- N_("Go to the next page"),
- G_CALLBACK (ev_window_cmd_go_next_page) },
- { "GoFirstPage", GTK_STOCK_GOTO_TOP, N_("_First Page"), "<control>Home",
- N_("Go to the first page"),
- G_CALLBACK (ev_window_cmd_go_first_page) },
- { "GoLastPage", GTK_STOCK_GOTO_BOTTOM, N_("_Last Page"), "<control>End",
- N_("Go to the last page"),
- G_CALLBACK (ev_window_cmd_go_last_page) },
- { "GoToPage", GTK_STOCK_GOTO_TOP, N_("Go to Pa_ge"),"<control>L",
- N_("Go to Page"),
- G_CALLBACK (ev_window_cmd_focus_page_selector) },
-
- /* Bookmarks menu */
- { "BookmarksAdd", GTK_STOCK_ADD, N_("_Add Bookmark"), "<control>D",
- N_("Add a bookmark for the current page"),
- G_CALLBACK (ev_window_cmd_bookmarks_add) },
-
- { "HelpAbout", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL,
- G_CALLBACK (ev_window_cmd_help_about) },
-
- /* Toolbar-only */
- { "LeaveFullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_("Leave Fullscreen"), NULL,
- N_("Leave fullscreen mode"),
- G_CALLBACK (ev_window_cmd_leave_fullscreen) },
- { "StartPresentation", EV_STOCK_RUN_PRESENTATION, N_("Start Presentation"), NULL,
- N_("Start a presentation"),
- G_CALLBACK (ev_window_cmd_start_presentation) },
-
- /* Accellerators */
- { "Escape", NULL, "", "Escape", "",
- G_CALLBACK (ev_window_cmd_escape) },
- { "CtrlF", GTK_STOCK_FIND, NULL, "<control>F", NULL,
- G_CALLBACK (ev_window_cmd_edit_find) },
- { "Slash", GTK_STOCK_FIND, NULL, "slash", NULL,
- G_CALLBACK (ev_window_cmd_edit_find) },
- { "F3", NULL, "", "F3", NULL,
- G_CALLBACK (ev_window_cmd_edit_find_next) },
- { "CtrlG", NULL, "", "<control>G", NULL,
- G_CALLBACK (ev_window_cmd_edit_find_next) },
- { "ShiftCtrlG", NULL, "", "<shift><control>G", NULL,
- G_CALLBACK (ev_window_cmd_edit_find_previous) },
- { "PageDown", NULL, "", "Page_Down", NULL,
- G_CALLBACK (ev_window_cmd_scroll_forward) },
- { "PageUp", NULL, "", "Page_Up", NULL,
- G_CALLBACK (ev_window_cmd_scroll_backward) },
- { "p", GTK_STOCK_GO_UP, "", "p", NULL,
- G_CALLBACK (ev_window_cmd_go_previous_page) },
- { "n", GTK_STOCK_GO_DOWN, "", "n", NULL,
- G_CALLBACK (ev_window_cmd_go_next_page) },
- { "Plus", GTK_STOCK_ZOOM_IN, NULL, "plus", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "CtrlEqual", GTK_STOCK_ZOOM_IN, NULL, "<control>equal", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "Equal", GTK_STOCK_ZOOM_IN, NULL, "equal", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "Minus", GTK_STOCK_ZOOM_OUT, NULL, "minus", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_out) },
- { "FocusPageSelector", NULL, "", "<control>l", NULL,
- G_CALLBACK (ev_window_cmd_focus_page_selector) },
- { "GoBackwardFast", NULL, "", "<shift>Page_Up", NULL,
- G_CALLBACK (ev_window_cmd_go_backward) },
- { "GoForwardFast", NULL, "", "<shift>Page_Down", NULL,
- G_CALLBACK (ev_window_cmd_go_forward) },
- { "KpPlus", GTK_STOCK_ZOOM_IN, NULL, "KP_Add", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "KpMinus", GTK_STOCK_ZOOM_OUT, NULL, "KP_Subtract", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_out) },
- { "CtrlKpPlus", GTK_STOCK_ZOOM_IN, NULL, "<control>KP_Add", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_in) },
- { "CtrlKpMinus", GTK_STOCK_ZOOM_OUT, NULL, "<control>KP_Subtract", NULL,
- G_CALLBACK (ev_window_cmd_view_zoom_out) },
- { "CtrlInsert", GTK_STOCK_COPY, NULL, "<control>Insert", NULL,
- G_CALLBACK (ev_window_cmd_edit_copy) },
- { "FitPage", EV_STOCK_ZOOM_PAGE, NULL, "f", NULL,
- G_CALLBACK (ev_window_cmd_fit_page) },
- { "FitWidth", EV_STOCK_ZOOM_WIDTH, NULL, "w", NULL,
- G_CALLBACK (ev_window_cmd_fit_width) },
- { "F10", NULL, "", "F10", NULL,
- G_CALLBACK (ev_window_cmd_action_menu) },
- { "F7", NULL, "", "F7", NULL,
- G_CALLBACK (ev_window_cmd_view_toggle_caret_navigation) },
-};
-
-/* Toggle items */
-static const GtkToggleActionEntry toggle_entries[] = {
- /* View Menu */
- { "ViewSidebar", GTK_STOCK_INDEX, N_("Side _Pane"), "F9",
- N_("Show or hide the side pane"),
- G_CALLBACK (ev_window_view_sidebar_cb), TRUE },
- { "ViewContinuous", EV_STOCK_VIEW_CONTINUOUS, N_("_Continuous"), NULL,
- N_("Show the entire document"),
- G_CALLBACK (ev_window_cmd_continuous), TRUE },
- { "ViewDual", EV_STOCK_VIEW_DUAL, N_("_Dual"), NULL,
- N_("Show two pages at once"),
- G_CALLBACK (ev_window_cmd_dual), FALSE },
- { "ViewDualOddLeft", NULL, N_("_Odd Pages Left"), NULL,
- N_("Show odd pages on the left in dual mode"),
- G_CALLBACK (ev_window_cmd_dual_odd_pages_left), FALSE },
- { "ViewFullscreen", GTK_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
- N_("Expand the window to fill the screen"),
- G_CALLBACK (ev_window_cmd_view_fullscreen) },
- { "ViewPresentation", EV_STOCK_RUN_PRESENTATION, N_("Pre_sentation"), "F5",
- N_("Run document as a presentation"),
- G_CALLBACK (ev_window_cmd_view_presentation) },
- { "ViewInvertedColors", EV_STOCK_INVERTED_COLORS, N_("_Inverted Colors"), "<control>I",
- N_("Show page contents with the colors inverted"),
- G_CALLBACK (ev_window_cmd_view_inverted_colors) },
-
- { "EditFind", "edit-find-symbolic", N_("_Find…"), "<control>F",
- N_("Find a word or phrase in the document"),
- G_CALLBACK (ev_window_cmd_toggle_find) },
-};
-
/* Popups specific items */
static const GtkActionEntry view_popup_entries [] = {
/* Links */
- { "OpenLink", GTK_STOCK_OPEN, N_("_Open Link"), NULL,
+ { "OpenLink", NULL, N_("_Open Link"), NULL,
NULL, G_CALLBACK (ev_view_popup_cmd_open_link) },
{ "GoLink", GTK_STOCK_GO_FORWARD, N_("_Go To"), NULL,
NULL, G_CALLBACK (ev_view_popup_cmd_open_link) },
@@ -5999,7 +5635,7 @@ static const GtkActionEntry view_popup_entries [] = {
};
static const GtkActionEntry attachment_popup_entries [] = {
- { "OpenAttachment", GTK_STOCK_OPEN, N_("_Open Attachment"), NULL,
+ { "OpenAttachment", NULL, N_("_Open Attachment"), NULL,
NULL, G_CALLBACK (ev_attachment_popup_cmd_open_attachment) },
{ "SaveAttachmentAs", GTK_STOCK_SAVE_AS, N_("_Save Attachment As…"), NULL,
NULL, G_CALLBACK (ev_attachment_popup_cmd_save_attachment_as) },
@@ -6069,13 +5705,6 @@ sidebar_annots_annot_add_cancelled (EvSidebarAnnotations *sidebar_annots,
}
static void
-sidebar_bookmarks_add_bookmark (EvSidebarBookmarks *sidebar_bookmarks,
- EvWindow *window)
-{
- ev_window_cmd_bookmarks_add (NULL, window);
-}
-
-static void
zoom_action_activated_cb (EvZoomAction *action,
EvWindow *window)
{
@@ -6171,42 +5800,6 @@ register_custom_actions (EvWindow *window, GtkActionGroup *group)
}
static void
-set_action_properties (GtkActionGroup *action_group)
-{
- GtkAction *action;
-
- action = gtk_action_group_get_action (action_group, "FileOpenContainingFolder");
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Open Folder"), NULL);
-
- action = gtk_action_group_get_action (action_group, "FileSendTo");
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Send To"), NULL);
- gtk_action_set_visible (action, nautilus_sendto != NULL);
-
- action = gtk_action_group_get_action (action_group, "GoPreviousPage");
- g_object_set (action, "is-important", TRUE, NULL);
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Previous"), NULL);
-
- action = gtk_action_group_get_action (action_group, "GoNextPage");
- g_object_set (action, "is-important", TRUE, NULL);
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Next"), NULL);
-
- action = gtk_action_group_get_action (action_group, "ViewZoomIn");
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Zoom In"), NULL);
-
- action = gtk_action_group_get_action (action_group, "ViewZoomOut");
- /*translators: this is the label for toolbar button*/
- g_object_set (action, "short_label", _("Zoom Out"), NULL);
-
- action = gtk_action_group_get_action (action_group, "LeaveFullscreen");
- g_object_set (action, "is-important", TRUE, NULL);
-}
-
-static void
sidebar_widget_model_set (EvSidebarLinks *ev_sidebar_links,
GParamSpec *pspec,
EvWindow *ev_window)
@@ -6440,21 +6033,21 @@ do_action_named (EvWindow *window, EvLinkAction *action)
const gchar *name = ev_link_action_get_name (action);
if (g_ascii_strcasecmp (name, "FirstPage") == 0) {
- ev_window_cmd_go_first_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-first-page", NULL);
} else if (g_ascii_strcasecmp (name, "PrevPage") == 0) {
- ev_window_cmd_go_previous_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-previous-page", NULL);
} else if (g_ascii_strcasecmp (name, "NextPage") == 0) {
- ev_window_cmd_go_next_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-next-page", NULL);
} else if (g_ascii_strcasecmp (name, "LastPage") == 0) {
- ev_window_cmd_go_last_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-last-page", NULL);
} else if (g_ascii_strcasecmp (name, "GoToPage") == 0) {
- ev_window_cmd_focus_page_selector (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "select-page", NULL);
} else if (g_ascii_strcasecmp (name, "Find") == 0) {
- ev_window_show_find_bar (window, TRUE);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "find", NULL);
} else if (g_ascii_strcasecmp (name, "Close") == 0) {
- ev_window_cmd_file_close_window (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "close", NULL);
} else if (g_ascii_strcasecmp (name, "Print") == 0) {
- ev_window_cmd_file_print (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "print", NULL);
} else {
g_warning ("Unimplemented named action: %s, please post a "
"bug report in Evince bugzilla "
@@ -6947,16 +6540,16 @@ ev_window_media_player_key_pressed (EvWindow *window,
if (EV_WINDOW_IS_PRESENTATION (window))
ev_view_presentation_previous_page (EV_VIEW_PRESENTATION
(window->priv->presentation_view));
else
- ev_window_cmd_go_previous_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-previous-page", NULL);
} else if (strcmp (key, "Next") == 0) {
if (EV_WINDOW_IS_PRESENTATION (window))
ev_view_presentation_next_page (EV_VIEW_PRESENTATION
(window->priv->presentation_view));
else
- ev_window_cmd_go_next_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-next-page", NULL);
} else if (strcmp (key, "FastForward") == 0) {
- ev_window_cmd_go_last_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-last-page", NULL);
} else if (strcmp (key, "Rewind") == 0) {
- ev_window_cmd_go_first_page (NULL, window);
+ g_action_group_activate_action (G_ACTION_GROUP (window), "go-first-page", NULL);
}
}
@@ -7071,8 +6664,72 @@ _gtk_css_provider_load_from_resource (GtkCssProvider *provider,
}
static void
+activate_toggle_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GVariant *state;
+
+ state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_variant_unref (state);
+}
+
+static void
+activate_radio_action (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ g_action_change_state (G_ACTION (action), parameter);
+}
+
+static void
ev_window_init (EvWindow *ev_window)
{
+ const GActionEntry actions[] = {
+ { "open-copy", ev_window_activate_open_copy_action, NULL, NULL, NULL },
+ { "save-copy", ev_window_activate_save_copy_action, NULL, NULL, NULL },
+ { "send-to", ev_window_activate_send_to_action, NULL, NULL, NULL },
+ { "open-containing-folder", ev_window_activate_open_containing_folder_action, NULL, NULL,
NULL },
+ { "print", ev_window_activate_print_action, NULL, NULL, NULL },
+ { "show-properties", ev_window_activate_show_properties_action, NULL, NULL, NULL },
+ { "copy", ev_window_activate_copy_action, NULL, NULL, NULL },
+ { "select-all", ev_window_activate_select_all_action, NULL, NULL, NULL },
+ { "save-settings", ev_window_activate_save_settings_action, NULL, NULL, NULL },
+ { "go-previous-page", ev_window_activate_go_previous_page_action, NULL, NULL, NULL },
+ { "go-next-page", ev_window_activate_go_next_page_action, NULL, NULL, NULL },
+ { "go-first-page", ev_window_activate_go_first_page_action, NULL, NULL, NULL },
+ { "go-last-page", ev_window_activate_go_last_page_action, NULL, NULL, NULL },
+ { "go-forward", ev_window_activate_go_forward_action, NULL, NULL, NULL },
+ { "go-backwards", ev_window_activate_go_backward_action, NULL, NULL, NULL },
+ { "find", activate_toggle_action, NULL, "false", ev_window_change_find_action_state },
+ { "find-next", ev_window_activate_find_next_action, NULL, NULL, NULL },
+ { "find-previous", ev_window_activate_find_previous_action, NULL, NULL, NULL },
+ { "select-page", ev_window_activate_select_page_action, NULL, NULL, NULL },
+ { "continuous", activate_toggle_action, NULL, "true",
ev_window_change_continuous_action_state },
+ { "dual-page", activate_toggle_action, NULL, "false", ev_window_change_dual_page_action_state
},
+ { "dual-odd-left", activate_toggle_action, NULL, "false",
ev_window_change_dual_odd_left_action_state },
+ { "show-side-pane", activate_toggle_action, NULL, "false",
ev_window_change_show_side_pane_action_state },
+ { "inverted-colors", activate_toggle_action, NULL, "false",
ev_window_change_inverted_colors_action_state },
+ { "fullscreen", activate_toggle_action, NULL, "false",
ev_window_change_fullscreen_action_state },
+ { "presentation", activate_toggle_action, NULL, "false",
ev_window_change_presentation_action_state },
+ { "rotate-left", ev_window_activate_rotate_left_action, NULL, NULL, NULL },
+ { "rotate-right", ev_window_activate_rotate_right_action, NULL, NULL, NULL },
+ { "zoom-in", ev_window_activate_zoom_in_action, NULL, NULL, NULL },
+ { "zoom-out", ev_window_activate_zoom_out_action, NULL, NULL, NULL },
+ { "reload", ev_window_activate_reload_action, NULL, NULL, NULL },
+ { "auto-scroll", ev_window_activate_auto_scroll_action, NULL, NULL, NULL },
+ { "add-bookmark", ev_window_activate_add_bookmark_action, NULL, NULL, NULL },
+ { "goto-bookmark", ev_window_activate_goto_bookmark_action, "u", NULL, NULL },
+ { "close", ev_window_activate_close_action, NULL, NULL, NULL },
+ { "scroll-forward", ev_window_activate_scroll_forward_action, NULL, NULL, NULL },
+ { "scroll-backwards", ev_window_activate_scroll_backwards_action, NULL, NULL, NULL },
+ { "sizing-mode", activate_radio_action, "s", "'free'",
ev_window_change_sizing_mode_action_state },
+ { "escape", ev_window_activate_escape_action, NULL, NULL, NULL },
+ { "open-menu", ev_window_activate_open_menu_command, NULL, NULL, NULL },
+ { "caret-navigation", activate_toggle_action, NULL, "false",
ev_window_change_caret_navigation_action_state },
+ };
+
GtkActionGroup *action_group;
GtkAccelGroup *accel_group;
GtkCssProvider *css_provider;
@@ -7136,6 +6793,8 @@ ev_window_init (EvWindow *ev_window)
G_CALLBACK (activate_link_cb),
ev_window);
+ ev_window->priv->bookmarks_menu = g_menu_new ();
+
app_info = g_app_info_get_default_for_uri_scheme ("mailto");
ev_window->priv->has_mailto_handler = app_info != NULL;
g_clear_object (&app_info);
@@ -7144,15 +6803,13 @@ ev_window_init (EvWindow *ev_window)
gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box);
gtk_widget_show (ev_window->priv->main_box);
+ g_action_map_add_action_entries (G_ACTION_MAP (ev_window),
+ actions, G_N_ELEMENTS (actions),
+ ev_window);
+
action_group = gtk_action_group_new ("MenuActions");
ev_window->priv->action_group = action_group;
gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group, entries,
- G_N_ELEMENTS (entries), ev_window);
- gtk_action_group_add_toggle_actions (action_group, toggle_entries,
- G_N_ELEMENTS (toggle_entries),
- ev_window);
- set_action_properties (action_group);
register_custom_actions (ev_window, action_group);
ev_window->priv->ui_manager = gtk_ui_manager_new ();
@@ -7208,12 +6865,6 @@ ev_window_init (EvWindow *ev_window)
g_object_unref (css_provider);
ev_window->priv->recent_manager = gtk_recent_manager_get_default ();
- ev_window->priv->recent_action_group = NULL;
- ev_window->priv->recent_ui_id = 0;
- g_signal_connect_swapped (ev_window->priv->recent_manager,
- "changed",
- G_CALLBACK (ev_window_setup_recent),
- ev_window);
ev_window->priv->toolbar = ev_toolbar_new (ev_window);
gtk_widget_set_no_show_all (ev_window->priv->toolbar, TRUE);
@@ -7319,10 +6970,6 @@ ev_window_init (EvWindow *ev_window)
sidebar_widget = ev_sidebar_bookmarks_new ();
ev_window->priv->sidebar_bookmarks = sidebar_widget;
- g_signal_connect (sidebar_widget,
- "add-bookmark",
- G_CALLBACK (sidebar_bookmarks_add_bookmark),
- ev_window);
gtk_widget_show (sidebar_widget);
ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
sidebar_widget);
@@ -7529,9 +7176,6 @@ ev_window_init (EvWindow *ev_window)
g_settings_delay (ev_window->priv->default_settings);
ev_window_setup_default (ev_window);
- /* Set it user interface params */
- ev_window_setup_recent (ev_window);
-
gtk_window_set_default_size (GTK_WINDOW (ev_window), 600, 600);
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (ev_window), TRUE);
@@ -7600,3 +7244,11 @@ ev_window_get_zoom_selector_action_group (EvWindow *ev_window)
return ev_window->priv->zoom_selector_popup_action_group;
}
+
+GMenuModel *
+ev_window_get_bookmarks_menu (EvWindow *ev_window)
+{
+ g_return_val_if_fail (EV_WINDOW (ev_window), NULL);
+
+ return G_MENU_MODEL (ev_window->priv->bookmarks_menu);
+}
diff --git a/shell/ev-window.h b/shell/ev-window.h
index fd2d0b5..6c123d0 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -89,7 +89,7 @@ const gchar *ev_window_get_dbus_object_path (EvWindow *ev_win
GtkUIManager *ev_window_get_ui_manager (EvWindow *ev_window);
GtkActionGroup *ev_window_get_main_action_group (EvWindow *ev_window);
GtkActionGroup *ev_window_get_zoom_selector_action_group (EvWindow *ev_window);
-
+GMenuModel *ev_window_get_bookmarks_menu (EvWindow *ev_window);
G_END_DECLS
diff --git a/shell/evince-ui.xml b/shell/evince-ui.xml
index df9c9f9..ae51200 100644
--- a/shell/evince-ui.xml
+++ b/shell/evince-ui.xml
@@ -1,70 +1,10 @@
<ui>
- <popup name="ActionMenu" accelerators="true">
- <menuitem name="FileOpenMenu" action="FileOpen"/>
- <menuitem name="FileOpenCopyMenu" action="FileOpenCopy"/>
- <menu name="RecentFilesMenu" action="RecentFiles">
- <placeholder name="RecentFiles"/>
- </menu>
- <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
- <menuitem name="FileSendToMenu" action="FileSendTo"/>
- <menuitem name="FileOpenContainingFolderMenu" action="FileOpenContainingFolder"/>
- <menuitem name="FilePrintMenu" action="FilePrint"/>
- <separator/>
- <menuitem name="FilePropertiesMenu" action="FileProperties"/>
- <separator/>
- <menuitem name="EditCopyMenu" action="EditCopy"/>
- <menuitem name="EditSelectAllMenu" action="EditSelectAll"/>
- <separator/>
- <menuitem name="EditSaveSettingsMenu" action="EditSaveSettings"/>
- <separator/>
- <menuitem name="GoFirstPageMenu" action="GoFirstPage"/>
- <menuitem name="GoLastPageMenu" action="GoLastPage"/>
- <separator/>
- <menuitem name="BookmarksAddMenu" action="BookmarksAdd"/>
- <menu name="BookmarksMenu" action="Bookmarks">
- <placeholder name="BookmarksItems"/>
- </menu>
- <separator/>
- <menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/>
- <separator/>
- <menuitem name="HelpAboutMenu" action="HelpAbout"/>
- </popup>
-
- <popup name="ViewMenuPopup" accelerators="true">
- <menuitem name="ViewContinuousMenu" action="ViewContinuous"/>
- <menuitem name="ViewDualMenu" action="ViewDual"/>
- <separator/>
- <menuitem name="ViewSidebarMenu" action="ViewSidebar"/>
- <separator/>
- <menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/>
- <menuitem name="ViewPresentationMenu" action="ViewPresentation"/>
- <separator/>
- <menuitem name="EditRotateLeftMenu" action="EditRotateLeft"/>
- <menuitem name="EditRotateRightMenu" action="EditRotateRight"/>
- <separator/>
- <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/>
- <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/>
- <separator/>
- <menuitem name="ViewDualOddLeftMenu" action="ViewDualOddLeft"/>
- <menuitem name="ViewInvertedColors" action="ViewInvertedColors"/>
- <separator/>
- <menuitem name="ViewReload" action="ViewReload"/>
- </popup>
-
<popup name="DocumentPopup" action="DocumentPopupAction">
<menuitem name="OpenLink" action="OpenLink"/>
<menuitem name="CopyLinkAddress" action="CopyLinkAddress"/>
<menuitem name="GoLink" action="GoLink"/>
<menuitem name="OpenLinkNewWindow" action="OpenLinkNewWindow"/>
<separator/>
- <menuitem name="GoPreviousPage" action="GoPreviousPage"/>
- <menuitem name="GoNextPage" action="GoNextPage"/>
- <menuitem name="ViewReload" action="ViewReload"/>
- <menuitem name="ViewAutoscroll" action="ViewAutoscroll"/>
- <separator/>
- <menuitem name="EditCopy" action="EditCopy"/>
- <menuitem name="EditSelectAllPopup" action="EditSelectAll"/>
- <separator/>
<menuitem name="SaveImageAs" action="SaveImageAs"/>
<menuitem name="CopyImage" action="CopyImage"/>
<separator/>
@@ -72,7 +12,6 @@
<menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
<separator/>
<menuitem name="AnnotProperties" action="AnnotProperties"/>
- <menuitem name="FileOpenContainingFolder" action="FileOpenContainingFolder"/>
</popup>
<popup name="AttachmentPopup" action="AttachmentPopupAction">
@@ -88,31 +27,4 @@
<separator/>
<placeholder name="ViewZoomItems"/>
</popup>
-
- <accelerator name="PageDownAccel" action="PageDown"/>
- <accelerator name="PageUpAccel" action="PageUp"/>
- <accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
- <accelerator name="GoForwardFastAccel" action="GoForwardFast"/>
- <accelerator name="EscapeAccel" action="Escape"/>
- <accelerator name="CtrlFAccel" action="CtrlF"/>
- <accelerator name="SlashAccel" action="Slash"/>
- <accelerator name="F3Accel" action="F3"/>
- <accelerator name="CtrlGAccel" action="CtrlG"/>
- <accelerator name="ShiftCtrlGAccel" action="ShiftCtrlG"/>
- <accelerator name="pAccel" action="p"/>
- <accelerator name="nAccel" action="n"/>
- <accelerator name="FocusPageSelectorAccel" action="FocusPageSelector"/>
- <accelerator name="PlusAccel" action="Plus"/>
- <accelerator name="MinusAccel" action="Minus"/>
- <accelerator name="Equal" action="Equal"/>
- <accelerator name="CtrlEqualAccel" action="CtrlEqual"/>
- <accelerator name="KpPlusAccel" action="KpPlus"/>
- <accelerator name="KpMinusAccel" action="KpMinus"/>
- <accelerator name="CtrlKpPlusAccel" action="CtrlKpPlus"/>
- <accelerator name="CtrlKpMinusAccel" action="CtrlKpMinus"/>
- <accelerator name="CtrlInsertAccel" action="CtrlInsert" />
- <accelerator name="FitPageAccel" action ="FitPage" />
- <accelerator name="FitWidthAccel" action ="FitWidth" />
- <accelerator name="F10Accel" action="F10" />
- <accelerator name="F7Accel" action="F7" />
</ui>
diff --git a/shell/evince.gresource.xml b/shell/evince.gresource.xml
index 83c1dd7..b432962 100644
--- a/shell/evince.gresource.xml
+++ b/shell/evince.gresource.xml
@@ -19,6 +19,6 @@
<gresource prefix="/org/gnome/evince/shell">
<file alias="ui/evince.xml" compressed="true" preprocess="xml-stripblanks">evince-ui.xml</file>
<file alias="ui/evince.css" compressed="true">evince.css</file>
- <file alias="ui/appmenu.ui" compressed="true" preprocess="xml-stripblanks">evince-appmenu.ui</file>
+ <file alias="ui/menus.ui" compressed="true" preprocess="xml-stripblanks">menus.ui</file>
</gresource>
</gresources>
diff --git a/shell/menus.ui b/shell/menus.ui
new file mode 100644
index 0000000..c3006f8
--- /dev/null
+++ b/shell/menus.ui
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright © 2012 Christian Persch
+ Copyright © 2014 Canonical Ltd.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ This program is distributed in the hope conf it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-->
+<interface>
+ <menu id="appmenu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Open</attribute>
+ <attribute name="action">app.open</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">app.help</attribute>
+ </item>
+ </section>
+ </menu>
+
+ <menu id="view-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Continuous</attribute>
+ <attribute name="action">win.continuous</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Dual</attribute>
+ <attribute name="action">win.dual-page</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Side _Pane</attribute>
+ <attribute name="action">win.show-side-pane</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Fullscreen</attribute>
+ <attribute name="action">win.fullscreen</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Pre_sentation</attribute>
+ <attribute name="action">win.presentation</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Rotate _Left</attribute>
+ <attribute name="action">win.rotate-left</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Rotate _Right</attribute>
+ <attribute name="action">win.rotate-right</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Zoom _In</attribute>
+ <attribute name="action">win.zoom-in</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Zoom _Out</attribute>
+ <attribute name="action">win.zoom-out</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Odd Pages Left</attribute>
+ <attribute name="action">win.dual-odd-left</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Inverted Colors</attribute>
+ <attribute name="action">win.inverted-colors</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Reload</attribute>
+ <attribute name="action">win.reload</attribute>
+ </item>
+ </section>
+ </menu>
+
+ <menu id="action-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Open…</attribute>
+ <attribute name="action">app.open</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Op_en a Copy</attribute>
+ <attribute name="action">win.open-copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Recent</attribute>
+ <link name="submenu" id="recent">
+ </link>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Save a Copy…</attribute>
+ <attribute name="action">win.save-copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Send _To…</attribute>
+ <attribute name="action">win.send-to</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Open Containing _Folder</attribute>
+ <attribute name="action">win.open-containing-folder</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Print…</attribute>
+ <attribute name="action">win.print</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">P_roperties…</attribute>
+ <attribute name="action">win.show-properties</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Copy</attribute>
+ <attribute name="action">win.copy</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Select _All</attribute>
+ <attribute name="action">win.select-all</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Save Current Settings as _Default</attribute>
+ <attribute name="action">win.save-settings</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_First Page</attribute>
+ <attribute name="action">win.go-first-page</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Last Page</attribute>
+ <attribute name="action">win.go-last-page</attribute>
+ </item>
+ </section>
+ <section id="bookmarks">
+ <item>
+ <attribute name="label" translatable="yes">_Add Bookmark</attribute>
+ <attribute name="action">win.add-bookmark</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Close</attribute>
+ <attribute name="action">win.close</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]