[gnome-video-arcade] Inhibit the screen saver in fullscreen mode.
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-video-arcade] Inhibit the screen saver in fullscreen mode.
- Date: Thu, 16 Jul 2009 20:23:08 +0000 (UTC)
commit 85535b2306c9ab3a5f5528c159b2fa03fd58cfa2
Author: Matthew Barnes <mbarnes redhat com>
Date: Thu Jul 16 16:22:10 2009 -0400
Inhibit the screen saver in fullscreen mode.
Adds an optional dependency on dbus-glib-1.
ChangeLog | 29 ++++++
NEWS | 23 +++++
README | 21 ++++-
configure.ac | 39 ++++++--
docs/reference/Makefile.am | 8 ++
docs/reference/gnome-video-arcade-docs.sgml | 1 +
docs/reference/gnome-video-arcade-sections.txt | 6 +
docs/reference/tmpl/gva-dbus.sgml | 39 ++++++++
src/Makefile.am | 23 +++--
src/gva-dbus.c | 124 ++++++++++++++++++++++++
src/gva-dbus.h | 41 ++++++++
src/gva-main.c | 2 +-
src/gva-mame-common.c | 6 +-
src/gva-ui.c | 43 ++++++++
src/gva-util.c | 4 +-
src/gva-wnck.c | 8 +-
src/main.c | 19 +++-
17 files changed, 401 insertions(+), 35 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e62746e..b8c7650 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2009-07-16 Matthew Barnes <mbarnes redhat com>
+
+ * README:
+ Mention dbus-glib-1 as an optional dependency.
+
+ * configure.ac:
+ Add an optional dependency on dbus-glib-1.
+
+ * docs/reference:
+ Update developer documentation.
+
+ * src/Makefile.am:
+ Add DBUS_CFLAGS and DBUS_LIBS, if enabled.
+ Add gva-dbus.[ch]
+
+ * src/main (main):
+ If D-Bus bindings are available, call gva_dbus_init().
+
+ * src/gva-dbus.c:
+ * src/gva-dbus.h:
+ New file implements D-Bus operations for better desktop
+ integration. So far the only operation is to inhibit the
+ screen saver in fullscreen mode.
+
+ * src/gva-ui.c (action_play_back_cb), (action_record_cb),
+ (action_start_cb):
+ If D-Bus bindings are available, call gva_dbus_inhibit_screen_saver()
+ when starting, recording or playing back a game in fullscreen mode.
+
2009-06-12 Matthew Barnes <mbarnes redhat com>
* configure.ac:
diff --git a/NEWS b/NEWS
index 6c2f6f0..bd00ecc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,26 @@
+GNOME Video Arcade 0.6.8
+========================
+
+ Released July ??, 2009
+
+ What's New
+ ----------
+ * Introduce an optional dependency on the GLib bindings for
+ D-Bus, which is used to inhibit GNOME's screen saver from
+ starting while playing a game in fullscreen mode.
+
+ User Interface Translations
+ ---------------------------
+ Complete Italian translation by Diego Pierotto
+ Partial Danish translation by Lars C. Jensen
+ Partial Punjabi translation by A S Alam
+ Partial Spanish translation by Jorge Gonzalez
+
+ Documentation Translations
+ --------------------------
+ Complete Italian translation by Diego Pierotto
+ Partial Spanish translation by Jorge Gonzalez
+
GNOME Video Arcade 0.6.7
========================
diff --git a/README b/README
index 419fe38..ecaf53c 100644
--- a/README
+++ b/README
@@ -64,6 +64,21 @@ installed prior to compiling the source code:
should be something similar to sqlite-devel (Fedora) or
libsqlite3-dev (Debian/Ubuntu).
+ - Header files for D-Bus GLib bindings. (optional)
+
+ The D-Bus GLib header files should be available from your
+ GNU/Linux distribution as a "development" package. The exact
+ package name varies by distribution, but it should be something
+ similar to dbus-glib-devel (Fedora) or libdbus-glib-1-dev
+ (Debian/Ubuntu).
+
+ GNOME Video Arcade uses D-Bus for better desktop integration.
+ Currently it is only used to inhibit the screen saver from
+ starting while playing a game in fullscreen mode, but its usage
+ may expand in future releases. If you prefer not to use D-Bus,
+ you can configure GNOME Video Arcade to not link against it.
+ See the Installation section to find out how.
+
- Header files for libgnomeui version 2.14 (or higher). (optional)
The libgnomeui header files should be available from your
@@ -179,8 +194,10 @@ installed, the documentation can be viewed through Devhelp.
The --with-gnome and --without-gnome configure options tell "make"
whether to link against high-level GNOME libraries like libgnomeui.
Similarly, the --with-wnck and --without-wnck configure options
-tell "make" whether to link against libwnck. See the previous
-section for details on what these libraries are used for.
+tell "make" whether to link against libwnck, and the --with-dbus
+and --without-dbus configure options tell "make" whether to link
+against D-Bus. See the previous section for details on what these
+libraries are used for.
UPDATE: --with-gnome is now ignored if GTK+ >= 2.14 is detected.
diff --git a/configure.ac b/configure.ac
index 6f51493..bc32533 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,31 @@ PKG_CHECK_MODULES(GIT, $GIT_MODULES)
AC_SUBST(GIT_CFLAGS)
AC_SUBST(GIT_LIBS)
+SQLITE_MODULES="sqlite3 >= 3.0.0"
+PKG_CHECK_MODULES(SQLITE, $SQLITE_MODULES)
+AC_SUBST(SQLITE_CFLAGS)
+AC_SUBST(SQLITE_LIBS)
+
+# --with-dbus=[yes|no]
+DBUS_CFLAGS=
+DBUS_LIBS=
+AC_ARG_WITH([dbus],
+ [AC_HELP_STRING([--with-dbus],
+ [use D-Bus for better desktop integration [default=yes]])],
+ with_dbus="$withval", with_dbus="yes")
+if test "$with_dbus" = "yes"; then
+DBUS_MODULES="dbus-glib-1" # minimum version?
+PKG_CHECK_MODULES(DBUS, $DBUS_MODULES)
+AC_DEFINE_UNQUOTED(HAVE_DBUS, 1,
+ [Define to 1 if you are using GLib bindings for D-Bus])
+else
+DBUS_CFLAGS=
+DBUS_LIBS=
+fi
+AM_CONDITIONAL(HAVE_DBUS, test $with_dbus = yes)
+AC_SUBST(DBUS_CFLAGS)
+AC_SUBST(DBUS_LIBS)
+
# --with-gnome=[yes|no]
GNOME_CFLAGS=
GNOME_LIBS=
@@ -58,18 +83,13 @@ AC_ARG_WITH([gnome],
if test "$with_gnome" = "yes"; then
GNOME_MODULES="libgnomeui-2.0 >= 2.14.0"
PKG_CHECK_MODULES(GNOME, $GNOME_MODULES)
-AC_DEFINE_UNQUOTED(WITH_GNOME, 1,
- [Define to 1 if you are linking against GNOME libraries])
+AC_DEFINE_UNQUOTED(HAVE_GNOME, 1,
+ [Define to 1 if you are using GNOME libraries])
fi
fi
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
-SQLITE_MODULES="sqlite3 >= 3.0.0"
-PKG_CHECK_MODULES(SQLITE, $SQLITE_MODULES)
-AC_SUBST(SQLITE_CFLAGS)
-AC_SUBST(SQLITE_LIBS)
-
# --with-wnck=[yes|no]
AC_ARG_WITH([wnck],
[AC_HELP_STRING([--with-wnck],
@@ -78,8 +98,8 @@ AC_ARG_WITH([wnck],
if test "$with_wnck" = "yes"; then
WNCK_MODULES="libwnck-1.0 >= 2.16.0"
PKG_CHECK_MODULES(WNCK, $WNCK_MODULES)
-AC_DEFINE_UNQUOTED(WITH_WNCK, 1,
- [Define to 1 if you are linking against libwnck])
+AC_DEFINE_UNQUOTED(HAVE_WNCK, 1,
+ [Define to 1 if you are using libwnck])
else
WNCK_CFLAGS=
WNCK_LIBS=
@@ -216,6 +236,7 @@ echo " MAME Program : $MAME"
echo " Category File : $with_category"
echo " History File : $with_history"
echo " NPlayers File : $with_nplayers"
+echo " Use D-Bus : $with_dbus"
echo " Use libgnomeui : $with_gnome"
echo " Use libwnck : $with_wnck"
echo
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index f8d016b..ddd9a2e 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -74,6 +74,7 @@ INCLUDES= \
-I$(top_srcdir)/src \
-I$(top_builddir) \
-I$(top_builddir)/src \
+ $(DBUS_CFLAGS) \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(GIT_CFLAGS) \
@@ -82,6 +83,11 @@ INCLUDES= \
$(GNOME_CFLAGS) \
$(SQLITE_CFLAGS) \
$(WNCK_CFLAGS)
+
+if HAVE_DBUS
+DBUS_OBJECTS = $(top_builddir)/src/gva-dbus.o
+endif
+
GTKDOC_LIBS= \
$(top_builddir)/src/gconf-bridge.o \
$(top_builddir)/src/gva-audit.o \
@@ -111,6 +117,8 @@ GTKDOC_LIBS= \
$(top_builddir)/src/gva-util.o \
$(top_builddir)/src/gva-wnck.o \
$(top_builddir)/src/@MAME_BACKEND@ \
+ $(DBUS_OBJECTS) \
+ $(DBUS_LIBS) \
$(GLIB_LIBS) \
$(GTK_LIBS) \
$(GIT_LIBS) \
diff --git a/docs/reference/gnome-video-arcade-docs.sgml b/docs/reference/gnome-video-arcade-docs.sgml
index 29ad358..2cae164 100644
--- a/docs/reference/gnome-video-arcade-docs.sgml
+++ b/docs/reference/gnome-video-arcade-docs.sgml
@@ -23,6 +23,7 @@
<xi:include href="xml/gva-categories.xml"/>
<xi:include href="xml/gva-columns.xml"/>
<xi:include href="xml/gva-db.xml"/>
+ <xi:include href="xml/gva-dbus.xml"/>
<xi:include href="xml/gva-error.xml"/>
<xi:include href="xml/gva-favorites.xml"/>
<xi:include href="xml/gva-history.xml"/>
diff --git a/docs/reference/gnome-video-arcade-sections.txt b/docs/reference/gnome-video-arcade-sections.txt
index 3c9ebc7..4847410 100644
--- a/docs/reference/gnome-video-arcade-sections.txt
+++ b/docs/reference/gnome-video-arcade-sections.txt
@@ -84,6 +84,12 @@ gva_db_set_error
</SECTION>
<SECTION>
+<FILE>gva-dbus</FILE>
+gva_dbus_init
+gva_dbus_inhibit_screen_saver
+</SECTION>
+
+<SECTION>
<FILE>gva-error</FILE>
GVA_ERROR
GVA_SQLITE_ERROR
diff --git a/docs/reference/tmpl/gva-dbus.sgml b/docs/reference/tmpl/gva-dbus.sgml
new file mode 100644
index 0000000..85bc7b8
--- /dev/null
+++ b/docs/reference/tmpl/gva-dbus.sgml
@@ -0,0 +1,39 @@
+<!-- ##### SECTION Title ##### -->
+gva-dbus
+
+<!-- ##### SECTION Short_Description ##### -->
+
+
+<!-- ##### SECTION Long_Description ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+<!-- ##### SECTION Stability_Level ##### -->
+
+
+<!-- ##### FUNCTION gva_dbus_init ##### -->
+<para>
+
+</para>
+
+ error:
+ Returns:
+
+
+<!-- ##### FUNCTION gva_dbus_inhibit_screen_saver ##### -->
+<para>
+
+</para>
+
+ process:
+ reason:
+ error:
+ Returns:
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
index d952351..25485fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,10 +4,9 @@ bin_PROGRAMS = gnome-video-arcade
AM_CFLAGS = \
-Wall \
- @GLIB_CFLAGS@ @GTK_CFLAGS@ \
- @GIT_CFLAGS@ @GCONF_CFLAGS@ \
- @GLADE_CFLAGS@ @GNOME_CFLAGS@ \
- @SQLITE_CFLAGS@ @WNCK_CFLAGS@
+ @DBUS_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ \
+ @GIT_CFLAGS@ @GCONF_CFLAGS@ @GLADE_CFLAGS@ \
+ @GNOME_CFLAGS@ @SQLITE_CFLAGS@ @WNCK_CFLAGS@
# The DATADIR, LIBDIR, PREFIX, and SYSCONFDIR definitions
# are only needed for libgnome. GLib handles it better.
@@ -23,6 +22,12 @@ AM_CPPFLAGS = \
AM_LDFLAGS = \
-export-dynamic
+if HAVE_DBUS
+DBUS_SOURCES = \
+ gva-dbus.c \
+ gva-dbus.h
+endif
+
gnome_video_arcade_SOURCES = \
gconf-bridge.c \
gconf-bridge.h \
@@ -80,6 +85,7 @@ gnome_video_arcade_SOURCES = \
gva-util.h \
gva-wnck.c \
gva-wnck.h \
+ $(DBUS_SOURCES) \
main.c
EXTRA_gnome_video_arcade_SOURCES = \
@@ -87,11 +93,10 @@ EXTRA_gnome_video_arcade_SOURCES = \
gva-mame-xmame.c
gnome_video_arcade_LDADD = \
- @GLIB_LIBS@ @GTK_LIBS@ \
- @GIT_LIBS@ @GCONF_LIBS@ \
- @GLADE_LIBS@ @GNOME_LIBS@ \
- @MAME_BACKEND@ @SQLITE_LIBS@ \
- @WNCK_LIBS@
+ @DBUS_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ \
+ @GIT_LIBS@ @GCONF_LIBS@ @GLADE_LIBS@ \
+ @GNOME_LIBS@ @MAME_BACKEND@ \
+ @SQLITE_LIBS@ @WNCK_LIBS@
gnome_video_arcade_DEPENDENCIES = \
@MAME_BACKEND@
diff --git a/src/gva-dbus.c b/src/gva-dbus.c
new file mode 100644
index 0000000..259f882
--- /dev/null
+++ b/src/gva-dbus.c
@@ -0,0 +1,124 @@
+/* Copyright 2007-2009 Matthew Barnes
+ *
+ * This file is part of GNOME Video Arcade.
+ *
+ * GNOME Video Arcade is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * GNOME Video Arcade is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gva-dbus.h"
+
+#include <dbus/dbus-glib.h>
+
+#include "gva-error.h"
+#include "gva-preferences.h"
+
+#define SCREEN_SAVER_SERVICE "org.gnome.ScreenSaver"
+#define SCREEN_SAVER_PATH "/org/gnome/ScreenSaver"
+#define SCREEN_SAVER_INTERFACE "org.gnome.ScreenSaver"
+
+static DBusGConnection *connection;
+static DBusGProxy *screen_saver_proxy;
+
+static void
+dbus_screen_saver_uninhibit (GvaProcess *process,
+ gint status,
+ gpointer user_data)
+{
+ guint cookie = GPOINTER_TO_UINT (user_data);
+ GError *error = NULL;
+
+ g_return_if_fail (cookie > 0);
+
+ dbus_g_proxy_call (
+ screen_saver_proxy,
+ "UnInhibit", &error,
+ G_TYPE_UINT, cookie,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ gva_error_handle (&error);
+}
+
+/**
+ * gva_dbus_init:
+ * @error: return location for a #GError, or %NULL
+ *
+ * Connects to D-Bus and sets up proxy objects. If an error occurs,
+ * the function returns %FALSE and sets @error.
+ *
+ * This function should be called once when the application starts.
+ *
+ * Returns: %TRUE on success, %FALSE if an error occurred
+ **/
+gboolean
+gva_dbus_init (GError **error)
+{
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, error);
+
+ if (connection == NULL)
+ return FALSE;
+
+ screen_saver_proxy = dbus_g_proxy_new_for_name (
+ connection,
+ SCREEN_SAVER_SERVICE,
+ SCREEN_SAVER_PATH,
+ SCREEN_SAVER_INTERFACE);
+
+ return TRUE;
+}
+
+/**
+ * gva_dbus_inhibit_screen_saver:
+ * @process: a #GvaProcess
+ * @reason: the reason for the inhibit
+ * @error: return location for a #GError, or %NULL
+ *
+ * If the full screen preference is enabled, inhibits GNOME screen
+ * saver for the duration of @process. If an error occurs, the
+ * function returns %FALSE and sets @error.
+ *
+ * Returns: %TRUE on success, %FALSE if an error occurred
+ **/
+gboolean
+gva_dbus_inhibit_screen_saver (GvaProcess *process,
+ const gchar *reason,
+ GError **error)
+{
+ gboolean success;
+ guint cookie = 0;
+
+ g_return_val_if_fail (GVA_IS_PROCESS (process), FALSE);
+ g_return_val_if_fail (reason != NULL, FALSE);
+
+ /* Only inhibit screen saver in full screen mode. */
+ if (!gva_preferences_get_full_screen ())
+ return TRUE;
+
+ success = dbus_g_proxy_call (
+ screen_saver_proxy,
+ "Inhibit", error,
+ G_TYPE_STRING, PACKAGE_NAME,
+ G_TYPE_STRING, reason,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &cookie,
+ G_TYPE_INVALID);
+
+ if (success)
+ g_signal_connect (
+ process, "exited",
+ G_CALLBACK (dbus_screen_saver_uninhibit),
+ GUINT_TO_POINTER (cookie));
+
+ return success;
+}
diff --git a/src/gva-dbus.h b/src/gva-dbus.h
new file mode 100644
index 0000000..1b3828a
--- /dev/null
+++ b/src/gva-dbus.h
@@ -0,0 +1,41 @@
+/* Copyright 2007-2009 Matthew Barnes
+ *
+ * This file is part of GNOME Video Arcade.
+ *
+ * GNOME Video Arcade is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * GNOME Video Arcade is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * SECTION: gva-dbus
+ * @short_description: Desktop Integration
+ *
+ * XXX Long description here.
+ **/
+
+#ifndef GVA_DBUS_H
+#define GVA_DBUS_H
+
+#include "gva-common.h"
+#include "gva-process.h"
+
+G_BEGIN_DECLS
+
+gboolean gva_dbus_init (GError **error);
+gboolean gva_dbus_inhibit_screen_saver (GvaProcess *process,
+ const gchar *reason,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* GVA_DBUS_H */
diff --git a/src/gva-main.c b/src/gva-main.c
index cc81759..e722ef8 100644
--- a/src/gva-main.c
+++ b/src/gva-main.c
@@ -187,7 +187,7 @@ gva_main_init (void)
gtk_entry_set_text (GTK_ENTRY (GVA_WIDGET_MAIN_SEARCH_ENTRY), text);
g_free (text);
-#if !GTK_CHECK_VERSION(2,14,0) && !defined WITH_GNOME
+#if !GTK_CHECK_VERSION(2,14,0) && !defined HAVE_GNOME
/* Requires that we link against libgnome. */
gtk_action_set_sensitive (GVA_ACTION_CONTENTS, FALSE);
#endif
diff --git a/src/gva-mame-common.c b/src/gva-mame-common.c
index 649cdd7..4c371c8 100644
--- a/src/gva-mame-common.c
+++ b/src/gva-mame-common.c
@@ -633,7 +633,7 @@ gva_mame_run_game (const gchar *name,
g_string_append (arguments, "-window ");
}
-#ifdef WITH_WNCK
+#ifdef HAVE_WNCK
if (gva_mame_supports_maximize ())
g_string_append (arguments, "-nomaximize ");
#endif
@@ -710,7 +710,7 @@ gva_mame_record_game (const gchar *name,
g_string_append (arguments, "-window ");
}
-#ifdef WITH_WNCK
+#ifdef HAVE_WNCK
if (gva_mame_supports_maximize ())
g_string_append (arguments, "-nomaximize ");
#endif
@@ -784,7 +784,7 @@ gva_mame_playback_game (const gchar *name,
g_string_append (arguments, "-window ");
}
-#ifdef WITH_WNCK
+#ifdef HAVE_WNCK
if (gva_mame_supports_maximize ())
g_string_append (arguments, "-nomaximize ");
#endif
diff --git a/src/gva-ui.c b/src/gva-ui.c
index d877d36..f630435 100644
--- a/src/gva-ui.c
+++ b/src/gva-ui.c
@@ -36,6 +36,10 @@
#include "gva-util.h"
#include "gva-wnck.h"
+#ifdef HAVE_DBUS
+#include "gva-dbus.h"
+#endif
+
static GladeXML *xml = NULL;
static GtkUIManager *manager = NULL;
static GtkActionGroup *action_group = NULL;
@@ -267,6 +271,19 @@ action_play_back_cb (GtkAction *action)
process = gva_mame_playback_game (name, inpname, &error);
gva_error_handle (&error);
+#ifdef HAVE_DBUS
+ if (process != NULL)
+ {
+ const gchar *reason;
+
+ /* Translators: This is passed through D-Bus as the
+ * reason to inhibit GNOME screen saver. */
+ reason = _("Watching a fullscreen game");
+ gva_dbus_inhibit_screen_saver (process, reason, &error);
+ gva_error_handle (&error);
+ }
+#endif
+
if (process != NULL)
{
gva_wnck_listen_for_new_window (process, name);
@@ -381,6 +398,19 @@ action_record_cb (GtkAction *action)
process = gva_mame_record_game (name, inpname, &error);
gva_error_handle (&error);
+#ifdef HAVE_DBUS
+ if (process != NULL)
+ {
+ const gchar *reason;
+
+ /* Translators: This is passed through D-Bus as the
+ * reason to inhibit GNOME screen saver. */
+ reason = _("Recording a fullscreen game");
+ gva_dbus_inhibit_screen_saver (process, reason, &error);
+ gva_error_handle (&error);
+ }
+#endif
+
if (process != NULL)
{
gva_wnck_listen_for_new_window (process, name);
@@ -535,6 +565,19 @@ action_start_cb (GtkAction *action)
process = gva_mame_run_game (name, &error);
gva_error_handle (&error);
+#ifdef HAVE_DBUS
+ if (process != NULL)
+ {
+ const gchar *reason;
+
+ /* Translators: This is passed through D-Bus as the
+ * reason to inhibit GNOME screen saver. */
+ reason = _("Playing a fullscreen game");
+ gva_dbus_inhibit_screen_saver (process, reason, &error);
+ gva_error_handle (&error);
+ }
+#endif
+
if (process != NULL)
{
gva_wnck_listen_for_new_window (process, name);
diff --git a/src/gva-util.c b/src/gva-util.c
index f5bfa1d..2fcfc6e 100644
--- a/src/gva-util.c
+++ b/src/gva-util.c
@@ -23,7 +23,7 @@
#include "gva-error.h"
#include "gva-mame.h"
-#ifdef WITH_GNOME
+#ifdef HAVE_GNOME
#include <gnome.h>
#endif
@@ -345,7 +345,7 @@ gva_help_display (GtkWindow *parent,
exit:
g_string_free (uri, TRUE);
-#elif defined WITH_GNOME
+#elif defined HAVE_GNOME
GtkWidget *dialog;
GError *error = NULL;
diff --git a/src/gva-wnck.c b/src/gva-wnck.c
index 15a7d49..faf2c44 100644
--- a/src/gva-wnck.c
+++ b/src/gva-wnck.c
@@ -18,7 +18,7 @@
#include "gva-wnck.h"
-#ifdef WITH_WNCK
+#ifdef HAVE_WNCK
#define WNCK_I_KNOW_THIS_IS_UNSTABLE
#include <libwnck/libwnck.h>
@@ -271,7 +271,7 @@ wnck_window_opened_cb (WnckScreen *screen,
gva_main_cursor_normal ();
}
-#endif /* WITH_WNCK */
+#endif /* HAVE_WNCK */
/**
* gva_wnck_listen_for_new_window:
@@ -291,7 +291,7 @@ void
gva_wnck_listen_for_new_window (GvaProcess *process,
const gchar *game)
{
-#ifdef WITH_WNCK
+#ifdef HAVE_WNCK
g_return_if_fail (GVA_IS_PROCESS (process));
g_return_if_fail (game != NULL);
@@ -319,5 +319,5 @@ gva_wnck_listen_for_new_window (GvaProcess *process,
G_CALLBACK (wnck_window_opened_cb), process);
gva_main_cursor_busy ();
-#endif /* WITH_WNCK */
+#endif /* HAVE_WNCK */
}
diff --git a/src/main.c b/src/main.c
index 4802fa3..02bfa38 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
-#ifdef WITH_GNOME
+#ifdef HAVE_GNOME
#include <gnome.h>
#endif
@@ -43,6 +43,10 @@
#include "gva-ui.h"
#include "gva-util.h"
+#ifdef HAVE_DBUS
+#include "gva-dbus.h"
+#endif
+
#define SQL_COUNT_ROMS \
"SELECT count(*) FROM game WHERE " \
"romset NOTNULL AND romset != 'not found'"
@@ -105,7 +109,7 @@ warn_if_no_roms (void)
"<big><b>%s</b></big>",
_("No ROM files found"));
-#if GTK_CHECK_VERSION(2,14,0) || defined WITH_GNOME
+#if GTK_CHECK_VERSION(2,14,0) || defined HAVE_GNOME
gtk_message_dialog_format_secondary_markup (
GTK_MESSAGE_DIALOG (dialog),
_("GNOME Video Arcade was unable to locate any ROM files. "
@@ -199,7 +203,7 @@ start (void)
gint
main (gint argc, gchar **argv)
{
-#ifdef WITH_GNOME
+#ifdef HAVE_GNOME
GnomeProgram *program;
GOptionContext *context;
#endif
@@ -212,7 +216,7 @@ main (gint argc, gchar **argv)
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
-#ifdef WITH_GNOME
+#ifdef HAVE_GNOME
context = g_option_context_new (NULL);
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
@@ -289,11 +293,16 @@ main (gint argc, gchar **argv)
gva_nplayers_init (&error);
gva_error_handle (&error);
+#ifdef HAVE_DBUS
+ gva_dbus_init (&error);
+ gva_error_handle (&error);
+#endif
+
gtk_init_add ((GtkFunction) start, NULL);
gtk_main ();
-#ifdef WITH_GNOME
+#ifdef HAVE_GNOME
g_object_unref (program);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]