[evince] Revert "shell: Move 'Open...' file from document to application"
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Revert "shell: Move 'Open...' file from document to application"
- Date: Sat, 30 Jun 2018 02:14:21 +0000 (UTC)
commit 70a0aad3a618fa79f26c6f3d5531f0ee7cc231d9
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Fri Jun 29 21:06:24 2018 -0400
Revert "shell: Move 'Open...' file from document to application"
Because of the new goal (still a proposal, but there is some
consensus that is needed), the Application Menu will be
discouraged or removed. So, it makes sense to revert #524,
and set the goal to fix #514, that is, to use a textual
button in the Recent View, instead of the menu.
This reverts commit 6e0dbaea93f84053cb72e36b2b3b33250004fb94.
shell/ev-application.c | 14 --------------
shell/ev-toolbar.c | 37 +++++++++++++++++++++++++++++++++++++
shell/ev-window.c | 32 +++++---------------------------
shell/ev-window.h | 1 -
shell/evince-menus.ui | 8 ++++----
5 files changed, 46 insertions(+), 46 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 9586d1a3..7d546933 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -937,19 +937,6 @@ ev_application_migrate_config_dir (EvApplication *application)
g_free (old_accels);
}
-static void
-app_file_open_cb (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- EvApplication *application = user_data;
- EvWindow *window;
-
- window = EV_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (application)));
-
- ev_window_file_open_dialog (window);
-}
-
static void
app_new_cb (GSimpleAction *action,
GVariant *parameter,
@@ -1034,7 +1021,6 @@ static void
ev_application_startup (GApplication *gapplication)
{
const GActionEntry app_menu_actions[] = {
- { "open", app_file_open_cb, NULL, NULL, NULL },
{ "new", app_new_cb, NULL, NULL, NULL },
{ "help", app_help_cb, NULL, NULL, NULL },
{ "about", app_about_cb, NULL, NULL, NULL }
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index 7f276a10..d209b619 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -50,6 +50,7 @@ struct _EvToolbarPrivate {
GtkWidget *page_selector;
GtkWidget *navigation_action;
GtkWidget *find_button;
+ GtkWidget *open_button;
GtkWidget *annots_button;
GMenu *bookmarks_section;
@@ -87,6 +88,24 @@ ev_toolbar_set_button_action (EvToolbar *ev_toolbar,
gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
}
+static GtkWidget *
+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), 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,
const gchar *action_name,
@@ -178,6 +197,13 @@ ev_toolbar_constructed (GObject *object)
builder = gtk_builder_new_from_resource ("/org/gnome/evince/gtk/menus.ui");
+ button = ev_toolbar_create_button (ev_toolbar, "win.open",
+ "document-open-symbolic",
+ _("Open an existing document"));
+ ev_toolbar->priv->open_button = button;
+ gtk_container_add (GTK_CONTAINER (ev_toolbar), button);
+ gtk_widget_set_margin_end (button, 6);
+
/* Page selector */
/* Use EvPageActionWidget for now, since the page selector action is also used by the previewer */
tool_item = GTK_WIDGET (g_object_new (EV_TYPE_PAGE_ACTION_WIDGET, NULL));
@@ -340,6 +366,15 @@ ev_toolbar_set_mode (EvToolbar *ev_toolbar,
switch (mode) {
case EV_TOOLBAR_MODE_NORMAL:
+ gtk_widget_show (priv->view_menu_button);
+ gtk_widget_show (priv->action_menu_button);
+ gtk_widget_show (priv->history_action);
+ gtk_widget_show (priv->zoom_action);
+ gtk_widget_show (priv->page_selector);
+ gtk_widget_show (priv->find_button);
+ gtk_widget_show (priv->annots_button);
+ gtk_widget_hide (priv->open_button);
+ break;
case EV_TOOLBAR_MODE_FULLSCREEN:
gtk_widget_show (priv->view_menu_button);
gtk_widget_show (priv->action_menu_button);
@@ -348,6 +383,7 @@ ev_toolbar_set_mode (EvToolbar *ev_toolbar,
gtk_widget_show (priv->page_selector);
gtk_widget_show (priv->find_button);
gtk_widget_show (priv->annots_button);
+ gtk_widget_hide (priv->open_button);
break;
case EV_TOOLBAR_MODE_RECENT_VIEW:
gtk_widget_hide (priv->view_menu_button);
@@ -357,6 +393,7 @@ ev_toolbar_set_mode (EvToolbar *ev_toolbar,
gtk_widget_hide (priv->page_selector);
gtk_widget_hide (priv->find_button);
gtk_widget_hide (priv->annots_button);
+ gtk_widget_show (priv->open_button);
break;
}
}
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 36a6d031..85492313 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -2539,7 +2539,6 @@ ev_window_file_chooser_restore_folder (EvWindow *window,
g_settings_get (ev_window_ensure_settings (window),
get_settings_key_for_directory (directory),
"ms", &folder_uri);
-
if (folder_uri == NULL && uri != NULL) {
GFile *file, *parent;
@@ -2609,23 +2608,12 @@ file_open_dialog_response_cb (GtkWidget *chooser,
gtk_widget_destroy (chooser);
}
-/**
- * ev_window_file_open_dialog:
- * @ev_window: The instance of the #EvWindow. Likely the active window.
- *
- * It requests to open a document through a dialog. It uses @ev_window to
- * set the parent window, and to determine the screen on which the document
- * should be opened.
- *
- * If @ev_window is displaying the recent documents, then the document will
- * use that window. Otherwise, the document will be opened in a new window.
- *
- * It does look if there is any document loaded or if there is any job to load
- * a document.
- */
-void
-ev_window_file_open_dialog (EvWindow *window)
+static void
+ev_window_cmd_file_open (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ EvWindow *window = user_data;
GtkWidget *chooser;
chooser = gtk_file_chooser_dialog_new (_("Open Document"),
@@ -2650,16 +2638,6 @@ ev_window_file_open_dialog (EvWindow *window)
gtk_widget_show (chooser);
}
-static void
-ev_window_cmd_file_open (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
-{
- EvWindow *window = user_data;
-
- ev_window_file_open_dialog (window);
-}
-
static void
ev_window_open_copy_at_dest (EvWindow *window,
EvLinkDest *dest)
diff --git a/shell/ev-window.h b/shell/ev-window.h
index 28d031a8..7624caf1 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -94,7 +94,6 @@ EvHistory *ev_window_get_history (EvWindow *ev_win
EvDocumentModel *ev_window_get_document_model (EvWindow *ev_window);
void ev_window_focus_view (EvWindow *ev_window);
GtkWidget *ev_window_get_toolbar (EvWindow *ev_window);
-void ev_window_file_open_dialog (EvWindow *ev_window);
G_END_DECLS
diff --git a/shell/evince-menus.ui b/shell/evince-menus.ui
index 73a8df18..50285edd 100644
--- a/shell/evince-menus.ui
+++ b/shell/evince-menus.ui
@@ -20,10 +20,6 @@
<interface>
<menu id="app-menu">
<section>
- <item>
- <attribute name="label" translatable="yes">_Open…</attribute>
- <attribute name="action">app.open</attribute>
- </item>
<item>
<attribute name="label" translatable="yes">_New Window</attribute>
<attribute name="action">app.new</attribute>
@@ -137,6 +133,10 @@
<menu id="action-menu">
<section>
+ <item>
+ <attribute name="label" translatable="yes">_Open…</attribute>
+ <attribute name="action">win.open</attribute>
+ </item>
<item>
<attribute name="label" translatable="yes">Op_en a Copy</attribute>
<attribute name="action">win.open-copy</attribute>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]