Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-application.c File Reference
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <unistd.h>
#include "ev-application.h"
#include "ev-file-helpers.h"
#include "ev-stock-icons.h"
+ Include dependency graph for ev-application.c:

Go to the source code of this file.

Data Structures

struct  _EvApplication
 
struct  _EvApplicationClass
 

Functions

static void _ev_application_open_uri_at_dest (EvApplication *application, const gchar *uri, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp)
 
static void ev_application_open_uri_in_window (EvApplication *application, const char *uri, EvWindow *ev_window, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp)
 
EvApplicationev_application_new (void)
 
static void ev_spawn (const char *uri, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp)
 
static EvWindowev_application_get_empty_window (EvApplication *application, GdkScreen *screen)
 
void ev_application_open_uri_at_dest (EvApplication *application, const char *uri, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp)
 
static void ev_application_new_window (EvApplication *application, GdkScreen *screen, guint32 timestamp)
 
void ev_application_open_recent_view (EvApplication *application, GdkScreen *screen, guint32 timestamp)
 
void ev_application_open_uri_list (EvApplication *application, GSList *uri_list, GdkScreen *screen, guint timestamp)
 
static void ev_application_accel_map_save (EvApplication *application)
 
static void ev_application_accel_map_load (EvApplication *application)
 
static void ev_application_migrate_config_dir (EvApplication *application)
 
static void app_new_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 
static void app_help_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 
static void app_about_cb (GSimpleAction *action, GVariant *parameter, gpointer user_data)
 
static void ev_application_startup (GApplication *gapplication)
 
static void ev_application_shutdown (GApplication *gapplication)
 
static void ev_application_activate (GApplication *gapplication)
 
static void ev_application_class_init (EvApplicationClass *ev_application_class)
 
static void ev_application_init (EvApplication *ev_application)
 
gboolean ev_application_has_window (EvApplication *application)
 
guint ev_application_get_n_windows (EvApplication *application)
 
const gchar * ev_application_get_uri (EvApplication *application)
 
GObject * ev_application_get_media_keys (EvApplication *application)
 
const gchar * ev_application_get_dot_dir (EvApplication *application, gboolean create)
 
void ev_application_show_help (EvApplication *application, GdkScreen *screen, const char *topic)
 

Function Documentation

static void _ev_application_open_uri_at_dest ( EvApplication application,
const gchar *  uri,
GdkScreen *  screen,
EvLinkDest dest,
EvWindowRunMode  mode,
const gchar *  search_string,
guint  timestamp 
)
static

Definition at line 589 of file ev-application.c.

596 {
597  EvWindow *ev_window;
598 
599  ev_window = ev_application_get_empty_window (application, screen);
600  if (!ev_window)
601  ev_window = EV_WINDOW (ev_window_new ());
602 
603  ev_application_open_uri_in_window (application, uri, ev_window,
604  screen, dest, mode,
605  search_string,
606  timestamp);
607 }

+ Here is the caller graph for this function:

static void app_about_cb ( GSimpleAction *  action,
GVariant *  parameter,
gpointer  user_data 
)
static

Definition at line 973 of file ev-application.c.

