Re: Gnome Session Services Framework



Updated patch attached

On Mon, 2005-07-11 at 17:44 +0200, Rodrigo Moya wrote:
> On Fri, 2005-07-08 at 15:15 -0400, Ray Strode wrote:
> > Hi Rodrigo,
> > 
> > > ok, attached patch, with the services framework disabled by default.
> > You can't just disable the session management stuff.
> > 
> right sorry, I forgot to enable the code for that
> 
> > The right approach will be to load service manager stuff first, then
> > load the session.  Also, if something was started by the service
> > manager then it shouldn't be started again by the session manager.
> >
> this is the only thing missing in my patch (which only includes changes
> in existing files, the new files, are the same version as in my previous
> patch). I guess I would just need to go over the client_list in Session.
> But, the problem I see is how to check we really don't want to start
> that process from the session? That is, I might have a
> gnome-service-launch process in autostart, and another one, to start a
> different/local service on the session.
> 
> So, how to deal with that? Compare the whole command line?
> _______________________________________________
> desktop-devel-list mailing list
> desktop-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/desktop-devel-list
-- 
Rodrigo Moya <rodrigo gnome-db org>
? compile
? depcomp
? stamp-h1
? gnome-session/gsm-dbus-utils.c
? gnome-session/gsm-dbus-utils.h
? gnome-session/gsm-service-manager.c
? gnome-session/gsm-service-manager.h
? gnome-session/gsm-service.c
? gnome-session/gsm-service.h
? gnome-session/service-manager-test
? gnome-session/session-properties.desktop.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-session/ChangeLog,v
retrieving revision 1.591
diff -u -p -r1.591 ChangeLog
--- ChangeLog	3 Jul 2005 18:50:14 -0000	1.591
+++ ChangeLog	11 Jul 2005 16:10:54 -0000
@@ -1,3 +1,10 @@
+2005-07-11  Rodrigo Moya <rodrigo novell com>
+
+	Original patch by Ray Strode <rstrode redhat com>
+
+	* configure.in: added --enable-services flag to compile services code
+	conditionally.
+
 2005-07-03  Aivars Kalvans  <aivars kalvans inbox lv>
 
 	* configure.in: smproxy requires glib-2.0, does not require libgnome
Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-session/configure.in,v
retrieving revision 1.511
diff -u -p -r1.511 configure.in
--- configure.in	3 Jul 2005 18:50:14 -0000	1.511
+++ configure.in	11 Jul 2005 16:10:54 -0000
@@ -61,6 +61,22 @@ PKG_CHECK_MODULES(GNOME_SESSION, gtk+-2.
 
 PKG_CHECK_MODULES(SMPROXY, glib-2.0)
 
+dnl See if we build the services code
+enable_services=no
+build_services=no
+AC_ARG_ENABLE(services, [ --enable-services=[no/yes]	enable services code], enable_services=yes, enable_services=no)
+if test "x$enable_services" = "xyes"; then
+   PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1, have_dbus=yes, have_dbus=no)
+   if test "x$have_dbus" = "xyes"; then
+      build_services=yes
+      AC_SUBST(DBUS_CFLAGS)
+      AC_SUBST(DBUS_LIBS)
+      AC_DEFINE(BUILD_SERVICES, 1, [Whether to build services code or not])
+   fi
+fi
+
+AM_CONDITIONAL(BUILD_SERVICES, test "x$build_services" = "xyes")
+
 dnl gconf checks
 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
 
Index: gnome-session/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/ChangeLog,v
retrieving revision 1.448
diff -u -p -r1.448 ChangeLog
--- gnome-session/ChangeLog	21 Jun 2005 01:24:27 -0000	1.448
+++ gnome-session/ChangeLog	11 Jul 2005 16:10:55 -0000
@@ -1,3 +1,17 @@
+2005-07-11  Rodrigo Moya <rodrigo novell com>
+
+	Original patch by Ray Strode <rstrode redhat com>
+
+	* gnome-session/Makefile.am: added DBUS_CFLAGS/LIBS and conditionally
+	compile the services-related source files.
+
+	* gnome-session/main.c: added #ifdef'ed code for new service activation
+	framework, to be compiled conditionally.
+
+	* gnome-session/gsm-dbus-utils.[ch]:
+	* gnome-session/gsm-service.[ch]:
+	* gnome-session/gsm-service-manager.[ch]: new files.
+
 2005-06-20  Federico Mena Quintero  <federico ximian com>
 
 	* main.c (main): Free the result of gdk_get_display().  Fixes
Index: gnome-session/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/Makefile.am,v
retrieving revision 1.108
diff -u -p -r1.108 Makefile.am
--- gnome-session/Makefile.am	10 Jan 2005 16:36:40 -0000	1.108
+++ gnome-session/Makefile.am	11 Jul 2005 16:10:55 -0000
@@ -16,7 +16,9 @@ INCLUDES =						\
 	-DRSH_COMMAND=\""$(RSH_COMMAND)\""		\
 	-DGCONFTOOL_CMD=\""$(GCONFTOOL)\""		\
 	-DDEFAULTDIR="\"$(defaultdir)\""		\
-	-DESD_SERVER="\"$(ESD_SERVER)\""
+	-DESD_SERVER="\"$(ESD_SERVER)\""                \
+	-DDBUS_API_SUBJECT_TO_CHANGE			\
+	$(DBUS_CFLAGS)
 
 # Used by the GNOME_PROGRAM_STANDARD_PROPERTIES macros
 STANDARD_PROPERTIES_CFLAGS =                                    \
@@ -26,7 +28,8 @@ STANDARD_PROPERTIES_CFLAGS =            
 	-DDATADIR=\""$(datadir)"\"                              \
 	$(NULL)
 
