[eog] Use GtkApplication to inhibit the screensaver during slideshows
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Use GtkApplication to inhibit the screensaver during slideshows
- Date: Tue, 2 Oct 2012 17:26:28 +0000 (UTC)
commit e8b50ab48a5a068ee56a29f9709b499d03781d4a
Author: Felix Riemann <friemann gnome org>
Date: Sun Sep 23 17:50:02 2012 +0200
Use GtkApplication to inhibit the screensaver during slideshows
Realized in a similar fashion as in Evince and Totem.
https://bugzilla.gnome.org/show_bug.cgi?id=684581
configure.ac | 2 +-
src/Makefile.am | 5 -----
src/eog-application-internal.h | 3 ---
src/eog-application.c | 30 ------------------------------
src/eog-application.h | 4 ----
src/eog-window.c | 39 +++++++++++++++++++++++++++++++++++++--
6 files changed, 38 insertions(+), 45 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7ddf590..1d414a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,7 +83,7 @@ YELP_HELP_INIT
# GNOME Libs
# **********
-GTK_REQUIRED=3.3.6
+GTK_REQUIRED=3.3.8
GLIB_REQUIRED=2.31.0
GNOME_DESKTOP_REQUIRED=2.91.2
GDKPIXBUF_REQUIRED=2.4.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 2273bdf..39f8403 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,8 +4,6 @@ endif
toolbar_LIB = $(top_builddir)/cut-n-paste/toolbar-editor/libtoolbareditor.la
-screensaver_LIB = $(top_builddir)/cut-n-paste/totem-screensaver/libtotemscrsaver.la
-
noinst_LTLIBRARIES = libeog.la
bin_PROGRAMS = eog
@@ -136,7 +134,6 @@ endif HAVE_EXEMPI
libeog_la_CPPFLAGS = \
-I$(top_srcdir)/jpegutils \
-I$(top_srcdir)/cut-n-paste/toolbar-editor \
- -I$(top_srcdir)/cut-n-paste/totem-screensaver \
-DG_LOG_DOMAIN=\"EOG\" \
-DEOG_PREFIX=\""${prefix}"\" \
-DEOG_DATA_DIR=\""$(pkgdatadir)"\" \
@@ -167,7 +164,6 @@ eog_SOURCES = main.c
eog_CFLAGS = \
-I$(top_srcdir)/cut-n-paste/toolbar-editor \
- -I$(top_srcdir)/cut-n-paste/totem-screensaver \
$(EOG_CFLAGS) \
-DEOG_DATA_DIR=\""$(pkgdatadir)"\" \
-DEOG_LOCALE_DIR=\""$(datadir)/locale"\" \
@@ -178,7 +174,6 @@ eog_LDADD = \
$(EOG_LIBS) \
$(LIBJPEG) \
$(toolbar_LIB) \
- $(screensaver_LIB) \
$(jpeg_LIB) \
$(INTROSPECTION_LIBS)
diff --git a/src/eog-application-internal.h b/src/eog-application-internal.h
index dc02977..7b271a0 100644
--- a/src/eog-application-internal.h
+++ b/src/eog-application-internal.h
@@ -35,8 +35,6 @@
#include "egg-toolbars-model.h"
#include "eog-window.h"
-#include "totem-scrsaver.h"
-
G_BEGIN_DECLS
struct _EogApplicationPrivate {
@@ -44,7 +42,6 @@ struct _EogApplicationPrivate {
gchar *toolbars_file;
EogPluginEngine *plugin_engine;
- TotemScrsaver *scr_saver;
EogStartupFlags flags;
GSettings *ui_settings;
diff --git a/src/eog-application.c b/src/eog-application.c
index dde8e67..b9cfb11 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -35,8 +35,6 @@
#include "eog-application-internal.h"
#include "eog-util.h"
-#include "totem-scrsaver.h"
-
#include <string.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -732,34 +730,6 @@ eog_application_reset_toolbars_model (EogApplication *app)
EGG_TB_MODEL_NOT_REMOVABLE);
}
-/**
- * eog_application_screensaver_enable:
- * @application: an #EogApplication.
- *
- * Enables the screensaver. Usually necessary after a call to
- * eog_application_screensaver_disable().
- **/
-void
-eog_application_screensaver_enable (EogApplication *application)
-{
- if (application->priv->scr_saver)
- totem_scrsaver_enable (application->priv->scr_saver);
-}
-
-/**
- * eog_application_screensaver_disable:
- * @application: an #EogApplication.
- *
- * Disables the screensaver. Useful when the application is in fullscreen or
- * similar mode.
- **/
-void
-eog_application_screensaver_disable (EogApplication *application)
-{
- if (application->priv->scr_saver)
- totem_scrsaver_disable (application->priv->scr_saver);
-}
-
static void
eog_application_load_accelerators (void)
{
diff --git a/src/eog-application.h b/src/eog-application.h
index 82377d6..7a451a7 100644
--- a/src/eog-application.h
+++ b/src/eog-application.h
@@ -84,10 +84,6 @@ gboolean eog_application_open_uris (EogApplication *applicati
EogStartupFlags flags,
GError **error);
-void eog_application_screensaver_enable (EogApplication *application);
-
-void eog_application_screensaver_disable (EogApplication *application);
-
G_END_DECLS
#endif /* __EOG_APPLICATION_H__ */
diff --git a/src/eog-window.c b/src/eog-window.c
index ae8f81c..25f27ad 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -161,6 +161,8 @@ struct _EogWindowPrivate {
gint slideshow_switch_timeout;
GSource *slideshow_switch_source;
+ guint fullscreen_idle_inhibit_cookie;
+
guint recent_menu_id;
EogJob *load_job;
@@ -2020,6 +2022,37 @@ update_ui_visibility (EogWindow *window)
}
static void
+eog_window_inhibit_screensaver (EogWindow *window)
+{
+ EogWindowPrivate *priv = window->priv;
+
+ g_return_if_fail (priv->fullscreen_idle_inhibit_cookie == 0);
+
+ eog_debug (DEBUG_WINDOW);
+
+ window->priv->fullscreen_idle_inhibit_cookie =
+ gtk_application_inhibit (GTK_APPLICATION (EOG_APP),
+ GTK_WINDOW (window),
+ GTK_APPLICATION_INHIBIT_IDLE,
+ _("Viewing a slideshow"));
+}
+
+static void
+eog_window_uninhibit_screensaver (EogWindow *window)
+{
+ EogWindowPrivate *priv = window->priv;
+
+ if (G_UNLIKELY (priv->fullscreen_idle_inhibit_cookie == 0))
+ return;
+
+ eog_debug (DEBUG_WINDOW);
+
+ gtk_application_uninhibit (GTK_APPLICATION (EOG_APP),
+ priv->fullscreen_idle_inhibit_cookie);
+ priv->fullscreen_idle_inhibit_cookie = 0;
+}
+
+static void
eog_window_run_fullscreen (EogWindow *window, gboolean slideshow)
{
EogWindowPrivate *priv;
@@ -2098,7 +2131,7 @@ eog_window_run_fullscreen (EogWindow *window, gboolean slideshow)
gtk_window_fullscreen (GTK_WINDOW (window));
eog_window_update_fullscreen_popup (window);
- eog_application_screensaver_disable (EOG_APP);
+ eog_window_inhibit_screensaver (window);
/* Update both actions as we could've already been in one those modes */
eog_window_update_slideshow_action (window);
@@ -2164,7 +2197,7 @@ eog_window_stop_fullscreen (EogWindow *window, gboolean slideshow)
eog_scroll_view_show_cursor (EOG_SCROLL_VIEW (priv->view));
- eog_application_screensaver_enable (EOG_APP);
+ eog_window_uninhibit_screensaver (window);
}
static void
@@ -4693,6 +4726,7 @@ eog_window_init (EogWindow *window)
window->priv->slideshow_loop = FALSE;
window->priv->slideshow_switch_timeout = 0;
window->priv->slideshow_switch_source = NULL;
+ window->priv->fullscreen_idle_inhibit_cookie = 0;
gtk_window_set_geometry_hints (GTK_WINDOW (window),
GTK_WIDGET (window),
@@ -4802,6 +4836,7 @@ eog_window_dispose (GObject *object)
}
slideshow_clear_timeout (window);
+ eog_window_uninhibit_screensaver (window);
g_signal_handlers_disconnect_by_func (gtk_recent_manager_get_default (),
G_CALLBACK (eog_window_recent_manager_changed_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]