Commit 672daf9d authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Cosimo Cecchi

Update the EggSMClient code from libegg trunk.

2009-04-09  Cosimo Cecchi  <cosimoc@gnome.org>

	* cut-n-paste-code/libegg/eggsmclient-xsmp.c: (save_state),
	(set_properties), (ptrarray_prop):
	* cut-n-paste-code/libegg/eggsmclient.c:
	(egg_sm_client_get_option_group):
	Update the EggSMClient code from libegg trunk.

svn path=/trunk/; revision=15174
parent af3eb62a
2009-04-09 Cosimo Cecchi <cosimoc@gnome.org>
* cut-n-paste-code/libegg/eggsmclient-xsmp.c: (save_state),
(set_properties), (ptrarray_prop):
* cut-n-paste-code/libegg/eggsmclient.c:
(egg_sm_client_get_option_group):
Update the EggSMClient code from libegg trunk.
2009-04-08 Cosimo Cecchi <cosimoc@gnome.org>
* cut-n-paste-code/libegg/eggtreemultidnd.c:
......
......@@ -795,14 +795,18 @@ save_state (EggSMClientXSMP *xsmp)
if (desktop_file)
{
GKeyFile *merged_file;
char *desktop_file_path;
merged_file = g_key_file_new ();
if (g_key_file_load_from_file (merged_file,
egg_desktop_file_get_source (desktop_file),
desktop_file_path =
g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
NULL, NULL);
if (desktop_file_path &&
g_key_file_load_from_file (merged_file, desktop_file_path,
G_KEY_FILE_KEEP_COMMENTS |
G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
{
int g, k, i;
guint g, k, i;
char **groups, **keys, *value, *exec;
groups = g_key_file_get_groups (state_file, NULL);
......@@ -841,8 +845,11 @@ save_state (EggSMClientXSMP *xsmp)
EGG_DESKTOP_FILE_KEY_EXEC,
exec);
g_free (exec);
}
else
desktop_file = NULL;
g_free (desktop_file_path);
}
/* Now write state_file to disk. (We can't use mktemp(), because
......@@ -1071,7 +1078,7 @@ set_properties (EggSMClientXSMP *xsmp, ...)
GPtrArray *props;
SmProp *prop;
va_list ap;
int i;
guint i;
props = g_ptr_array_new ();
......@@ -1164,7 +1171,7 @@ ptrarray_prop (const char *name, GPtrArray *values)
SmProp *prop;
SmPropValue pv;
GArray *vals;
int i;
guint i;
prop = g_new (SmProp, 1);
prop->name = (char *)name;
......
......@@ -38,7 +38,7 @@ enum {
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static guint signals[LAST_SIGNAL];
struct _EggSMClientPrivate {
GKeyFile *state_file;
......@@ -178,23 +178,7 @@ egg_sm_client_class_init (EggSMClientClass *klass)
static gboolean sm_client_disable = FALSE;
static char *sm_client_state_file = NULL;
static char *sm_client_id = NULL;
static GOptionEntry entries[] = {
{ "sm-client-disable", 0, 0,
G_OPTION_ARG_NONE, &sm_client_disable,
N_("Disable connection to session manager"), NULL },
{ "sm-client-state-file", 0, 0,
G_OPTION_ARG_STRING, &sm_client_state_file,
N_("Specify file containing saved configuration"), N_("FILE") },
{ "sm-client-id", 0, 0,
G_OPTION_ARG_STRING, &sm_client_id,
N_("Specify session management ID"), N_("ID") },
/* Compatibility options */
{ "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &sm_client_disable,
NULL, NULL },
{ NULL }
};
static char *sm_config_prefix = NULL;
static gboolean
sm_client_post_parse_func (GOptionContext *context,
......@@ -235,6 +219,29 @@ sm_client_post_parse_func (GOptionContext *context,
GOptionGroup *
egg_sm_client_get_option_group (void)
{
const GOptionEntry entries[] = {
{ "sm-client-disable", 0, 0,
G_OPTION_ARG_NONE, &sm_client_disable,
N_("Disable connection to session manager"), NULL },
{ "sm-client-state-file", 0, 0,
G_OPTION_ARG_FILENAME, &sm_client_state_file,
N_("Specify file containing saved configuration"), N_("FILE") },
{ "sm-client-id", 0, 0,
G_OPTION_ARG_STRING, &sm_client_id,
N_("Specify session management ID"), N_("ID") },
/* GnomeClient compatibility option */
{ "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_NONE, &sm_client_disable,
NULL, NULL },
/* GnomeClient compatibility option. This is a dummy option that only
* exists so that sessions saved by apps with GnomeClient can be restored
* later when they've switched to EggSMClient. See bug #575308.
*/
{ "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_STRING, &sm_config_prefix,
NULL, NULL },
{ NULL }
};
GOptionGroup *group;
/* Use our own debug handler for the "EggSMClient" domain. */
......@@ -242,8 +249,8 @@ egg_sm_client_get_option_group (void)
egg_sm_client_debug_handler, NULL);
group = g_option_group_new ("sm-client",
_("Session Management Options"),
_("Show Session Management options"),
_("Session management options:"),
_("Show session management options"),
NULL, NULL);
g_option_group_add_entries (group, entries);
g_option_group_set_parse_hooks (group, NULL, sm_client_post_parse_func);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment