1 /* this file is part of evince, a gnome document viewer
3 * Copyright (C) 2004 Martin Kretzschmar
4 * Copyright © 2010 Christian Persch
7 * Martin Kretzschmar <martink@gnome.org>
9 * Evince is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * Evince is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 #include <glib/gi18n.h>
31 #include <glib/gstdio.h>
33 #ifdef GDK_WINDOWING_X11
38 #include "totem-scrsaver.h"
41 #include "eggsmclient.h"
44 #include "ev-application.h"
45 #include "ev-file-helpers.h"
46 #include "ev-stock-icons.h"
49 #include "ev-media-player-keys.h"
50 #endif /* ENABLE_DBUS */
52 struct _EvApplication {
53 GObject base_instance;
61 GDBusConnection *connection;
62 guint registration_id;
63 EvMediaPlayerKeys *keys;
64 gboolean doc_registered;
67 TotemScrsaver *scr_saver;
70 EggSMClient *smclient;
73 gchar *filechooser_open_uri;
74 gchar *filechooser_save_uri;
77 struct _EvApplicationClass {
78 GObjectClass base_class;
81 static EvApplication *instance;
83 G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
86 #define APPLICATION_DBUS_OBJECT_PATH "/org/gnome/evince/Evince"
87 #define APPLICATION_DBUS_INTERFACE "org.gnome.evince.Application"
89 #define EVINCE_DAEMON_SERVICE "org.gnome.evince.Daemon"
90 #define EVINCE_DAEMON_OBJECT_PATH "/org/gnome/evince/Daemon"
91 #define EVINCE_DAEMON_INTERFACE "org.gnome.evince.Daemon"
94 static const gchar *userdir = NULL;
96 static void _ev_application_open_uri_at_dest (EvApplication *application,
100 EvWindowRunMode mode,
101 const gchar *search_string,
103 static void ev_application_open_uri_in_window (EvApplication *application,
108 EvWindowRunMode mode,
109 const gchar *search_string,
113 * ev_application_get_instance:
115 * Checks for #EvApplication instance, if it doesn't exist it does create it.
117 * Returns: an instance of the #EvApplication data.
120 ev_application_get_instance (void)
123 instance = EV_APPLICATION (g_object_new (EV_TYPE_APPLICATION, NULL));
131 ev_application_load_session (EvApplication *application)
133 GKeyFile *state_file;
137 if (egg_sm_client_is_resumed (application->smclient)) {
138 state_file = egg_sm_client_get_state_file (application->smclient);
142 #endif /* WITH_SMCLIENT */
145 uri = g_key_file_get_string (state_file, "Evince", "uri", NULL);
149 ev_application_open_uri_at_dest (application, uri,
150 gdk_screen_get_default (),
154 g_key_file_free (state_file);
162 smclient_save_state_cb (EggSMClient *client,
163 GKeyFile *state_file,
164 EvApplication *application)
166 if (!application->uri)
169 g_key_file_set_string (state_file, "Evince", "uri", application->uri);
173 smclient_quit_cb (EggSMClient *client,
174 EvApplication *application)
176 ev_application_shutdown (application);
178 #endif /* WITH_SMCLIENT */
181 ev_application_init_session (EvApplication *application)
184 application->smclient = egg_sm_client_get ();
185 g_signal_connect (application->smclient, "save_state",
186 G_CALLBACK (smclient_save_state_cb),
188 g_signal_connect (application->smclient, "quit",
189 G_CALLBACK (smclient_quit_cb),
195 * ev_display_open_if_needed:
196 * @name: the name of the display to be open if it's needed.
198 * Search among all the open displays if any of them have the same name as the
199 * passed name. If the display isn't found it tries the open it.
201 * Returns: a #GdkDisplay of the display with the passed name.
204 ev_display_open_if_needed (const gchar *name)
208 GdkDisplay *display = NULL;
210 displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
212 for (l = displays; l != NULL; l = l->next) {
213 const gchar *display_name = gdk_display_get_name ((GdkDisplay *) l->data);
215 if (g_ascii_strcasecmp (display_name, name) == 0) {
221 g_slist_free (displays);
223 return display != NULL ? display : gdk_display_open (name);
227 child_setup (gpointer user_data)
231 startup_id = g_strdup_printf ("_TIME%lu",
232 (unsigned long)GPOINTER_TO_INT (user_data));
233 g_setenv ("DESKTOP_STARTUP_ID", startup_id, TRUE);
238 ev_spawn (const char *uri,
241 EvWindowRunMode mode,
242 const gchar *search_string,
249 GError *error = NULL;
255 dir = g_win32_get_package_installation_directory_of_module (NULL);
256 argv[arg++] = g_build_filename (dir, "bin", "evince", NULL);
260 argv[arg++] = g_build_filename (BINDIR, "evince", NULL);
265 const gchar *page_label;
267 page_label = ev_link_dest_get_page_label (dest);
269 argv[arg++] = g_strdup_printf ("--page-label=%s", page_label);
271 argv[arg++] = g_strdup_printf ("--page-label=%d",
272 ev_link_dest_get_page (dest));
277 argv[arg++] = g_strdup_printf ("--find=%s", search_string);
282 case EV_WINDOW_MODE_FULLSCREEN:
283 argv[arg++] = g_strdup ("-f");
285 case EV_WINDOW_MODE_PRESENTATION:
286 argv[arg++] = g_strdup ("-s");
292 argv[arg++] = (gchar *)uri;
295 res = gdk_spawn_on_screen (screen, NULL /* wd */, argv, NULL /* env */,
298 GINT_TO_POINTER(timestamp),
301 g_warning ("Error launching evince %s: %s\n", uri, error->message);
302 g_error_free (error);
305 for (i = 0; i < arg - 1; i++) {
311 ev_application_get_windows (EvApplication *application)
313 GList *l, *toplevels;
314 GList *windows = NULL;
316 toplevels = gtk_window_list_toplevels ();
318 for (l = toplevels; l != NULL; l = l->next) {
319 if (EV_IS_WINDOW (l->data)) {
320 windows = g_list_append (windows, l->data);
324 g_list_free (toplevels);
330 ev_application_get_empty_window (EvApplication *application,
333 EvWindow *empty_window = NULL;
334 GList *windows = ev_application_get_windows (application);
337 for (l = windows; l != NULL; l = l->next) {
338 EvWindow *window = EV_WINDOW (l->data);
340 if (ev_window_is_empty (window) &&
341 gtk_window_get_screen (GTK_WINDOW (window)) == screen) {
342 empty_window = window;
347 g_list_free (windows);
358 EvWindowRunMode mode;
359 gchar *search_string;
364 ev_register_doc_data_free (EvRegisterDocData *data)
370 if (data->search_string)
371 g_free (data->search_string);
373 g_object_unref (data->dest);
379 on_reload_cb (GObject *source_object,
383 GDBusConnection *connection = G_DBUS_CONNECTION (source_object);
385 GError *error = NULL;
387 value = g_dbus_connection_call_finish (connection, res, &error);
389 g_warning ("Failed to Reload: %s", error->message);
390 g_error_free (error);
392 g_variant_unref (value);
394 ev_application_shutdown (EV_APP);
398 on_register_uri_cb (GObject *source_object,
402 GDBusConnection *connection = G_DBUS_CONNECTION (source_object);
403 EvRegisterDocData *data = (EvRegisterDocData *)user_data;
404 EvApplication *application = EV_APP;
407 GVariantBuilder builder;
408 GError *error = NULL;
410 value = g_dbus_connection_call_finish (connection, res, &error);
412 g_warning ("Error registering document: %s\n", error->message);
413 g_error_free (error);
415 _ev_application_open_uri_at_dest (application,
422 ev_register_doc_data_free (data);
427 g_variant_get (value, "(&s)", &owner);
429 /* This means that the document wasn't already registered; go
430 * ahead with opening it.
432 if (owner[0] == '\0') {
433 g_variant_unref (value);
435 application->doc_registered = TRUE;
437 _ev_application_open_uri_at_dest (application,
444 ev_register_doc_data_free (data);
449 /* Already registered */
450 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(a{sv}u)"));
451 g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
452 g_variant_builder_add (&builder, "{sv}",
454 g_variant_new_string (gdk_display_get_name (gdk_screen_get_display (data->screen))));
455 g_variant_builder_add (&builder, "{sv}",
457 g_variant_new_int32 (gdk_screen_get_number (data->screen)));
459 g_variant_builder_add (&builder, "{sv}",
461 g_variant_new_string (ev_link_dest_get_page_label (data->dest)));
463 if (data->search_string) {
464 g_variant_builder_add (&builder, "{sv}",
466 g_variant_new_string (data->search_string));
468 if (data->mode != EV_WINDOW_MODE_NORMAL) {
469 g_variant_builder_add (&builder, "{sv}",
471 g_variant_new_uint32 (data->mode));
473 g_variant_builder_close (&builder);
475 g_variant_builder_add (&builder, "u", data->timestamp);
477 g_dbus_connection_call (connection,
479 APPLICATION_DBUS_OBJECT_PATH,
480 APPLICATION_DBUS_INTERFACE,
482 g_variant_builder_end (&builder),
484 G_DBUS_CALL_FLAGS_NONE,
489 g_variant_unref (value);
490 ev_register_doc_data_free (data);
494 * ev_application_register_uri:
503 * Registers @uri with evince-daemon.
507 ev_application_register_uri (EvApplication *application,
511 EvWindowRunMode mode,
512 const gchar *search_string,
515 EvRegisterDocData *data;
517 if (!application->connection)
520 if (application->doc_registered) {
521 /* Already registered, reload */
524 windows = ev_application_get_windows (application);
525 for (l = windows; l != NULL; l = g_list_next (l)) {
526 EvWindow *ev_window = EV_WINDOW (l->data);
528 ev_application_open_uri_in_window (application, uri, ev_window,
533 g_list_free (windows);
538 data = g_new (EvRegisterDocData, 1);
539 data->uri = g_strdup (uri);
540 data->screen = screen;
541 data->dest = dest ? g_object_ref (dest) : NULL;
543 data->search_string = search_string ? g_strdup (search_string) : NULL;
544 data->timestamp = timestamp;
546 g_dbus_connection_call (application->connection,
547 EVINCE_DAEMON_SERVICE,
548 EVINCE_DAEMON_OBJECT_PATH,
549 EVINCE_DAEMON_INTERFACE,
551 g_variant_new ("(s)", uri),
552 G_VARIANT_TYPE ("(s)"),
553 G_DBUS_CALL_FLAGS_NONE,
561 ev_application_unregister_uri (EvApplication *application,
565 GError *error = NULL;
567 if (!application->doc_registered)
570 /* This is called from ev_application_shutdown(),
571 * so it's safe to use the sync api
573 value = g_dbus_connection_call_sync (
574 application->connection,
575 EVINCE_DAEMON_SERVICE,
576 EVINCE_DAEMON_OBJECT_PATH,
577 EVINCE_DAEMON_INTERFACE,
578 "UnregisterDocument",
579 g_variant_new ("(s)", uri),
581 G_DBUS_CALL_FLAGS_NO_AUTO_START,
586 g_warning ("Error unregistering document: %s\n", error->message);
587 g_error_free (error);
589 g_variant_unref (value);
592 #endif /* ENABLE_DBUS */
595 ev_application_open_uri_in_window (EvApplication *application,
600 EvWindowRunMode mode,
601 const gchar *search_string,
604 #ifdef GDK_WINDOWING_X11
605 GdkWindow *gdk_window;
609 ev_stock_icons_set_screen (screen);
610 gtk_window_set_screen (GTK_WINDOW (ev_window), screen);
613 /* We need to load uri before showing the window, so
614 we can restore window size without flickering */
615 ev_window_open_uri (ev_window, uri, dest, mode, search_string);
617 if (!gtk_widget_get_realized (GTK_WIDGET (ev_window)))
618 gtk_widget_realize (GTK_WIDGET (ev_window));
620 #ifdef GDK_WINDOWING_X11
621 gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window));
624 timestamp = gdk_x11_get_server_time (gdk_window);
625 gdk_x11_window_set_user_time (gdk_window, timestamp);
627 gtk_window_present (GTK_WINDOW (ev_window));
629 gtk_window_present_with_time (GTK_WINDOW (ev_window), timestamp);
630 #endif /* GDK_WINDOWING_X11 */
634 _ev_application_open_uri_at_dest (EvApplication *application,
638 EvWindowRunMode mode,
639 const gchar *search_string,
644 ev_window = ev_application_get_empty_window (application, screen);
646 ev_window = EV_WINDOW (ev_window_new ());
648 ev_application_open_uri_in_window (application, uri, ev_window,
655 * ev_application_open_uri_at_dest:
656 * @application: The instance of the application.
657 * @uri: The uri to be opened.
658 * @screen: Thee screen where the link will be shown.
659 * @dest: The #EvLinkDest of the document.
660 * @mode: The run mode of the window.
661 * @timestamp: Current time value.
664 ev_application_open_uri_at_dest (EvApplication *application,
668 EvWindowRunMode mode,
669 const gchar *search_string,
672 g_return_if_fail (uri != NULL);
674 if (application->uri && strcmp (application->uri, uri) != 0) {
675 /* spawn a new evince process */
676 ev_spawn (uri, screen, dest, mode, search_string, timestamp);
678 } else if (!application->uri) {
679 application->uri = g_strdup (uri);
683 /* Register the uri or send Reload to
684 * remote instance if already registered
686 ev_application_register_uri (application, uri, screen, dest, mode, search_string, timestamp);
688 _ev_application_open_uri_at_dest (application, uri, screen, dest, mode, search_string, timestamp);
689 #endif /* ENABLE_DBUS */
693 * ev_application_open_window:
694 * @application: The instance of the application.
695 * @timestamp: Current time value.
697 * Creates a new window
700 ev_application_open_window (EvApplication *application,
704 GtkWidget *new_window = ev_window_new ();
705 #ifdef GDK_WINDOWING_X11
706 GdkWindow *gdk_window;
710 ev_stock_icons_set_screen (screen);
711 gtk_window_set_screen (GTK_WINDOW (new_window), screen);
714 if (!gtk_widget_get_realized (new_window))
715 gtk_widget_realize (new_window);
717 #ifdef GDK_WINDOWING_X11
718 gdk_window = gtk_widget_get_window (GTK_WIDGET (new_window));
721 timestamp = gdk_x11_get_server_time (gdk_window);
722 gdk_x11_window_set_user_time (gdk_window, timestamp);
724 gtk_window_present (GTK_WINDOW (new_window));
726 gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp);
727 #endif /* GDK_WINDOWING_X11 */
732 method_call_cb (GDBusConnection *connection,
734 const gchar *object_path,
735 const gchar *interface_name,
736 const gchar *method_name,
737 GVariant *parameters,
738 GDBusMethodInvocation *invocation,
741 EvApplication *application = EV_APPLICATION (user_data);
747 GdkDisplay *display = NULL;
748 int screen_number = 0;
749 EvLinkDest *dest = NULL;
750 EvWindowRunMode mode = EV_WINDOW_MODE_NORMAL;
751 const gchar *search_string = NULL;
752 GdkScreen *screen = NULL;
754 if (g_strcmp0 (method_name, "Reload") == 0) {
755 g_variant_get (parameters, "(a{sv}u)", &iter, ×tamp);
757 while (g_variant_iter_loop (iter, "{&sv}", &key, &value)) {
758 if (strcmp (key, "display") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
759 display = ev_display_open_if_needed (g_variant_get_string (value, NULL));
760 } else if (strcmp (key, "screen") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
761 screen_number = g_variant_get_int32 (value);
762 } else if (strcmp (key, "mode") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_UINT32) {
763 mode = g_variant_get_uint32 (value);
764 } else if (strcmp (key, "page-label") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
765 dest = ev_link_dest_new_page_label (g_variant_get_string (value, NULL));
766 } else if (strcmp (key, "find-string") == 0 && g_variant_classify (value) == G_VARIANT_CLASS_STRING) {
767 search_string = g_variant_get_string (value, NULL);
770 g_variant_iter_free (iter);
772 if (display != NULL &&
773 screen_number >= 0 &&
774 screen_number < gdk_display_get_n_screens (display))
775 screen = gdk_display_get_screen (display, screen_number);
777 screen = gdk_screen_get_default ();
779 windows = ev_application_get_windows (application);
780 for (l = windows; l != NULL; l = g_list_next (l)) {
781 EvWindow *ev_window = EV_WINDOW (l->data);
783 ev_application_open_uri_in_window (application, application->uri,
789 g_list_free (windows);
792 g_object_unref (dest);
794 g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
795 } else if (g_strcmp0 (method_name, "GetWindowList") == 0) {
796 GList *windows = ev_application_get_windows (application);
797 GVariantBuilder builder;
800 g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ao)"));
801 g_variant_builder_open (&builder, G_VARIANT_TYPE ("ao"));
803 for (l = windows; l; l = g_list_next (l)) {
804 EvWindow *window = (EvWindow *)l->data;
806 g_variant_builder_add (&builder, "o", ev_window_get_dbus_object_path (window));
809 g_variant_builder_close (&builder);
810 g_list_free (windows);
812 g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
816 static const char introspection_xml[] =
818 "<interface name='org.gnome.evince.Application'>"
819 "<method name='Reload'>"
820 "<arg type='a{sv}' name='args' direction='in'/>"
821 "<arg type='u' name='timestamp' direction='in'/>"
823 "<method name='GetWindowList'>"
824 "<arg type='ao' name='window_list' direction='out'/>"
829 static const GDBusInterfaceVTable interface_vtable = {
835 static GDBusNodeInfo *introspection_data;
836 #endif /* ENABLE_DBUS */
839 ev_application_open_uri_list (EvApplication *application,
846 for (l = uri_list; l != NULL; l = l->next) {
847 ev_application_open_uri_at_dest (application, (char *)l->data,
848 screen, NULL, 0, NULL,
854 ev_application_accel_map_save (EvApplication *application)
856 gchar *accel_map_file;
861 accel_map_file = g_build_filename (userdir, "accels",
864 accel_map_file = g_build_filename (g_get_home_dir (),
869 tmp_filename = g_strdup_printf ("%s.XXXXXX", accel_map_file);
871 fd = g_mkstemp (tmp_filename);
873 g_free (accel_map_file);
874 g_free (tmp_filename);
878 gtk_accel_map_save_fd (fd);
881 if (g_rename (tmp_filename, accel_map_file) == -1) {
883 g_unlink (tmp_filename);
886 g_free (accel_map_file);
887 g_free (tmp_filename);
891 ev_application_accel_map_load (EvApplication *application)
893 gchar *accel_map_file;
896 accel_map_file = g_build_filename (userdir, "accels",
899 accel_map_file = g_build_filename (g_get_home_dir (),
904 gtk_accel_map_load (accel_map_file);
905 g_free (accel_map_file);
909 ev_application_shutdown (EvApplication *application)
911 if (application->uri) {
913 ev_application_unregister_uri (application,
916 g_free (application->uri);
917 application->uri = NULL;
920 ev_application_accel_map_save (application);
922 g_object_unref (application->scr_saver);
923 application->scr_saver = NULL;
926 if (application->keys) {
927 g_object_unref (application->keys);
928 application->keys = NULL;
930 if (application->registration_id != 0) {
931 g_dbus_connection_unregister_object (application->connection,
932 application->registration_id);
933 application->registration_id = 0;
935 if (application->connection != NULL) {
936 g_object_unref (application->connection);
937 application->connection = NULL;
939 if (introspection_data) {
940 g_dbus_node_info_ref (introspection_data);
941 introspection_data = NULL;
943 #endif /* ENABLE_DBUS */
945 g_free (application->dot_dir);
946 application->dot_dir = NULL;
947 g_free (application->data_dir);
948 application->data_dir = NULL;
949 g_free (application->filechooser_open_uri);
950 application->filechooser_open_uri = NULL;
951 g_free (application->filechooser_save_uri);
952 application->filechooser_save_uri = NULL;
954 g_object_unref (application);
961 ev_application_class_init (EvApplicationClass *ev_application_class)
966 ev_application_init (EvApplication *ev_application)
968 GError *error = NULL;
970 userdir = g_getenv ("GNOME22_USER_DIR");
972 ev_application->dot_dir = g_build_filename (userdir, "evince", NULL);
974 ev_application->dot_dir = g_build_filename (g_get_home_dir (),
983 dir = g_win32_get_package_installation_directory_of_module (NULL);
984 ev_application->data_dir = g_build_filename (dir, "share", "evince", NULL);
988 ev_application->data_dir = g_strdup (EVINCEDATADIR);
991 ev_application_init_session (ev_application);
993 ev_application_accel_map_load (ev_application);
996 ev_application->connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
997 if (ev_application->connection != NULL) {
998 introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
999 g_assert (introspection_data != NULL);
1001 ev_application->registration_id =
1002 g_dbus_connection_register_object (ev_application->connection,
1003 APPLICATION_DBUS_OBJECT_PATH,
1004 introspection_data->interfaces[0],
1006 ev_application, NULL,
1008 if (ev_application->registration_id == 0) {
1009 g_printerr ("Failed to register bus object: %s\n", error->message);
1010 g_error_free (error);
1013 g_printerr ("Failed to get bus connection: %s\n", error->message);
1014 g_error_free (error);
1017 ev_application->keys = ev_media_player_keys_new ();
1018 #endif /* ENABLE_DBUS */
1020 ev_application->scr_saver = totem_scrsaver_new ();
1021 g_object_set (ev_application->scr_saver,
1022 "reason", _("Running in presentation mode"),
1027 ev_application_get_dbus_connection (EvApplication *application)
1030 return application->connection;
1037 ev_application_has_window (EvApplication *application)
1039 GList *l, *toplevels;
1040 gboolean retval = FALSE;
1042 toplevels = gtk_window_list_toplevels ();
1044 for (l = toplevels; l != NULL && !retval; l = l->next) {
1045 if (EV_IS_WINDOW (l->data))
1049 g_list_free (toplevels);
1055 ev_application_get_n_windows (EvApplication *application)
1057 GList *l, *toplevels;
1060 toplevels = gtk_window_list_toplevels ();
1062 for (l = toplevels; l != NULL; l = l->next) {
1063 if (EV_IS_WINDOW (l->data))
1067 g_list_free (toplevels);
1073 ev_application_get_uri (EvApplication *application)
1075 return application->uri;
1079 * ev_application_get_media_keys:
1080 * @application: The instance of the application.
1082 * It gives you access to the media player keys handler object.
1084 * Returns: A #EvMediaPlayerKeys.
1087 ev_application_get_media_keys (EvApplication *application)
1090 return G_OBJECT (application->keys);
1093 #endif /* ENABLE_DBUS */
1097 ev_application_set_filechooser_uri (EvApplication *application,
1098 GtkFileChooserAction action,
1101 if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
1102 g_free (application->filechooser_open_uri);
1103 application->filechooser_open_uri = g_strdup (uri);
1104 } else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
1105 g_free (application->filechooser_save_uri);
1106 application->filechooser_save_uri = g_strdup (uri);
1111 ev_application_get_filechooser_uri (EvApplication *application,
1112 GtkFileChooserAction action)
1114 if (action == GTK_FILE_CHOOSER_ACTION_OPEN) {
1115 if (application->filechooser_open_uri)
1116 return application->filechooser_open_uri;
1117 } else if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
1118 if (application->filechooser_save_uri)
1119 return application->filechooser_save_uri;
1126 ev_application_screensaver_enable (EvApplication *application)
1128 totem_scrsaver_enable (application->scr_saver);
1132 ev_application_screensaver_disable (EvApplication *application)
1134 totem_scrsaver_disable (application->scr_saver);
1138 ev_application_get_dot_dir (EvApplication *application,
1142 g_mkdir_with_parents (application->dot_dir, 0700);
1144 return application->dot_dir;
1148 ev_application_get_data_dir (EvApplication *application)
1150 return application->data_dir;