[Xfce4-commits] <libxfce4ui:new-sm-client> automatically handle SmCloneCommand, hide from API
Brian J. Tarricone
noreply at xfce.org
Sat Sep 19 11:38:02 CEST 2009
Updating branch refs/heads/kelnos/new-sm-client
to b23f7ed1ed86c8da300577b74d4098fe49850083 (commit)
from ee7cd1f527861e9caf3cf1b4d4860607030c0376 (commit)
commit b23f7ed1ed86c8da300577b74d4098fe49850083
Author: Brian J. Tarricone <brian at tarricone.org>
Date: Sat Sep 19 02:21:50 2009 -0700
automatically handle SmCloneCommand, hide from API
docs/libxfce4ui-sections.txt | 2 -
docs/tmpl/xfce-sm-client.sgml | 24 -----------
libxfce4ui/libxfce4ui.symbols | 2 -
libxfce4ui/xfce-sm-client.c | 93 ++++++++++++-----------------------------
libxfce4ui/xfce-sm-client.h | 5 --
5 files changed, 27 insertions(+), 99 deletions(-)
diff --git a/docs/libxfce4ui-sections.txt b/docs/libxfce4ui-sections.txt
index d8b2c26..0cb1f5d 100644
--- a/docs/libxfce4ui-sections.txt
+++ b/docs/libxfce4ui-sections.txt
@@ -88,8 +88,6 @@ xfce_sm_client_set_desktop_file
xfce_sm_client_request_shutdown
xfce_sm_client_get_client_id
xfce_sm_client_get_state_file
-xfce_sm_client_get_clone_command
-xfce_sm_client_set_clone_command
xfce_sm_client_get_current_directory
xfce_sm_client_set_current_directory
xfce_sm_client_get_discard_command
diff --git a/docs/tmpl/xfce-sm-client.sgml b/docs/tmpl/xfce-sm-client.sgml
index cdadf74..ec066fe 100644
--- a/docs/tmpl/xfce-sm-client.sgml
+++ b/docs/tmpl/xfce-sm-client.sgml
@@ -75,11 +75,6 @@
</para>
-<!-- ##### ARG XfceSMClient:clone-command ##### -->
-<para>
-
-</para>
-
<!-- ##### ARG XfceSMClient:current-directory ##### -->
<para>
@@ -184,7 +179,6 @@
@resumed_client_id:
@current_directory:
@restart_command:
- at clone_command:
@discard_command:
@Returns:
@@ -252,24 +246,6 @@
@Returns:
-<!-- ##### FUNCTION xfce_sm_client_get_clone_command ##### -->
-<para>
-
-</para>
-
- at sm_client:
- at Returns:
-
-
-<!-- ##### FUNCTION xfce_sm_client_set_clone_command ##### -->
-<para>
-
-</para>
-
- at sm_client:
- at clone_command:
-
-
<!-- ##### FUNCTION xfce_sm_client_get_current_directory ##### -->
<para>
diff --git a/libxfce4ui/libxfce4ui.symbols b/libxfce4ui/libxfce4ui.symbols
index 3517027..c7a22e8 100644
--- a/libxfce4ui/libxfce4ui.symbols
+++ b/libxfce4ui/libxfce4ui.symbols
@@ -111,8 +111,6 @@ xfce_sm_client_set_restart_style
xfce_sm_client_get_restart_style
xfce_sm_client_set_priority
xfce_sm_client_get_priority
-xfce_sm_client_set_clone_command
-xfce_sm_client_get_clone_command
xfce_sm_client_set_restart_command
xfce_sm_client_get_restart_command
xfce_sm_client_set_discard_command
diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index 4acec2b..8285b2b 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -208,7 +208,6 @@ enum
PROP_PRIORITY,
PROP_CLIENT_ID,
PROP_CURRENT_DIRECTORY,
- PROP_CLONE_COMMAND,
PROP_RESTART_COMMAND,
PROP_DISCARD_COMMAND,
PROP_DESKTOP_FILE,
@@ -232,6 +231,12 @@ static void xfce_sm_client_finalize(GObject *obj);
static void xfce_sm_client_set_client_id(XfceSMClient *sm_client,
const gchar *client_id);
static void xfce_sm_client_parse_argv(XfceSMClient *sm_client);
+static void xfce_sm_client_set_property_from_command(XfceSMClient *sm_client,
+ const char *property_name,
+ gchar **command,
+ gint alter_sm_id);
+static gchar **copy_command(gchar **command,
+ gchar **value);
static guint signals[N_SIGS] = { 0, };
@@ -392,12 +397,6 @@ xfce_sm_client_class_init(XfceSMClientClass *klass)
"The directory that should be used as the working directory the next time this client is restarted",
NULL,
G_PARAM_READWRITE));
- g_object_class_install_property(gobject_class, PROP_CLONE_COMMAND,
- g_param_spec_boxed("clone-command",
- "Clone command",
- "A command used to launch a fresh instance of the application",
- G_TYPE_STRV,
- G_PARAM_READWRITE));
g_object_class_install_property(gobject_class, PROP_RESTART_COMMAND,
g_param_spec_boxed("restart-command",
"Restart command",
@@ -467,10 +466,6 @@ xfce_sm_client_get_property(GObject *obj,
g_value_set_string(value, sm_client->current_directory);
break;
- case PROP_CLONE_COMMAND:
- g_value_set_boxed(value, sm_client->clone_command);
- break;
-
case PROP_RESTART_COMMAND:
g_value_set_boxed(value, sm_client->restart_command);
break;
@@ -517,11 +512,6 @@ xfce_sm_client_set_property(GObject *obj,
g_value_get_string(value));
break;
- case PROP_CLONE_COMMAND:
- xfce_sm_client_set_clone_command(sm_client,
- g_value_get_boxed(value));
- break;
-
case PROP_RESTART_COMMAND:
xfce_sm_client_set_restart_command(sm_client,
g_value_get_boxed(value));
@@ -650,6 +640,20 @@ xfce_sm_client_set_client_id(XfceSMClient *sm_client,
}
static void
+xfce_sm_client_set_clone_command(XfceSMClient *sm_client,
+ gchar **clone_command)
+{
+ g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
+ sm_client->clone_command = copy_command(sm_client->clone_command,
+ clone_command);
+#ifdef HAVE_LIBSM
+ xfce_sm_client_set_property_from_command(sm_client, SmCloneCommand,
+ sm_client->clone_command,
+ SM_ARG_REMOVE);
+#endif
+}
+
+static void
xfce_sm_client_parse_argv(XfceSMClient *sm_client)
{
guint argc = 0;
@@ -667,7 +671,9 @@ xfce_sm_client_parse_argv(XfceSMClient *sm_client)
argc = sm_client->argc;
argv = sm_client->argv;
- clone_command = g_new0(gchar *, argc + 1);
+ /* prefer using Exec= from the .desktop file, if any */
+ if(!sm_client->clone_command)
+ clone_command = g_new0(gchar *, argc + 1);
for(i = 0; i < argc; ++i) {
if(!strncmp(argv[i], SM_ID_ARG, strlen(SM_ID_ARG))) {
@@ -683,7 +689,8 @@ xfce_sm_client_parse_argv(XfceSMClient *sm_client)
if(!strcmp(argv[i], "--sm-client-disable"))
startup_options.sm_disable = TRUE;
- clone_command[clone_argc++] = argv[i];
+ if(clone_command)
+ clone_command[clone_argc++] = argv[i];
}
}
@@ -706,7 +713,8 @@ xfce_sm_client_parse_argv(XfceSMClient *sm_client)
restart_command && restart_command[0] ? restart_command[0] : "(null)",
clone_command && clone_command[0] ? clone_command[0] : "(null)");
xfce_sm_client_set_restart_command(sm_client, restart_command);
- xfce_sm_client_set_clone_command(sm_client, clone_command);
+ if(clone_command)
+ xfce_sm_client_set_clone_command(sm_client, clone_command);
if(restart_command != argv)
g_free(restart_command);
@@ -1457,8 +1465,6 @@ xfce_sm_client_get_with_argv(guint argc,
* @current_directory: The application's working directory
* @restart_command: A command that can resume the application's
* saved state
- * @clone_command: A command that can start a fresh copy of the
- * application
* @discard_command: A command that cleans up the application's
* state when removed from the session
*
@@ -1481,7 +1487,6 @@ xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
const gchar *resumed_client_id,
const gchar *current_directory,
const gchar **restart_command,
- const gchar **clone_command,
const gchar **discard_command)
{
return g_object_new(XFCE_TYPE_SM_CLIENT,
@@ -1490,7 +1495,6 @@ xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
"client-id", resumed_client_id,
"current-directory", current_directory,
"restart-command", restart_command,
- "clone-command", clone_command,
"discard-command", discard_command,
NULL);
}
@@ -2000,33 +2004,6 @@ copy_command(gchar **command,
}
/**
- * xfce_sm_client_set_clone_command:
- * @sm_client: An #XfceSMClient
- * @clone_command: An argument vector
- *
- * Sets the application's "clone" command, which is used to start
- * a fresh copy of the application, without restoring any state
- * from a previous run.
- *
- * If unset, this will default to the restart command, with
- * any session management related arguments removed.
- **/
-void
-xfce_sm_client_set_clone_command(XfceSMClient *sm_client,
- gchar **clone_command)
-{
- g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
- sm_client->clone_command = copy_command(sm_client->clone_command,
- clone_command);
-#ifdef HAVE_LIBSM
- xfce_sm_client_set_property_from_command(sm_client, SmCloneCommand,
- sm_client->clone_command,
- SM_ARG_REMOVE);
-#endif
- g_object_notify(G_OBJECT(sm_client), "clone-command");
-}
-
-/**
* xfce_sm_client_set_restart_command:
* @sm_client: An #XfceSMClient
* @restart_command: An argument vector
@@ -2233,22 +2210,6 @@ xfce_sm_client_get_current_directory(XfceSMClient *sm_client)
}
/**
- * xfce_sm_client_get_clone_command:
- * @sm_client: An #XfceSMClient
- *
- * Retrieves the session client's clone command. See
- * xfce_sm_client_set_clone_command() for more information.
- *
- * Returns: an object-owned string vector
- **/
-gchar **
-xfce_sm_client_get_clone_command(XfceSMClient *sm_client)
-{
- g_return_val_if_fail(XFCE_IS_SM_CLIENT(sm_client), NULL);
- return sm_client->clone_command;
-}
-
-/**
* xfce_sm_client_get_restart_command:
* @sm_client: An #XfceSMClient
*
diff --git a/libxfce4ui/xfce-sm-client.h b/libxfce4ui/xfce-sm-client.h
index 830fd06..e143a0d 100644
--- a/libxfce4ui/xfce-sm-client.h
+++ b/libxfce4ui/xfce-sm-client.h
@@ -77,7 +77,6 @@ XfceSMClient *xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
const gchar *resumed_client_id,
const gchar *current_directory,
const gchar **restart_command,
- const gchar **clone_command,
const gchar **discard_command);
gboolean xfce_sm_client_connect(XfceSMClient *sm_client,
@@ -108,10 +107,6 @@ void xfce_sm_client_set_current_directory(XfceSMClient *sm_client,
const gchar *current_directory);
G_CONST_RETURN gchar *xfce_sm_client_get_current_directory(XfceSMClient *sm_client);
-void xfce_sm_client_set_clone_command(XfceSMClient *sm_client,
- gchar **clone_command);
-gchar **xfce_sm_client_get_clone_command(XfceSMClient *sm_client);
-
void xfce_sm_client_set_restart_command(XfceSMClient *sm_client,
gchar **restart_command);
gchar **xfce_sm_client_get_restart_command(XfceSMClient *sm_client);
More information about the Xfce4-commits
mailing list