976 {
977  EvApplication *application = user_data;
978 
979  const char *authors[] = {
980  "Martin Kretzschmar <m_kretzschmar@gmx.net>",
981  "Jonathan Blandford <jrb@gnome.org>",
982  "Marco Pesenti Gritti <marco@gnome.org>",
983  "Nickolay V. Shmyrev <nshmyrev@yandex.ru>",
984  "Bryan Clark <clarkbw@gnome.org>",
985  "Carlos Garcia Campos <carlosgc@gnome.org>",
986  "Wouter Bolsterlee <wbolster@gnome.org>",
987  "Christian Persch <chpe" "\100" "gnome.org>",
988  NULL
989  };
990  const char *documenters[] = {
991  "Nickolay V. Shmyrev <nshmyrev@yandex.ru>",
992  "Phil Bull <philbull@gmail.com>",
993  "Tiffany Antpolski <tiffany.antopolski@gmail.com>",
994  NULL
995  };
996  const char *license[] = {
997  N_("Evince is free software; you can redistribute it and/or modify "
998  "it under the terms of the GNU General Public License as published by "
999  "the Free Software Foundation; either version 2 of the License, or "
1000  "(at your option) any later version.\n"),
1001  N_("Evince is distributed in the hope that it will be useful, "
1002  "but WITHOUT ANY WARRANTY; without even the implied warranty of "
1003  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
1004  "GNU General Public License for more details.\n"),
1005  N_("You should have received a copy of the GNU General Public License "
1006  "along with Evince; if not, write to the Free Software Foundation, Inc., "
1007  "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n")
1008  };
1009  char *license_trans;
1010 #ifdef ENABLE_NLS
1011  const char **p;
1012 
1013  for (p = authors; *p; ++p)
1014  *p = _(*p);
1015 
1016  for (p = documenters; *p; ++p)
1017  *p = _(*p);
1018 #endif
1019 
1020  license_trans = g_strconcat (_(license[0]), "\n",
1021  _(license[1]), "\n",
1022  _(license[2]), "\n",
1023  NULL);
1024 
1025  gtk_show_about_dialog (gtk_application_get_active_window (GTK_APPLICATION (application)),
1026  "name", _("Evince"),
1027  "version", VERSION,
1028  "copyright", _("© 1996–2014 The Evince authors"),
1029  "license", license_trans,
1030  "website", "https://wiki.gnome.org/Apps/Evince",
1031  "comments", _("Document Viewer"),
1032  "authors", authors,
1033  "documenters", documenters,
1034  "translator-credits", _("translator-credits"),
1035  "logo-icon-name", "evince",
1036  "wrap-license", TRUE,
1037  NULL);
1038 
1039  g_free (license_trans);
1040 }

+ Here is the caller graph for this function:

static void app_help_cb ( GSimpleAction *  action,
GVariant *  parameter,
gpointer  user_data 
)
static

Definition at line 963 of file ev-application.c.

966 {
967  EvApplication *application = user_data;
968 
969  ev_application_show_help (application, NULL, NULL);
970 }

+ Here is the caller graph for this function:

static void app_new_cb ( GSimpleAction *  action,
GVariant *  parameter,
gpointer  user_data 
)
static

Definition at line 941 of file ev-application.c.

944 {
945  EvApplication *application = user_data;
946  GList *windows, *l;
947  GtkWindow *window = NULL;
948 
949  windows = gtk_application_get_windows (GTK_APPLICATION (application));
950  for (l = windows; l != NULL; l = l->next) {
951  if (EV_IS_WINDOW (l->data)) {
952  window = GTK_WINDOW (l->data);
953  break;
954  }
955  }
956 
957  ev_application_new_window (application,
958  window ? gtk_window_get_screen (window) : gdk_screen_get_default (),
959  gtk_get_current_event_time ());
960 }

+ Here is the caller graph for this function:

static void ev_application_accel_map_load ( EvApplication application)
static

Definition at line 835 of file ev-application.c.

836 {
837  gchar *accel_map_file;
838 
839  accel_map_file = g_build_filename (application->dot_dir, "accels", NULL);
840  gtk_accel_map_load (accel_map_file);
841  g_free (accel_map_file);
842 }

+ Here is the caller graph for this function:

static void ev_application_accel_map_save ( EvApplication application)
static

Definition at line 805 of file ev-application.c.

806 {
807  gchar *accel_map_file;
808  gchar *tmp_filename;
809  gint fd;
810 
811  accel_map_file = g_build_filename (application->dot_dir, "accels", NULL);
812  tmp_filename = g_strdup_printf ("%s.XXXXXX", accel_map_file);
813 
814  fd = g_mkstemp (tmp_filename);
815  if (fd == -1) {
816  g_free (accel_map_file);
817  g_free (tmp_filename);
818 
819  return;
820  }
821  gtk_accel_map_save_fd (fd);
822  close (fd);
823 
824  g_mkdir_with_parents (application->dot_dir, 0700);
825  if (g_rename (tmp_filename, accel_map_file) == -1) {
826  /* FIXME: win32? */
827  g_unlink (tmp_filename);
828  }
829 
830  g_free (accel_map_file);
831  g_free (tmp_filename);
832 }

+ Here is the caller graph for this function:

static void ev_application_activate ( GApplication *  gapplication)
static

Definition at line 1129 of file ev-application.c.

