vino r887 - in trunk: . capplet
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vino r887 - in trunk: . capplet
- Date: Tue, 29 Jul 2008 23:11:33 +0000 (UTC)
Author: jwendell
Date: Tue Jul 29 23:11:33 2008
New Revision: 887
URL: http://svn.gnome.org/viewvc/vino?rev=887&view=rev
Log:
2008-07-29 Jonh Wendell <jwendell gnome org>
* capplet/Makefile.am:
* capplet/vino-preferences.c:
* configure.in: Added a compile-time option (--enable-libunique)
to use the LibUnique library, which allows only one instance of
capplet running.
Based on a patch provided by Jorge Pereira <jorge jorgepereira com br>.
Modified:
trunk/ChangeLog
trunk/capplet/Makefile.am
trunk/capplet/vino-preferences.c
trunk/configure.in
Modified: trunk/capplet/Makefile.am
==============================================================================
--- trunk/capplet/Makefile.am (original)
+++ trunk/capplet/Makefile.am Tue Jul 29 23:11:33 2008
@@ -7,6 +7,7 @@
$(VINO_CAPPLET_CFLAGS) \
$(VINO_KEYRING_CFLAGS) \
$(VINO_HTTP_CFLAGS) \
+ $(VINO_LIBUNIQUE_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)
@@ -18,6 +19,7 @@
vino_preferences_LDADD = \
$(VINO_CAPPLET_LIBS) \
$(VINO_KEYRING_LIBS) \
+ $(VINO_LIBUNIQUE_LIBS) \
$(X_LIBS) \
$(NULL)
Modified: trunk/capplet/vino-preferences.c
==============================================================================
--- trunk/capplet/vino-preferences.c (original)
+++ trunk/capplet/vino-preferences.c Tue Jul 29 23:11:33 2008
@@ -41,6 +41,10 @@
#include <gnome-keyring.h>
#endif
+#ifdef VINO_ENABLE_LIBUNIQUE
+#include <unique/unique.h>
+#endif
+
#define VINO_PREFS_DIR "/desktop/gnome/remote_access"
#define VINO_PREFS_ENABLED VINO_PREFS_DIR "/enabled"
#define VINO_PREFS_PROMPT_ENABLED VINO_PREFS_DIR "/prompt_enabled"
@@ -86,6 +90,9 @@
GtkWidget *lock_screen_toggle;
GtkWidget *disable_background_toggle;
GtkTooltips *tips;
+#ifdef VINO_ENABLE_LIBUNIQUE
+ UniqueApp *app;
+#endif
guint listeners [N_LISTENERS];
int n_listeners;
@@ -1508,6 +1515,10 @@
gtk_widget_show (dialog->dialog);
+#ifdef VINO_ENABLE_LIBUNIQUE
+ unique_app_watch_window (dialog->app, GTK_WINDOW (dialog->dialog));
+#endif
+
return TRUE;
#undef VINO_GLADE_FILE
@@ -1549,6 +1560,36 @@
if (dialog->xml)
g_object_unref (dialog->xml);
dialog->xml = NULL;
+
+#ifdef VINO_ENABLE_LIBUNIQUE
+ if (dialog->app)
+ g_object_unref (dialog->app);
+ dialog->app = NULL;
+#endif
+}
+
+static gboolean
+vino_preferences_is_running (VinoPreferencesDialog *dialog)
+{
+#ifdef VINO_ENABLE_LIBUNIQUE
+ dialog->app = unique_app_new ("org.gnome.Vino.Preferences", NULL);
+
+ if (unique_app_is_running (dialog->app))
+ {
+ UniqueResponse response;
+
+ response = unique_app_send_message (dialog->app, UNIQUE_ACTIVATE, NULL);
+
+ g_object_unref (dialog->app);
+ dialog->app = NULL;
+
+ return response == UNIQUE_RESPONSE_OK;
+ }
+ else
+ return FALSE;
+#else
+ return FALSE;
+#endif
}
int
@@ -1563,6 +1604,9 @@
gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE,
argc, argv, NULL);
+ if (vino_preferences_is_running (&dialog))
+ return 0;
+
if (!vino_preferences_dialog_init (&dialog))
{
vino_preferences_dialog_finalize (&dialog);
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Tue Jul 29 23:11:33 2008
@@ -304,6 +304,29 @@
fi
AC_MSG_RESULT($have_ipv6)
+dnl --enable-libunique=(yes|no)
+LIBUNIQUE_VERSION=1.0.0
+
+AC_ARG_ENABLE(libunique,
+ [ --enable-libunique=[no/yes] Use the library unique to allow only one instance running [default=auto]],,
+ enable_libunique=auto)
+if test "$enable_libunique" = "no"; then
+ have_libunique=no
+else
+ if test "$enable_libunique" = "yes"; then
+ PKG_CHECK_MODULES(VINO_LIBUNIQUE, unique-1.0 >= $LIBUNIQUE_VERSION)
+ have_libunique=yes
+ else
+ PKG_CHECK_MODULES(VINO_LIBUNIQUE,
+ unique-1.0 >= $LIBUNIQUE_VERSION,
+ have_libunique=yes, have_libunique=no)
+ fi;
+fi
+
+if test "x$have_libunique" = "xyes" ; then
+ AC_DEFINE(VINO_ENABLE_LIBUNIQUE, [], [Set if we should use libunique])
+fi
+
dnl --enable-debug=(yes|minimum|no)
AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging [default=no]],,enable_debug=minimum)
if test "$enable_debug" = "yes"; then
@@ -359,5 +382,6 @@
GNOME Keyring support.......: ${enable_gnome_keyring}
Session support.............: ${enable_session_support}
HTTP server.................: ${enable_http_server}
+ Libunique support...........: ${have_libunique}
DEBUG messages..............: ${enable_debug}
"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]