
Property changes on: session/README.old
___________________________________________________________________
Added: svn:mergeinfo

Index: session/README
===================================================================
--- session/README	(revision 928)
+++ session/README	(working copy)
@@ -1,40 +1,3 @@
-Vino Session Management
-=======================
+This directory is obsolete.
 
-  The Remote Desktop server provides a background service for the
-desktop. How to implement activating such services isn't a very
-clearly defined area in GNOME. There are two common approaches:
-
-    + Make the service session managed and put it in the default
-      session.
-
-    + Make it possible to activate the service with bonobo-activation
-      and make gnome-session control the lifecyle of the service.
-
-  The second option is more attractive for Vino, because we would
-really not prefer to have the service running if it is disabled. In
-this directory you have both options:
-
-    + vino-session is a small program which you can add to your
-      session and it will control the lifecycle of the service.
-
-      [ i.e. add something like the following to 
-        $(datadir)/gnome/default.session:
-
-          4,id=default4
-          4,Priority=20
-          4,RestartCommand=vino-session --sm-client-id default4
-
-        and increase "num_clients" by one. ]
-
-    + gsm-remote-desktop.diff is a patch for gnome-session to control
-      the lifecycle directly from the session manager.
-
-  The code for both is more or less the same. If Vino ever becomes
-part of the desktop this will be resolved for good by choosing one of
-the options above, coming up with a better way to manage the lifecyle
-of generic services or by making it feasible to run vino-server while
-it is disabled.
-
-
-Mark McLoughlin, 2003-11-10.
+Jonh Wendell, 2008-08-29
Index: configure.in
===================================================================
--- configure.in	(revision 928)
+++ configure.in	(working copy)
@@ -45,10 +45,11 @@
 
 GTK_VERSION=2.13.1
 GLIB_VERSION=2.17.0
+DBUS_VERSION=1.2.3
 
-PKG_CHECK_MODULES(VINO_SERVER, glib-2.0 >= $GLIB_VERSION gtk+-x11-2.0 >= $GTK_VERSION gconf-2.0 libglade-2.0 libbonobo-2.0 dbus-glib-1)
+PKG_CHECK_MODULES(VINO_SERVER, glib-2.0 >= $GLIB_VERSION gtk+-x11-2.0 >= $GTK_VERSION gconf-2.0 libglade-2.0 dbus-1 >= $DBUS_VERSION dbus-glib-1 libgnomeui-2.0)
 
-PKG_CHECK_MODULES(VINO_CAPPLET, glib-2.0 >= $GLIB_VERSION gtk+-2.0 >= $GTK_VERSION gconf-2.0 libglade-2.0 dbus-glib-1)
+PKG_CHECK_MODULES(VINO_CAPPLET, glib-2.0 >= $GLIB_VERSION gtk+-2.0 >= $GTK_VERSION gconf-2.0 libglade-2.0 dbus-1 >= $DBUS_VERSION dbus-glib-1)
 
 PKG_CHECK_MODULES(VINO_TOOLS, glib-2.0 >= $GLIB_VERSION gconf-2.0 gobject-2.0 >= $GLIB_VERSION gnome-keyring-1)
 
@@ -88,15 +89,6 @@
                       AC_DEFINE(VINO_ENABLE_KEYRING, [], [Set if we should use gnome-keyring]))
 fi
 