1130 {
1131  EvApplication *application = EV_APPLICATION (gapplication);
1132  GList *windows, *l;
1133 
1134  windows = gtk_application_get_windows (GTK_APPLICATION (application));
1135  for (l = windows; l != NULL; l = l->next) {
1136  if (!EV_IS_WINDOW (l->data))
1137  continue;
1138 
1139  gtk_window_present (GTK_WINDOW (l->data));
1140  }
1141 }

+ Here is the caller graph for this function:

static void ev_application_class_init ( EvApplicationClass ev_application_class)
static

Definition at line 1206 of file ev-application.c.

1207 {
1208  GApplicationClass *g_application_class = G_APPLICATION_CLASS (ev_application_class);
1209 
1210  g_application_class->startup = ev_application_startup;
1211  g_application_class->activate = ev_application_activate;
1212  g_application_class->shutdown = ev_application_shutdown;
1213 
1214 #ifdef ENABLE_DBUS
1215  g_application_class->dbus_register = ev_application_dbus_register;
1216  g_application_class->dbus_unregister = ev_application_dbus_unregister;
1217 #endif
1218 }
const gchar* ev_application_get_dot_dir ( EvApplication application,
gboolean  create 
)

Definition at line 1289 of file ev-application.c.

1291 {
1292  if (create)
1293  g_mkdir_with_parents (application->dot_dir, 0700);
1294 
1295  return application->dot_dir;
1296 }

+ Here is the caller graph for this function:

static EvWindow* ev_application_get_empty_window ( EvApplication application,
GdkScreen *  screen 
)
static

Definition at line 253 of file ev-application.c.

255 {
256  EvWindow *empty_window = NULL;
257  GList *windows, *l;
258 
259  windows = gtk_application_get_windows (GTK_APPLICATION (application));
260  for (l = windows; l != NULL; l = l->next) {
261  EvWindow *window;
262 
263  if (!EV_IS_WINDOW (l->data))
264  continue;
265 
266  window = EV_WINDOW (l->data);
267 
268  if (ev_window_is_empty (window) &&
269  gtk_window_get_screen (GTK_WINDOW (window)) == screen) {
270  empty_window = window;
271  break;
272  }
273  }
274 
275  return empty_window;
276 }

+ Here is the caller graph for this function:

GObject* ev_application_get_media_keys ( EvApplication application)

ev_application_get_media_keys: : The instance of the application.

It gives you access to the media player keys handler object.

Returns: A EvMediaPlayerKeys.

Definition at line 1279 of file ev-application.c.

1280 {
1281 #ifdef ENABLE_DBUS
1282  return G_OBJECT (application->keys);
1283 #else
1284  return NULL;
1285 #endif /* ENABLE_DBUS */
1286 }

+ Here is the caller graph for this function:

guint ev_application_get_n_windows ( EvApplication application)

Definition at line 1248 of file ev-application.c.

1249 {
1250  GList *l, *windows;
1251  guint retval = 0;
1252 
1253  windows = gtk_application_get_windows (GTK_APPLICATION (application));
1254  for (l = windows; l != NULL && !retval; l = l->next) {
1255  if (!EV_IS_WINDOW (l->data))
1256  continue;
1257 
1258  retval++;
1259  }
1260 
1261  return retval;
1262 }
const gchar* ev_application_get_uri ( EvApplication application)

Definition at line 1265 of file ev-application.c.

1266 {
1267  return application->uri;
1268 }

+ Here is the caller graph for this function:

gboolean ev_application_has_window ( EvApplication application)

Definition at line 1232 of file ev-application.c.

1233 {
1234  GList *l, *windows;
1235 
1236  windows = gtk_application_get_windows (GTK_APPLICATION (application));
1237  for (l = windows; l != NULL; l = l->next) {
1238  if (!EV_IS_WINDOW (l->data))
1239  continue;
1240 
1241  return TRUE;
1242  }
1243 
1244  return FALSE;
1245 }

+ Here is the caller graph for this function:

static void ev_application_init ( EvApplication ev_application)
static

Definition at line 1221 of file ev-application.c.

