diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/Makefile.am | 2 | ||||
-rw-r--r-- | shell/ev-application.c | 24 | ||||
-rw-r--r-- | shell/ev-application.h | 2 | ||||
-rw-r--r-- | shell/ev-window.c | 40 |
4 files changed, 36 insertions, 32 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am index a8d40f10..ab91afee 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -5,7 +5,6 @@ AM_CPPFLAGS= \ -I$(top_builddir) \ -I$(top_srcdir)/cut-n-paste/zoom-control/ \ -I$(top_srcdir)/cut-n-paste/toolbar-editor/ \ - -I$(top_srcdir)/cut-n-paste/totem-screensaver/ \ -I$(top_srcdir)/cut-n-paste/smclient/ \ -I$(top_srcdir)/libdocument \ -I$(top_builddir)/libdocument \ @@ -109,7 +108,6 @@ atril_LDFLAGS = $(AM_LDFLAGS) atril_LDADD= \ $(top_builddir)/cut-n-paste/zoom-control/libephyzoom.la \ $(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la \ - $(top_builddir)/cut-n-paste/totem-screensaver/libtotemscrsaver.la \ $(top_builddir)/cut-n-paste/smclient/libsmclient.la \ $(top_builddir)/properties/libevproperties.la \ $(top_builddir)/libdocument/libatrildocument.la \ diff --git a/shell/ev-application.c b/shell/ev-application.c index a64a0568..601a09a6 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -32,8 +32,6 @@ #include <gtk/gtk.h> #include <gdk/gdkx.h> -#include "totem-scrsaver.h" - #include "eggsmclient.h" #include "ev-application.h" @@ -59,8 +57,6 @@ struct _EvApplication { gboolean doc_registered; #endif - TotemScrsaver *scr_saver; - EggSMClient *smclient; }; @@ -885,9 +881,6 @@ ev_application_shutdown (GApplication *gapplication) ev_application_accel_map_save (application); - g_object_unref (application->scr_saver); - application->scr_saver = NULL; - g_free (application->dot_dir); application->dot_dir = NULL; @@ -1002,11 +995,6 @@ static void ev_application_init(EvApplication* ev_application) ev_application_init_session (ev_application); ev_application_accel_map_load (ev_application); - - ev_application->scr_saver = totem_scrsaver_new (); - g_object_set (ev_application->scr_saver, - "reason", _("Running in presentation mode"), - NULL); } gboolean @@ -1066,18 +1054,6 @@ ev_application_get_media_keys (EvApplication *application) #endif /* ENABLE_DBUS */ } -void -ev_application_screensaver_enable (EvApplication *application) -{ - totem_scrsaver_enable (application->scr_saver); -} - -void -ev_application_screensaver_disable (EvApplication *application) -{ - totem_scrsaver_disable (application->scr_saver); -} - const gchar * ev_application_get_dot_dir (EvApplication *application, gboolean create) diff --git a/shell/ev-application.h b/shell/ev-application.h index f0561b55..d8d9cff1 100644 --- a/shell/ev-application.h +++ b/shell/ev-application.h @@ -68,8 +68,6 @@ 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); -void ev_application_screensaver_enable (EvApplication *application); -void ev_application_screensaver_disable (EvApplication *application); const gchar *ev_application_get_dot_dir (EvApplication *application, gboolean create); const gchar *ev_application_get_data_dir (EvApplication *application); diff --git a/shell/ev-window.c b/shell/ev-window.c index 0c8e1298..820b9f32 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -230,6 +230,8 @@ struct _EvWindowPrivate { gchar *dbus_object_path; #endif + guint presentation_mode_inhibit_id; + /* Caret navigation */ GtkWidget *ask_caret_navigation_check; }; @@ -4263,6 +4265,35 @@ ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *window) } static void +ev_window_inhibit_screensaver (EvWindow *window) +{ + EvWindowPrivate *priv = window->priv; + + if (priv->presentation_mode_inhibit_id != 0) + return; + + priv->presentation_mode_inhibit_id = + gtk_application_inhibit (GTK_APPLICATION (g_application_get_default ()), + GTK_WINDOW (window), + GTK_APPLICATION_INHIBIT_IDLE, + _("Running in presentation mode")); +} + + +static void +ev_window_uninhibit_screensaver (EvWindow *window) +{ + EvWindowPrivate *priv = window->priv; + + if (priv->presentation_mode_inhibit_id == 0) + return; + + gtk_application_uninhibit (GTK_APPLICATION (g_application_get_default ()), + priv->presentation_mode_inhibit_id); + priv->presentation_mode_inhibit_id = 0; +} + +static void ev_window_update_presentation_action (EvWindow *window) { GtkAction *action; @@ -4285,7 +4316,7 @@ ev_window_view_presentation_finished (EvWindow *window) static gboolean ev_window_view_presentation_focus_in (EvWindow *window) { - ev_application_screensaver_disable (EV_APP); + ev_window_uninhibit_screensaver (window); return FALSE; } @@ -4293,7 +4324,7 @@ ev_window_view_presentation_focus_in (EvWindow *window) static gboolean ev_window_view_presentation_focus_out (EvWindow *window) { - ev_application_screensaver_enable (EV_APP); + ev_window_uninhibit_screensaver (window); return FALSE; } @@ -4353,7 +4384,7 @@ ev_window_run_presentation (EvWindow *window) gtk_widget_show (window->priv->presentation_view); - ev_application_screensaver_disable (EV_APP); + ev_window_inhibit_screensaver (window); if (window->priv->metadata && !ev_window_is_empty (window)) ev_metadata_set_boolean (window->priv->metadata, "presentation", TRUE); @@ -4392,7 +4423,7 @@ ev_window_stop_presentation (EvWindow *window, gtk_widget_grab_focus (window->priv->webview); } #endif - ev_application_screensaver_enable (EV_APP); + ev_window_uninhibit_screensaver (window); if (window->priv->metadata && !ev_window_is_empty (window)) ev_metadata_set_boolean (window->priv->metadata, "presentation", FALSE); @@ -7625,6 +7656,7 @@ ev_window_init (EvWindow *ev_window) ev_window->priv->page_mode = PAGE_MODE_DOCUMENT; ev_window->priv->chrome = EV_CHROME_NORMAL; + ev_window->priv->presentation_mode_inhibit_id = 0; ev_window->priv->title = ev_window_title_new (ev_window); GtkStyleContext *context; |