-dnl --enable-session-support=(yes|no)
-AC_ARG_ENABLE(session_support,
-	      [  --enable-session-support=[no/yes] build session management utility program [default=no]],,
-	      enable_session_support=no)
-if test "$enable_session_support" = "yes"; then
-  PKG_CHECK_MODULES(VINO_SESSION, gconf-2.0 libgnomeui-2.0)
-fi
-AM_CONDITIONAL(SESSION_SUPPORT, [test "$enable_session_support" = "yes"])
-
 dnl --enable-http-server=(yes|no)
 AC_ARG_ENABLE(http_server,
 	      [  --enable-http-server=[no/yes] enable an HTTP server for serving a Java applet client [default=no]],,
@@ -140,16 +132,6 @@
 AC_SUBST(X_LIBS)
 
 #
-# Bonobo foo
-#
-
-ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
-AC_SUBST(ORBIT_IDL)
-
-BONOBO_IDLDIR="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
-AC_SUBST(BONOBO_IDLDIR)
-
-#
 # Check for gnutls
 #
 AC_ARG_ENABLE(gnutls,
@@ -363,7 +345,6 @@
 server/libvncserver/Makefile
 server/libvncserver/rfb/Makefile
 capplet/Makefile
-session/Makefile
 tools/Makefile
 docs/Makefile
 po/Makefile.in
@@ -383,7 +364,6 @@
 	Avahi support ..............:  ${VINO_ENABLE_MDNS}
 	Notify support .............:  ${have_libnotify}
 	GNOME Keyring support.......:  ${enable_gnome_keyring}
-	Session support.............:  ${enable_session_support}
 	HTTP server.................:  ${enable_http_server}
 	Libunique support...........:  ${have_libunique}
 	DEBUG messages..............:  ${enable_debug}
Index: server/GNOME_RemoteDesktop.idl
===================================================================
--- server/GNOME_RemoteDesktop.idl	(revision 928)
+++ server/GNOME_RemoteDesktop.idl	(working copy)
@@ -1,13 +0,0 @@
-#include <Bonobo_Unknown.idl>
-
-module GNOME
-{
-  module RemoteDesktop
-  {
-    /* dummy interface */
-    interface Shell : Bonobo::Unknown
-    {
-      void dummy ();
-    };
-  };
-};
Index: server/vino-dbus-listener.c
===================================================================
--- server/vino-dbus-listener.c	(revision 928)
+++ server/vino-dbus-listener.c	(working copy)
@@ -388,29 +388,40 @@
   vino_dbus_connection = NULL;
 }
 
-void
+gboolean
 vino_dbus_request_name (void)
 {
 #define VINO_DBUS_BUS_NAME "org.gnome.Vino"
 
   DBusConnection *connection;
   DBusError       error;
+  int             result;
 
   if (!(connection = vino_dbus_get_connection ()))
-    return;
+    return FALSE;
 
   dbus_error_init (&error);
 
-  dbus_bus_request_name (connection, VINO_DBUS_BUS_NAME, 0, &error);
+  result = dbus_bus_request_name (connection,
+				  VINO_DBUS_BUS_NAME,
+				  DBUS_NAME_FLAG_DO_NOT_QUEUE,
+				  &error);
   if (dbus_error_is_set (&error))
     {
       g_printerr (_("Failed to acquire D-Bus name '%s'\n"),
                   error.message);
       dbus_error_free (&error);
-      return;
+      return FALSE;
     }
 
+  if (result == DBUS_REQUEST_NAME_REPLY_EXISTS)
+    {
+      g_warning (_("Remote Desktop server already running; exiting ...\n"));
+      return FALSE;
+    }
+
   dprintf (DBUS, "Successfully acquired D-Bus name '%s'\n", VINO_DBUS_BUS_NAME);
+  return TRUE;
 
 #undef VINO_DBUS_BUS_NAME
 }
Index: server/vino-main.c
===================================================================
--- server/vino-main.c	(revision 928)
+++ server/vino-main.c	(working copy)
@@ -18,6 +18,7 @@
  *
  * Authors:
  *      Mark McLoughlin <mark@skynet.ie>
+ *      Jonh Wendell <wendell@bani.com.br>
  */
 
 #include <config.h>
@@ -27,10 +28,11 @@
 #include "vino-input.h"
 #include "vino-mdns.h"
 #include "vino-server.h"
-#include "vino-shell.h"
 #include "vino-prefs.h"
 #include "vino-util.h"
 #include "vino-dbus-listener.h"
+#include <libgnome/libgnome.h>
+#include <libgnomeui/libgnomeui.h>
 
 #ifdef HAVE_GNUTLS
 #include <gnutls/gnutls.h>
@@ -51,13 +53,26 @@
   GdkDisplay *display;
   gboolean    view_only;
   int         i, n_screens;
+  GnomeClient *session;
+  char        *restart_argv [] = { *argv, 0 };
 
   bindtextdomain (GETTEXT_PACKAGE, VINO_LOCALEDIR);
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
-  gtk_init (&argc, &argv);
+  gnome_program_init ("vino", VERSION,
+                      LIBGNOMEUI_MODULE,
+                      argc, argv,
+                      NULL);
 
+  session = gnome_master_client ();
+
+  gnome_client_set_restart_command (session, 2, restart_argv);
+  gnome_client_set_restart_style   (session, GNOME_RESTART_IMMEDIATELY);
+  gnome_client_set_priority        (session, 5);
+  g_signal_connect (session, "die",
+                    G_CALLBACK (gtk_main_quit), NULL);
+
   vino_setup_debug_flags ();
 
 #ifdef HAVE_GNUTLS
@@ -73,7 +88,7 @@
   gtk_window_set_default_icon_name ("preferences-desktop-remote-desktop");
   g_set_application_name (_("GNOME Remote Desktop"));
 
-  if (!vino_shell_register (&argc, argv))
+  if (!vino_dbus_request_name ())
     return 1;
 
   display = gdk_display_get_default ();
@@ -92,8 +107,6 @@
   for (i = 0; i < n_screens; i++)
     vino_prefs_create_server (gdk_display_get_screen (display, i));
 
-  vino_dbus_request_name ();
-
   gtk_main ();
 
   vino_mdns_shutdown ();
Index: server/vino-dbus-listener.h
===================================================================
--- server/vino-dbus-listener.h	(revision 928)
+++ server/vino-dbus-listener.h	(working copy)
@@ -72,7 +72,7 @@
 
 DBusConnection *vino_dbus_get_connection   (void);
 void            vino_dbus_unref_connection (void);
-void            vino_dbus_request_name     (void);
+gboolean        vino_dbus_request_name     (void);
 
 G_END_DECLS
 
Index: server/GNOME_RemoteDesktop.server.in.in
===================================================================
--- server/GNOME_RemoteDesktop.server.in.in	(revision 928)
+++ server/GNOME_RemoteDesktop.server.in.in	(working copy)
@@ -1,17 +0,0 @@
-<oaf_info>
-
-  <oaf_server iid="OAFIID:GNOME_RemoteDesktopServer"
-              type="exe"
-              location="@LIBEXECDIR@/vino-server">
-
-    <oaf_attribute name="repo_ids" type="stringv">
-      <item value="IDL:GNOME/RemoteDesktop/Shell:1.0"/>
-      <item value="IDL:Bonobo/Unknown:1.0"/>
-    </oaf_attribute>
-
-    <oaf_attribute name="name" type="string" value="Remote Desktop Server"/>
-    <oaf_attribute name="description" type="string" value="Remote Desktop Server"/>
-
-  </oaf_server>
-
-</oaf_info>
Index: server/vino-shell.c
===================================================================
--- server/vino-shell.c	(revision 928)
+++ server/vino-shell.c	(working copy)
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * This program 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 2 of the
- * License, or (at your option) any later version.
- *
- * This program 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Authors:
- *      Mark McLoughlin <mark@skynet.ie>
- */
-
-#include <config.h>
-
-#include "vino-shell.h"
-
-#include <string.h>
-#include <gdk/gdkdisplay.h>
-#include <gtk/gtk.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#include "GNOME_RemoteDesktop.h"
-#include "vino-util.h"
-
-#define VINO_SERVER_IID "OAFIID:GNOME_RemoteDesktopServer"
-
-static GType vino_shell_get_type (void) G_GNUC_CONST;
-
-gboolean
-vino_shell_register (int   *argc,
-		     char **argv)
-{
-  GObject                   *shell;
-  Bonobo_RegistrationResult  result;
-  GSList                    *reg_env = NULL;
-  char                      *display_name, *p;
-
-  bonobo_init (argc, argv);
-
-  shell = g_object_new (vino_shell_get_type (), NULL);
-
-  display_name = g_strdup (gdk_display_get_name (gdk_display_get_default ()));
-  
-  /* Strip off the screen portion of the display */
-  p = strrchr (display_name, ':');
-  if (p)
-    {
-      p = strchr (p, '.');
-      if (p)
-	p [0] = '\0';
-    }
-
-  reg_env = bonobo_activation_registration_env_set (reg_env, "DISPLAY", display_name);
-  result = bonobo_activation_register_active_server (VINO_SERVER_IID,
-						     BONOBO_OBJREF (shell),
-						     reg_env);
-
-  bonobo_activation_registration_env_free (reg_env);
-  g_free (display_name);
-
-  switch (result)
-    {
-    case Bonobo_ACTIVATION_REG_SUCCESS:
-      break;
-    case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
-      g_warning (_("Remote Desktop server already running; exiting ...\n"));
-      goto registration_failed;
-    default:
-      g_warning (_("Problem registering the remote desktop server with bonobo-activation; exiting ...\n"));
-      goto registration_failed;
-    }
-
-  return TRUE;
-
- registration_failed:
-  bonobo_object_unref (BONOBO_OBJECT (shell));
-
-  return FALSE;
-}
-
-typedef BonoboObject VinoShell;
-
-typedef struct
-{
-  BonoboObjectClass                  parent_class;
-
-  POA_GNOME_RemoteDesktop_Shell__epv epv;
-} VinoShellClass;
-
-static GObjectClass *vino_shell_parent_class = NULL;
-
-static gboolean
-vino_shell_idle_quit (void)
-{
-  if (gtk_main_level ())
-    gtk_main_quit ();
-
-  return FALSE;
-}
-
-static void
-vino_shell_destroy (BonoboObject *bobject)
-{
-  g_idle_add ((GSourceFunc) vino_shell_idle_quit, NULL);
-  
-  BONOBO_OBJECT_CLASS (vino_shell_parent_class)->destroy (bobject);
-}
-
-static void
-vino_shell_class_init (VinoShellClass *klass)
-{
-  BonoboObjectClass *bobject_class = (BonoboObjectClass *) klass;
-
-  bobject_class->destroy = vino_shell_destroy;
-
-  vino_shell_parent_class = g_type_class_peek_parent (klass);
-}
-
-static void
-vino_shell_init (VinoShell *shell)
-{
-}
-
-BONOBO_TYPE_FUNC_FULL (VinoShell,
-                       GNOME_RemoteDesktop_Shell,
-                       BONOBO_TYPE_OBJECT,
-                       vino_shell);
Index: server/vino-shell.h
===================================================================
--- server/vino-shell.h	(revision 928)
+++ server/vino-shell.h	(working copy)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems, Inc.
- *
- * This program 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 2 of the
- * License, or (at your option) any later version.
- *
- * This program 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Authors:
- *      Mark McLoughlin <mark@skynet.ie>
- */
-
-#ifndef __VINO_SHELL_H__
-#define __VINO_SHELL_H__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-gboolean vino_shell_register (int   *argc,
-			      char **argv);
-
-G_END_DECLS
-
-#endif /* __VINO_SHELL_H__ */
Index: server/Makefile.am
===================================================================
--- server/Makefile.am	(revision 928)
+++ server/Makefile.am	(working copy)
@@ -59,8 +59,6 @@
 	vino-prompt.h \
 	vino-server.c \
 	vino-server.h \