1222 {
1223  ev_application->dot_dir = g_build_filename (g_get_user_config_dir (),
1224  "evince", NULL);
1225  if (!g_file_test (ev_application->dot_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
1226  ev_application_migrate_config_dir (ev_application);
1227 
1228  ev_application_accel_map_load (ev_application);
1229 }
static void ev_application_migrate_config_dir ( EvApplication application)
static

Definition at line 845 of file ev-application.c.

846 {
847  const gchar *userdir;
848  gchar *old_dot_dir;
849  gchar *old_accels;
850  GError *error;
851  gint i;
852  gboolean dir_created = FALSE;
853  static const gchar *config_files[] = {
854  "evince_toolbar.xml",
855  "print-settings",
856  NULL
857  };
858 
859  userdir = g_getenv ("GNOME22_USER_DIR");
860  if (userdir) {
861  old_dot_dir = g_build_filename (userdir, "evince", NULL);
862  old_accels = g_build_filename (userdir, "accels", "evince", NULL);
863  } else {
864  old_dot_dir = g_build_filename (g_get_home_dir (),
865  ".gnome2",
866  "evince",
867  NULL);
868  old_accels = g_build_filename (g_get_home_dir (),
869  ".gnome2", "accels",
870  "evince", NULL);
871  }
872 
873  if (g_file_test (old_dot_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) {
874  for (i = 0; config_files[i]; i++) {
875  gchar *old_filename;
876  gchar *new_filename;
877  GFile *old_file;
878  GFile *new_file;
879 
880  old_filename = g_build_filename (old_dot_dir, config_files[i], NULL);
881  if (!g_file_test (old_filename, G_FILE_TEST_EXISTS)) {
882  g_free (old_filename);
883  continue;
884  }
885 
886  if (!dir_created) {
887  g_mkdir_with_parents (application->dot_dir, 0700);
888  dir_created = TRUE;
889  }
890 
891  new_filename = g_build_filename (application->dot_dir, config_files[i], NULL);
892  old_file = g_file_new_for_path (old_filename);
893  new_file = g_file_new_for_path (new_filename);
894 
895  error = NULL;
896  g_file_move (old_file, new_file, 0, NULL, NULL, NULL, &error);
897  if (error) {
898  g_printerr ("Error migrating config file %s: %s\n",
899  old_filename, error->message);
900  g_error_free (error);
901  }
902 
903  g_free (old_filename);
904  g_free (new_filename);
905  g_object_unref (old_file);
906  g_object_unref (new_file);
907  }
908  }
909 
910  g_free (old_dot_dir);
911 
912  if (g_file_test (old_accels, G_FILE_TEST_EXISTS)) {
913  gchar *new_accels;
914  GFile *old_accels_file;
915  GFile *new_accels_file;
916 
917  if (!dir_created)
918  g_mkdir_with_parents (application->dot_dir, 0700);
919 
920  new_accels = g_build_filename (application->dot_dir, "accels", NULL);
921  old_accels_file = g_file_new_for_path (old_accels);
922  new_accels_file = g_file_new_for_path (new_accels);
923 
924  error = NULL;
925  g_file_move (old_accels_file, new_accels_file, 0, NULL, NULL, NULL, &error);
926  if (error) {
927  g_printerr ("Error migrating accelerator specifications file %s: %s\n",
928  old_accels, error->message);
929  g_error_free (error);
930  }
931 
932  g_free (new_accels);
933  g_object_unref (old_accels_file);
934  g_object_unref (new_accels_file);
935  }
936 
937  g_free (old_accels);
938 }

+ Here is the caller graph for this function:

EvApplication* ev_application_new ( void  )

ev_application_new:

Creates a new EvApplication instance.

Returns: (transfer full): a newly created EvApplication

Definition at line 100 of file ev-application.c.

101 {
102  const GApplicationFlags flags = G_APPLICATION_NON_UNIQUE;
103 
104  return g_object_new (EV_TYPE_APPLICATION,
105  "application-id", NULL,
106  "flags", flags,
107  NULL);
108 }

+ Here is the caller graph for this function:

static void ev_application_new_window ( EvApplication application,
GdkScreen *  screen,
guint32  timestamp 
)
static

Definition at line 649 of file ev-application.c.

652 {
653  /* spawn an empty window */
654  ev_spawn (NULL, screen, NULL, EV_WINDOW_MODE_NORMAL, NULL, timestamp);
655 }

+ Here is the caller graph for this function:

void ev_application_open_recent_view ( EvApplication application,
GdkScreen *  screen,
guint32  timestamp 
)

ev_application_open_recent_view: : The instance of the application. : Current time value.

Creates a new window showing the recent view

Definition at line 665 of file ev-application.c.

668 {
669  GtkWidget *new_window = ev_window_new ();
670 
671  ev_window_open_recent_view (EV_WINDOW (new_window));
672 
673 #ifdef GDK_WINDOWING_X11
674  GdkWindow *gdk_window;
675 #endif
676 
677  if (screen) {
678  ev_stock_icons_set_screen (screen);
679  gtk_window_set_screen (GTK_WINDOW (new_window), screen);
680  }
681 
682  if (!gtk_widget_get_realized (new_window))
683  gtk_widget_realize (new_window);
684 
685 #ifdef GDK_WINDOWING_X11
686  gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));
687  if (GDK_IS_X11_WINDOW (gdk_window)) {
688  if (timestamp <= 0)
689  timestamp = gdk_x11_get_server_time (gdk_window);
690  gdk_x11_window_set_user_time (gdk_window, timestamp);
691 
692  gtk_window_present (GTK_WINDOW (new_window));
693  } else
694 #endif /* GDK_WINDOWING_X11 */
695  {
696  gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
697  }
698 }

+ Here is the caller graph for this function:

void ev_application_open_uri_at_dest ( EvApplication application,
const char *  uri,
GdkScreen *  screen,
EvLinkDest dest,
EvWindowRunMode  mode,
const gchar *  search_string,
guint  timestamp 
)

ev_application_open_uri_at_dest: : The instance of the application. : The uri to be opened. : Thee screen where the link will be shown. : The EvLinkDest of the document. : The run mode of the window. : The word or phrase to find in the document. : Current time value.

Definition at line 620 of file ev-application.c.

627 {
628  g_return_if_fail (uri != NULL);
629 
630  if (application->uri && strcmp (application->uri, uri) != 0) {
631  /* spawn a new evince process */
632  ev_spawn (uri, screen, dest, mode, search_string, timestamp);
633  return;
634  } else if (!application->uri) {
635  application->uri = g_strdup (uri);
636  }
637 
638 #ifdef ENABLE_DBUS
639  /* Register the uri or send Reload to
640  * remote instance if already registered
641  */
642  ev_application_register_uri (application, uri, screen, dest, mode, search_string, timestamp);
643 #else
644  _ev_application_open_uri_at_dest (application, uri, screen, dest, mode, search_string, timestamp);
645 #endif /* ENABLE_DBUS */
646 }

+ Here is the caller graph for this function:

static void ev_application_open_uri_in_window ( EvApplication application,
const char *  uri,
EvWindow ev_window,
GdkScreen *  screen,
EvLinkDest dest,
EvWindowRunMode  mode,
const gchar *  search_string,
guint  timestamp 
)
static

Definition at line 545 of file ev-application.c.

553 {
554 #ifdef GDK_WINDOWING_X11
555  GdkWindow *gdk_window;
556 #endif
557 
558  if (uri == NULL)
559  uri = application->uri;
560 
561  if (screen) {
562  ev_stock_icons_set_screen (screen);
563  gtk_window_set_screen (GTK_WINDOW (ev_window), screen);
564  }
565 
566  /* We need to load uri before showing the window, so
567  we can restore window size without flickering */
568  ev_window_open_uri (ev_window, uri, dest, mode, search_string);
569 
570  if (!gtk_widget_get_realized (GTK_WIDGET (ev_window)))
571  gtk_widget_realize (GTK_WIDGET (ev_window));
572 
573 #ifdef GDK_WINDOWING_X11
574  gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));
575  if (GDK_IS_X11_WINDOW (gdk_window)) {
576  if (timestamp <= 0)
577  timestamp = gdk_x11_get_server_time (gdk_window);
578  gdk_x11_window_set_user_time (gdk_window, timestamp);
579 
580  gtk_window_present (GTK_WINDOW (ev_window));
581  } else
582 #endif /* GDK_WINDOWING_X11 */
583  {
584  gtk_window_present_with_time (GTK_WINDOW (ev_window), timestamp);
585  }
586 }

