[evince] evince.desktop: Add new-window desktop action



commit 7c34f7457ded25f350fd6388e0e705c94a848f42
Author: Mpho Jele <mphokjele gmail com>
Date:   Fri Jun 25 14:45:20 2021 +0200

    evince.desktop: Add new-window desktop action
    
    Currently there is no way to launch a new window from the desktop.
    
    However most apps offer this feature; launching a new instance
    outside of a running instance has become common user exprience.
    
    Closes #1351

 data/org.gnome.Evince.desktop.in.in | 5 +++++
 shell/main.c                        | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.Evince.desktop.in.in b/data/org.gnome.Evince.desktop.in.in
index 66c7d490..e7bcf31e 100644
--- a/data/org.gnome.Evince.desktop.in.in
+++ b/data/org.gnome.Evince.desktop.in.in
@@ -12,3 +12,8 @@ Type=Application
 Icon=@PACKAGE_ICON_NAME@
 Categories=GNOME;GTK;Office;Viewer;Graphics;2DGraphics;VectorGraphics;
 MimeType=@EVINCE_MIME_TYPES@;
+Actions=new-window;
+
+[Desktop Action new-window]
+Name=New Window
+Exec=evince --new-window
diff --git a/shell/main.c b/shell/main.c
index 53617948..51cbbdf3 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -46,6 +46,7 @@ static gchar   *ev_page_label;
 static gchar   *ev_find_string;
 static gint     ev_page_index = 0;
 static gchar   *ev_named_dest;
+static gboolean new_window = FALSE;
 static gboolean preview_mode = FALSE;
 static gboolean fullscreen_mode = FALSE;
 static gboolean presentation_mode = FALSE;
@@ -68,6 +69,7 @@ option_version_cb (const gchar *option_name,
 
 static const GOptionEntry goption_options[] =
 {
+       { "new-window", 'o', 0, G_OPTION_ARG_NONE, &new_window, N_("Open a new window."), NULL },
        { "page-label", 'p', 0, G_OPTION_ARG_STRING, &ev_page_label, N_("The page label of the document to 
display."), N_("PAGE")},
        { "page-index", 'i', 0, G_OPTION_ARG_INT, &ev_page_index, N_("The page number of the document to 
display."), N_("NUMBER")},
        { "named-dest", 'n', 0, G_OPTION_ARG_STRING, &ev_named_dest, N_("Named destination to display."), 
N_("DEST")},
@@ -168,8 +170,8 @@ load_files (const char **files)
        gint             i;
        EvLinkDest      *global_dest = NULL;
 
-       if (!files) {
-               if (!ev_application_has_window (EV_APP))
+       if (!files || new_window) {
+               if (!ev_application_has_window (EV_APP) || new_window)
                        ev_application_open_recent_view (EV_APP, screen, GDK_CURRENT_TIME);
                return;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]