-	vino-shell.c \
-	vino-shell.h \
 	vino-util.c \
 	vino-util.h \
 	vino-status-icon.c \
@@ -112,30 +110,12 @@
 			--eprod "GType @enum_name@_get_type (void);\n" \
 		$(vino_enum_headers) >  $@
 
-CORBA_SRCLIST = \
-	GNOME_RemoteDesktop-skels.c \
-	GNOME_RemoteDesktop-common.c \
-	GNOME_RemoteDesktop.h \
-	$(NULL)
-
-$(CORBA_SRCLIST): $(top_srcdir)/server/GNOME_RemoteDesktop.idl $(ORBIT_IDL)
-	$(ORBIT_IDL) --nostubs -I $(BONOBO_IDLDIR) $(top_srcdir)/server/GNOME_RemoteDesktop.idl
-
 schemasdir       = $(GCONF_SCHEMA_FILE_DIR)
 schemas_in_files = vino-server.schemas.in
 schemas_DATA     = $(schemas_in_files:.schemas.in=.schemas)
 
 @INTLTOOL_SCHEMAS_RULE@
 
-%.server.in: %.server.in.in
-	sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-
-serverdir       = $(libdir)/bonobo/servers
-server_in_files = GNOME_RemoteDesktop.server.in
-server_DATA     = $(server_in_files:.server.in=.server)
-
-@INTLTOOL_SERVER_RULE@
-
 vino-server.desktop.in: vino-server.desktop.in.in
 	sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
 
@@ -163,13 +143,10 @@
 	vino-prompt.glade \
 	vino-server.schemas.in \
 	vino-marshal.list \
-	GNOME_RemoteDesktop.server.in.in \
-	GNOME_RemoteDesktop.idl \
 	vino-server.desktop.in.in \
 	$(NULL)
 
 BUILT_SOURCES = \
-	$(CORBA_SRCLIST) \
 	vino-enums.c \
 	vino-enums.h \
 	vino-marshal.c \
@@ -181,8 +158,6 @@
 	vino-server.desktop.in
 
 DISTCLEANFILES = \
-	GNOME_RemoteDesktop.server.in \
-	GNOME_RemoteDesktop.server \
 	$(schemas_DATA) \
 	$(BUILT_SOURCES) \
 	$(NULL)