+ Here is the caller graph for this function:

void ev_application_open_uri_list ( EvApplication application,
GSList *  uri_list,
GdkScreen *  screen,
guint  timestamp 
)

Definition at line 790 of file ev-application.c.

794 {
795  GSList *l;
796 
797  for (l = uri_list; l != NULL; l = l->next) {
798  ev_application_open_uri_at_dest (application, (char *)l->data,
799  screen, NULL, 0, NULL,
800  timestamp);
801  }
802 }

+ Here is the caller graph for this function:

void ev_application_show_help ( EvApplication application,
GdkScreen *  screen,
const char *  topic 
)

ev_application_show_help: : the EvApplication : (allow-none): a #GdkScreen, or NULL to use the default screen : (allow-none): the help topic, or NULL to show the index

Launches the help viewer on to show the evince help. If is NULL, shows the help index; otherwise the topic.

Definition at line 1308 of file ev-application.c.

1311 {
1312  char *escaped_topic, *uri;
1313 
1314  if (topic != NULL) {
1315  escaped_topic = g_uri_escape_string (topic, NULL, TRUE);
1316  uri = g_strdup_printf ("help:evince/%s", escaped_topic);
1317  g_free (escaped_topic);
1318  } else {
1319  uri = g_strdup ("help:evince");
1320  }
1321 
1322  gtk_show_uri (screen, uri, gtk_get_current_event_time (), NULL);
1323  g_free (uri);
1324 }

