[monkey-bubble: 6/753] Added notion of `initialization command' to session client interface tromey cygnus com
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 6/753] Added notion of `initialization command' to session client interface tromey cygnus com
- Date: Wed, 14 Jul 2010 21:56:11 +0000 (UTC)
commit 5ae04a02d31089b0f0589946ed26a2a91f1f0a02
Author: Tom Tromey <tromey src gnome org>
Date: Sun Dec 7 23:13:04 1997 +0000
Added notion of `initialization command' to session client interface
tromey cygnus com
libgnomeui/gnome-session.c | 71 ++++++++++---------------------------------
libgnomeui/gnome-session.h | 9 +++++
2 files changed, 26 insertions(+), 54 deletions(-)
---
diff --git a/libgnomeui/gnome-session.c b/libgnomeui/gnome-session.c
index f01ea42..68b806e 100644
--- a/libgnomeui/gnome-session.c
+++ b/libgnomeui/gnome-session.c
@@ -246,8 +246,9 @@ gnome_session_set_program (char *name)
#endif /* HAVE_LIBSM */
}
-void
-gnome_session_set_discard_command (int argc, char *argv[])
+/* Helper. */
+static void
+set_prop_from_argv (char *property, int argc, char *argv[])
{
#ifdef HAVE_LIBSM
SmProp prop, *proplist[1];
@@ -257,7 +258,7 @@ gnome_session_set_discard_command (int argc, char *argv[])
if (! info)
return;
- prop.name = SmDiscardCommand;
+ prop.name = property;
prop.type = SmLISTofARRAY8;
vals = (SmPropValue *) malloc (argc * sizeof (SmPropValue));
@@ -278,65 +279,27 @@ gnome_session_set_discard_command (int argc, char *argv[])
}
void
-gnome_session_set_restart_command (int argc, char *argv[])
+gnome_session_set_discard_command (int argc, char *argv[])
{
-#ifdef HAVE_LIBSM
- SmProp prop, *proplist[1];
- SmPropValue *vals;
- int i;
-
- if (! info)
- return;
-
- prop.name = SmRestartCommand;
- prop.type = SmLISTofARRAY8;
-
- vals = (SmPropValue *) malloc (argc * sizeof (SmPropValue));
- for (i = 0; i < argc; ++i)
- {
- vals[i].length = strlen (argv[i]) + 1;
- vals[i].value = argv[i];
- }
-
- prop.num_vals = argc;
- prop.vals = vals;
- proplist[0] = ∝
-
- SmcSetProperties (info->connection, 1, proplist);
+ set_prop_from_argv (SmDiscardCommand, argc, argv);
+}
- free (vals);
-#endif /* HAVE_LIBSM */
+void
+gnome_session_set_restart_command (int argc, char *argv[])
+{
+ set_prop_from_argv (SmRestartCommand, argc, argv);
}
void
gnome_session_set_clone_command (int argc, char *argv[])
{
-#ifdef HAVE_LIBSM
- SmProp prop, *proplist[1];
- SmPropValue *vals;
- int i;
-
- if (! info)
- return;
-
- prop.name = SmCloneCommand;
- prop.type = SmLISTofARRAY8;
-
- vals = (SmPropValue *) malloc (argc * sizeof (SmPropValue));
- for (i = 0; i < argc; ++i)
- {
- vals[i].length = strlen (argv[i]) + 1;
- vals[i].value = argv[i];
- }
-
- prop.num_vals = argc;
- prop.vals = vals;
- proplist[0] = ∝
-
- SmcSetProperties (info->connection, 1, proplist);
+ set_prop_from_argv (SmCloneCommand, argc, argv);
+}
- free (vals);
-#endif /* HAVE_LIBSM */
+void
+gnome_session_set_initialization_command (int argc, char *argv[])
+{
+ set_prop_from_argv (GNOME_SM_INIT_COMMAND, argc, argv);
}
#ifdef HAVE_LIBSM
diff --git a/libgnomeui/gnome-session.h b/libgnomeui/gnome-session.h
index 7bfac4f..2143dbd 100644
--- a/libgnomeui/gnome-session.h
+++ b/libgnomeui/gnome-session.h
@@ -25,6 +25,10 @@ BEGIN_GNOME_DECLS
#define SmRestartNever 3
#endif /* HAVE_LIBSM */
+/* Name of the initialization command property. */
+#define GNOME_SM_INIT_COMMAND "InitializationCommand"
+
+
/* Some redefinitions so we can use familiar names. */
typedef enum
{
@@ -99,6 +103,11 @@ void gnome_session_set_restart_command (int argc, char *argv[]);
doesn't preserve session id info. */
void gnome_session_set_clone_command (int argc, char *argv[]);
+/* Set the initialization command. This is a Gnome-specific
+ extension. When a session starts, each initialization command gets
+ run exactly once (duplicates are trimmed). */
+void gnome_session_set_initialization_command (int argc, char *argv[]);
+
/* Set the program name. The argument should just be ARGV[0]. */
void gnome_session_set_program (char *name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]