Re: Gnome Session Services Framework



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?
-- 
Rodrigo Moya <rodrigo gnome-db org>
? gsm-dbus-utils.c
? gsm-dbus-utils.h
? gsm-service-manager.c
? gsm-service-manager.h
? gsm-service.c
? gsm-service.h
? service-manager-test
? session-properties.desktop.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/ChangeLog,v
retrieving revision 1.448
diff -u -p -r1.448 ChangeLog
--- ChangeLog	21 Jun 2005 01:24:27 -0000	1.448
+++ ChangeLog	11 Jul 2005 15:45:55 -0000
@@ -1,3 +1,20 @@
+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.
+
+	* 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: Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/Makefile.am,v
retrieving revision 1.108
diff -u -p -r1.108 Makefile.am
--- Makefile.am	10 Jan 2005 16:36:40 -0000	1.108
+++ Makefile.am	11 Jul 2005 15:45: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: 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
--- gsm-marshal.list	27 Sep 2001 14:55:01 -0000	1.1
+++ gsm-marshal.list	11 Jul 2005 15:45:55 -0000
@@ -1 +1,2 @@
 NONE:INT,POINTER
+
Index: main.c
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/main.c,v
retrieving revision 1.66
diff -u -p -r1.66 main.c
--- main.c	21 Jun 2005 01:24:27 -0000	1.66
+++ main.c	11 Jul 2005 15:45: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]