+ Here is the caller graph for this function:

static void ev_application_shutdown ( GApplication *  gapplication)
static

Definition at line 1107 of file ev-application.c.

1108 {
1109  EvApplication *application = EV_APPLICATION (gapplication);
1110 
1111  if (application->uri) {
1112 #ifdef ENABLE_DBUS
1113  ev_application_unregister_uri (application,
1114  application->uri);
1115 #endif
1116  g_free (application->uri);
1117  application->uri = NULL;
1118  }
1119 
1120  ev_application_accel_map_save (application);
1121 
1122  g_free (application->dot_dir);
1123  application->dot_dir = NULL;
1124 
1125  G_APPLICATION_CLASS (ev_application_parent_class)->shutdown (gapplication);
1126 }

+ Here is the caller graph for this function:

static void ev_application_startup ( GApplication *  gapplication)
static

Definition at line 1043 of file ev-application.c.

1044 {
1045  const GActionEntry app_menu_actions[] = {
1046  { "new", app_new_cb, NULL, NULL, NULL },
1047  { "help", app_help_cb, NULL, NULL, NULL },
1048  { "about", app_about_cb, NULL, NULL, NULL }
1049  };
1050 
1051  const gchar *action_accels[] = {
1052  "win.open", "<Ctrl>O", NULL,
1053  "win.open-copy", "<Ctrl>N", NULL,
1054  "win.save-copy", "<Ctrl>S", NULL,
1055  "win.print", "<Ctrl>P", NULL,
1056  "win.show-properties", "<alt>Return", NULL,
1057  "win.copy", "<Ctrl>C", "<Ctrl>Insert", NULL,
1058  "win.select-all", "<Ctrl>A", NULL,
1059  "win.save-settings", "<Ctrl>T", NULL,
1060  "win.add-bookmark", "<Ctrl>D", NULL,
1061  "win.close", "<Ctrl>W", NULL,
1062  "win.escape", "Escape", NULL,
1063  "win.find", "<Ctrl>F", "slash", NULL,
1064  "win.find-next", "<Ctrl>G", NULL,
1065  "win.find-previous", "<Ctrl><Shift>G", NULL,
1066  "win.select-page", "<Ctrl>L", NULL,
1067  "win.go-backwards", "<Shift>Page_Up", NULL,
1068  "win.go-forward", "<Shift>Page_Down", NULL,
1069  "win.go-next-page", "n", NULL,
1070  "win.go-previous-page", "p", NULL,
1071  "win.go-back-history", "<alt>P", NULL,
1072  "win.go-forward-history", "<alt>N", NULL,
1073  "win.sizing-mode::fit-page", "f", NULL,
1074  "win.sizing-mode::fit-width", "w", NULL,
1075  "win.open-menu", "F10", NULL,
1076  "win.caret-navigation", "F7", NULL,
1077  "win.zoom-in", "plus", "<Ctrl>plus", "KP_Add", "<Ctrl>KP_Add", "equal", "<Ctrl>equal", NULL,
1078  "win.zoom-out", "minus", "<Ctrl>minus", "KP_Subtract", "<Ctrl>KP_Subtract", NULL,
1079  "win.show-side-pane", "F9", NULL,
1080  "win.fullscreen", "F11", NULL,
1081  "win.presentation", "F5", NULL,
1082  "win.continuous", "c", NULL,
1083  "win.dual-page", "d", NULL,
1084  "win.rotate-left", "<Ctrl>Left", NULL,
1085  "win.rotate-right", "<Ctrl>Right", NULL,
1086  "win.inverted-colors", "<Ctrl>I", NULL,
1087  "win.reload", "<Ctrl>R", NULL,
1088  NULL
1089  };
1090 
1091  EvApplication *application = EV_APPLICATION (gapplication);
1092  const gchar **it;
1093 
1094  g_application_set_resource_base_path (gapplication, "/org/gnome/evince");
1095 
1096  G_APPLICATION_CLASS (ev_application_parent_class)->startup (gapplication);
1097 
1098  g_action_map_add_action_entries (G_ACTION_MAP (application),
1099  app_menu_actions, G_N_ELEMENTS (app_menu_actions),
1100  application);
1101 
1102  for (it = action_accels; it[0]; it += g_strv_length ((gchar **)it) + 1)
1103  gtk_application_set_accels_for_action (GTK_APPLICATION (application), it[0], &it[1]);
1104 }