-gnome_session_LDADD = $(X_LIBS) $(GNOME_SESSION_LIBS) $(LIBWRAP_LIBS)
+gnome_session_CFLAGS  = -DDEBUG
+gnome_session_LDADD = $(X_LIBS) $(GNOME_SESSION_LIBS) $(LIBWRAP_LIBS) $(DBUS_LIBS)
 gnome_session_save_LDADD = $(GNOME_SESSION_LIBS)
 gnome_session_remove_LDADD = $(GNOME_SESSION_LIBS)
 gnome_session_properties_LDADD = $(GNOME_SESSION_LIBS)
@@ -70,6 +73,18 @@ logout_test_SOURCES =		\
 	gdm-logout-action.h	\
 	$(EGGFILES)
 
+if BUILD_SERVICES
+services_source_files = 	\
+	gsm-dbus-utils.c 	\
+	gsm-dbus-utils.h	\
+	gsm-service.c		\
+	gsm-service.h		\
+	gsm-service-manager.c	\
+	gsm-service-manager.h
+else
+services_source_files =
+endif
+
 gnome_session_SOURCES =		\
 	manager.c		\
 	manager.h		\
@@ -89,6 +104,7 @@ gnome_session_SOURCES =		\
 	logout.h		\
 	splash-widget.c		\
 	splash-widget.h		\
+	$(services_source_files)\
 	gsm-xrandr.c		\
 	gsm-xrandr.h		\
 	gsm-keyring.c		\
Index: gnome-session/gsm-marshal.list
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/gsm-marshal.list,v
retrieving revision 1.1
diff -u -p -r1.1 gsm-marshal.list
--- gnome-session/gsm-marshal.list	27 Sep 2001 14:55:01 -0000	1.1
+++ gnome-session/gsm-marshal.list	11 Jul 2005 16:10:55 -0000
@@ -1 +1,2 @@
 NONE:INT,POINTER
+
Index: gnome-session/main.c
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/main.c,v
retrieving revision 1.66
diff -u -p -r1.66 main.c
--- gnome-session/main.c	21 Jun 2005 01:24:27 -0000	1.66
+++ gnome-session/main.c	11 Jul 2005 16:10:55 -0000
@@ -48,6 +48,10 @@
 #include "gsm-xrandr.h"
 #include "gsm-at-startup.h"
 #include "gsm-remote-desktop.h"
+#ifdef BUILD_SERVICES
+#include "gsm-service-manager.h"
+#include "gsm-service.h"
+#endif
 
 /* Flag indicating autosave - user won't be prompted on logout to 
  * save the session */
@@ -313,10 +317,43 @@ gsm_shutdown_gconfd (void)
   g_free (command);
 }
 
+#ifdef BUILD_SERVICES
+static gboolean 
+is_done (GsmServiceManager *manager)
+{
+  GSList *services, *l;
+  gboolean retval;
+
+  services = gsm_service_manager_list_services (manager);
+
+  retval = TRUE;
+  for (l = services; l != NULL; l = l->next)
+    {
+      GsmService *service;
+
+      service = (GsmService *) l->data;
+      if (gsm_service_get_status (service) != GSM_SERVICE_STATUS_RUNNING)
+        {
+
+          gsm_verbose ("still waiting on service '%s'\n",
+                       gsm_service_get_name (service));
+          retval = FALSE;
+        }
+    }
+  g_slist_free (services);
+
+  return retval;
+}
+#endif
+
 int
 main (int argc, char *argv[])
 {
   char *ep;
+#ifdef BUILD_SERVICES
+  GsmServiceManager *service_manager;
+  guint times = 0;
+#endif
   char *session_name_env;
   Session *the_session;
   GConfClient *gconf_client;
@@ -377,8 +414,8 @@ main (int argc, char *argv[])
 		  GNOME_PARAM_POPT_TABLE, options,
 		  NULL);
 
- /* FIXME: it would be nice to skip this check if we're debugging the
- session manager. */
+  /* FIXME: it would be nice to skip this check if we're debugging the
+     session manager. */
 
   if (GNOME_CLIENT_CONNECTED (gnome_master_client ()))
   {
@@ -400,9 +437,11 @@ main (int argc, char *argv[])
 
   ignore (SIGPIPE);
 
+#ifndef BUILD_SERVICES
   /* Need DISPLAY set */
   gsm_keyring_daemon_start ();
-  
+#endif
+
   /* Read in config options */  
   gconf_client = gconf_client_get_default ();
 
@@ -450,6 +489,17 @@ main (int argc, char *argv[])
   if(failsafe)
 	session_name = FAILSAFE_SESSION;
   
+#ifdef BUILD_SERVICES
+  /* Start services that are registered with D-BUS
+   */
+  service_manager = gsm_service_manager_new ();
+
+  if (!gsm_service_manager_connect_to_bus (service_manager))
+    return 1;
+
+  gsm_service_manager_start (service_manager);
+#endif
+
   session_name_env = g_strconcat ("GNOME_DESKTOP_SESSION_ID=", session_name, NULL);
   putenv (session_name_env);
   the_session = read_session (session_name);
@@ -470,12 +520,20 @@ main (int argc, char *argv[])
 
   gtk_main ();
 
+#ifdef BUILD_SERVICES
+  gsm_service_manager_stop (service_manager);
+  g_object_unref (service_manager);
+  
+#else
   gsm_remote_desktop_cleanup ();
+#endif
 
   gsm_sound_logout ();
 
+#ifndef BUILD_SERVICES
   gsm_keyring_daemon_stop ();
-  
+#endif
+
   gsm_shutdown_gconfd ();
 
   clean_ice ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]