+ Here is the caller graph for this function:

static void ev_spawn ( const char *  uri,
GdkScreen *  screen,
EvLinkDest dest,
EvWindowRunMode  mode,
const gchar *  search_string,
guint  timestamp 
)
static

Definition at line 148 of file ev-application.c.

154 {
155  GString *cmd;
156  gchar *path, *cmdline;
157  GAppInfo *app;
158  GError *error = NULL;
159 
160  cmd = g_string_new (NULL);
161 
162 #ifdef G_OS_WIN32
163 {
164  gchar *dir;
165 
166  dir = g_win32_get_package_installation_directory_of_module (NULL);
167  path = g_build_filename (dir, "bin", "evince", NULL);
168 
169  g_free (dir);
170 }
171 #else
172  path = g_build_filename (BINDIR, "evince", NULL);
173 #endif
174 
175  g_string_append_printf (cmd, " %s", path);
176  g_free (path);
177 
178  /* Page label */
179  if (dest) {
180  switch (ev_link_dest_get_dest_type (dest)) {
182  g_string_append_printf (cmd, " --page-label=%s",
184  break;
186  g_string_append_printf (cmd, " --page-index=%d",
187  ev_link_dest_get_page (dest) + 1);
188  break;
190  g_string_append_printf (cmd, " --named-dest=%s",
192  break;
193  default:
194  break;
195  }
196  }
197 
198  /* Find string */
199  if (search_string) {
200  g_string_append_printf (cmd, " --find=%s", search_string);
201  }
202 
203  /* Mode */
204  switch (mode) {
206  g_string_append (cmd, " -f");
207  break;
209  g_string_append (cmd, " -s");
210  break;
211  default:
212  break;
213  }
214 
215  cmdline = g_string_free (cmd, FALSE);
216  app = g_app_info_create_from_commandline (cmdline, NULL, G_APP_INFO_CREATE_SUPPORTS_URIS, &error);
217 
218  if (app != NULL) {
219  GList uri_list;
220  GList *uris = NULL;
221  GdkAppLaunchContext *ctx;
222 
223  ctx = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
224  gdk_app_launch_context_set_screen (ctx, screen);
225  gdk_app_launch_context_set_timestamp (ctx, timestamp);
226 
227  /* Some URIs can be changed when passed through a GFile
228  * (for instance unsupported uris with strange formats like mailto:),
229  * so if you have a textual uri you want to pass in as argument,
230  * consider using g_app_info_launch_uris() instead.
231  * See https://bugzilla.gnome.org/show_bug.cgi?id=644604
232  */
233  if (uri) {
234  uri_list.data = (gchar *)uri;
235  uri_list.prev = uri_list.next = NULL;
236  uris = &uri_list;
237  }
238  g_app_info_launch_uris (app, uris, G_APP_LAUNCH_CONTEXT (ctx), &error);
239 
240  g_object_unref (app);
241  g_object_unref (ctx);
242  }
243 
244  if (error != NULL) {
245  g_printerr ("Error launching evince %s: %s\n", uri, error->message);
246  g_error_free (error);
247  }
248 
249  g_free (cmdline);
250 }

+ Here is the caller graph for this function: