diff options
Diffstat (limited to 'smclient')
-rw-r--r-- | smclient/eggdesktopfile.c | 192 | ||||
-rw-r--r-- | smclient/eggdesktopfile.h | 54 | ||||
-rw-r--r-- | smclient/eggsmclient-private.h | 1 | ||||
-rw-r--r-- | smclient/eggsmclient-xsmp.c | 182 | ||||
-rw-r--r-- | smclient/eggsmclient.c | 26 | ||||
-rw-r--r-- | smclient/eggsmclient.h | 11 |
6 files changed, 230 insertions, 236 deletions
diff --git a/smclient/eggdesktopfile.c b/smclient/eggdesktopfile.c index 6f6b94684d..9f18be1dc6 100644 --- a/smclient/eggdesktopfile.c +++ b/smclient/eggdesktopfile.c @@ -36,11 +36,11 @@ struct EggDesktopFile { GKeyFile *key_file; - char *source; + gchar *source; - char *name, *icon; + gchar *name, *icon; EggDesktopFileType type; - char document_code; + gchar document_code; }; /** @@ -53,7 +53,7 @@ struct EggDesktopFile { * Return value: the new #EggDesktopFile, or %NULL on error. **/ EggDesktopFile * -egg_desktop_file_new (const char *desktop_file_path, GError **error) +egg_desktop_file_new (const gchar *desktop_file_path, GError **error) { GKeyFile *key_file; @@ -80,12 +80,12 @@ egg_desktop_file_new (const char *desktop_file_path, GError **error) * Return value: the new #EggDesktopFile, or %NULL on error. **/ EggDesktopFile * -egg_desktop_file_new_from_data_dirs (const char *desktop_file_path, +egg_desktop_file_new_from_data_dirs (const gchar *desktop_file_path, GError **error) { EggDesktopFile *desktop_file; GKeyFile *key_file; - char *full_path; + gchar *full_path; key_file = g_key_file_new (); if (!g_key_file_load_from_data_dirs (key_file, desktop_file_path, @@ -115,13 +115,13 @@ egg_desktop_file_new_from_data_dirs (const char *desktop_file_path, * Return value: the new #EggDesktopFile, or %NULL on error. **/ EggDesktopFile * -egg_desktop_file_new_from_dirs (const char *desktop_file_path, - const char **search_dirs, +egg_desktop_file_new_from_dirs (const gchar *desktop_file_path, + const gchar **search_dirs, GError **error) { EggDesktopFile *desktop_file; GKeyFile *key_file; - char *full_path; + gchar *full_path; key_file = g_key_file_new (); if (!g_key_file_load_from_dirs (key_file, desktop_file_path, search_dirs, @@ -152,11 +152,11 @@ egg_desktop_file_new_from_dirs (const char *desktop_file_path, **/ EggDesktopFile * egg_desktop_file_new_from_key_file (GKeyFile *key_file, - const char *source, + const gchar *source, GError **error) { EggDesktopFile *desktop_file; - char *version, *type; + gchar *version, *type; if (!g_key_file_has_group (key_file, EGG_DESKTOP_FILE_GROUP)) { @@ -173,7 +173,7 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file, if (version) { double version_num; - char *end; + gchar *end; version_num = g_ascii_strtod (version, &end); if (*end) @@ -219,7 +219,7 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file, if (!strcmp (type, "Application")) { - char *exec, *p; + gchar *exec, *p; desktop_file->type = EGG_DESKTOP_FILE_TYPE_APPLICATION; @@ -252,7 +252,7 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file, } else if (!strcmp (type, "Link")) { - char *url; + gchar *url; desktop_file->type = EGG_DESKTOP_FILE_TYPE_LINK; @@ -282,7 +282,7 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file, NULL); if (desktop_file->icon && !g_path_is_absolute (desktop_file->icon)) { - char *ext; + gchar *ext; /* Lots of .desktop files still get this wrong */ ext = strrchr (desktop_file->icon, '.'); @@ -325,7 +325,7 @@ egg_desktop_file_free (EggDesktopFile *desktop_file) * * Return value: @desktop_file's source URI **/ -const char * +const gchar * egg_desktop_file_get_source (EggDesktopFile *desktop_file) { return desktop_file->source; @@ -353,7 +353,7 @@ egg_desktop_file_get_desktop_file_type (EggDesktopFile *desktop_file) * * Return value: the application/link name **/ -const char * +const gchar * egg_desktop_file_get_name (EggDesktopFile *desktop_file) { return desktop_file->name; @@ -374,7 +374,7 @@ egg_desktop_file_get_name (EggDesktopFile *desktop_file) * * Return value: the icon path or name **/ -const char * +const gchar * egg_desktop_file_get_icon (EggDesktopFile *desktop_file) { return desktop_file->icon; @@ -382,7 +382,7 @@ egg_desktop_file_get_icon (EggDesktopFile *desktop_file) gboolean egg_desktop_file_has_key (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error) { return g_key_file_has_key (desktop_file->key_file, @@ -390,9 +390,9 @@ egg_desktop_file_has_key (EggDesktopFile *desktop_file, error); } -char * +gchar * egg_desktop_file_get_string (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error) { return g_key_file_get_string (desktop_file->key_file, @@ -400,10 +400,10 @@ egg_desktop_file_get_string (EggDesktopFile *desktop_file, error); } -char * +gchar * egg_desktop_file_get_locale_string (EggDesktopFile *desktop_file, - const char *key, - const char *locale, + const gchar *key, + const gchar *locale, GError **error) { return g_key_file_get_locale_string (desktop_file->key_file, @@ -413,7 +413,7 @@ egg_desktop_file_get_locale_string (EggDesktopFile *desktop_file, gboolean egg_desktop_file_get_boolean (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error) { return g_key_file_get_boolean (desktop_file->key_file, @@ -421,9 +421,9 @@ egg_desktop_file_get_boolean (EggDesktopFile *desktop_file, error); } -double +gdouble egg_desktop_file_get_numeric (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error) { return g_key_file_get_double (desktop_file->key_file, @@ -431,9 +431,9 @@ egg_desktop_file_get_numeric (EggDesktopFile *desktop_file, error); } -char ** +gchar ** egg_desktop_file_get_string_list (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, gsize *length, GError **error) { @@ -442,10 +442,10 @@ egg_desktop_file_get_string_list (EggDesktopFile *desktop_file, error); } -char ** +gchar ** egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file, - const char *key, - const char *locale, + const gchar *key, + const gchar *locale, gsize *length, GError **error) { @@ -477,12 +477,12 @@ egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file, **/ gboolean egg_desktop_file_can_launch (EggDesktopFile *desktop_file, - const char *desktop_environment) + const gchar *desktop_environment) { - char *try_exec, *found_program; - char **only_show_in, **not_show_in; + gchar *try_exec, *found_program; + gchar **only_show_in, **not_show_in; gboolean found; - int i; + gint i; if (desktop_file->type != EGG_DESKTOP_FILE_TYPE_APPLICATION && desktop_file->type != EGG_DESKTOP_FILE_TYPE_LINK) @@ -600,11 +600,11 @@ egg_desktop_file_accepts_uris (EggDesktopFile *desktop_file) static void append_quoted_word (GString *str, - const char *s, + const gchar *s, gboolean in_single_quotes, gboolean in_double_quotes) { - const char *p; + const gchar *p; if (!in_single_quotes && !in_double_quotes) g_string_append_c (str, '\''); @@ -632,14 +632,14 @@ append_quoted_word (GString *str, static void do_percent_subst (EggDesktopFile *desktop_file, - char code, + gchar code, GString *str, GSList **documents, gboolean in_single_quotes, gboolean in_double_quotes) { GSList *d; - char *doc; + gchar *doc; switch (code) { @@ -709,12 +709,12 @@ do_percent_subst (EggDesktopFile *desktop_file, } } -static char * +static gchar * parse_exec (EggDesktopFile *desktop_file, GSList **documents, GError **error) { - char *exec, *p, *command; + gchar *exec, *p, *command; gboolean escape, single_quot, double_quot; GString *gs; @@ -810,9 +810,9 @@ translate_document_list (EggDesktopFile *desktop_file, GSList *documents) for (d = documents, ret = NULL; d; d = d->next) { - const char *document = d->data; + const gchar *document = d->data; gboolean is_uri = !g_path_is_absolute (document); - char *translated; + gchar *translated; if (accepts_uris) { @@ -862,13 +862,13 @@ free_document_list (GSList *documents) * * Return value: the parsed Exec string **/ -char * +gchar * egg_desktop_file_parse_exec (EggDesktopFile *desktop_file, GSList *documents, GError **error) { GSList *translated, *docs; - char *command; + gchar *command; docs = translated = translate_document_list (desktop_file, documents); command = parse_exec (desktop_file, &docs, error); @@ -883,7 +883,7 @@ parse_link (EggDesktopFile *desktop_file, GSList **documents, GError **error) { - char *url; + gchar *url; GKeyFile *key_file; url = g_key_file_get_string (desktop_file->key_file, @@ -910,18 +910,18 @@ parse_link (EggDesktopFile *desktop_file, } #if GTK_CHECK_VERSION (2, 12, 0) -static char * +static gchar * start_startup_notification (GdkDisplay *display, EggDesktopFile *desktop_file, - const char *argv0, - int screen, - int workspace, + const gchar *argv0, + gint screen, + gint workspace, guint32 launch_time) { - static int sequence = 0; - char *startup_id; - char *description, *wmclass; - char *screen_str, *workspace_str; + static gint sequence = 0; + gchar *startup_id; + gchar *description, *wmclass; + gchar *screen_str, *workspace_str; if (g_key_file_has_key (desktop_file->key_file, EGG_DESKTOP_FILE_GROUP, @@ -980,7 +980,7 @@ start_startup_notification (GdkDisplay *display, static void end_startup_notification (GdkDisplay *display, - const char *startup_id) + const gchar *startup_id) { gdk_x11_display_broadcast_startup_message (display, "remove", "ID", startup_id, @@ -991,7 +991,7 @@ end_startup_notification (GdkDisplay *display, typedef struct { GdkDisplay *display; - char *startup_id; + gchar *startup_id; } StartupNotificationData; static gboolean @@ -1009,7 +1009,7 @@ startup_notification_timeout (gpointer data) static void set_startup_notification_timeout (GdkDisplay *display, - const char *startup_id) + const gchar *startup_id) { StartupNotificationData *sn_data; @@ -1023,20 +1023,20 @@ set_startup_notification_timeout (GdkDisplay *display, #endif /* GTK 2.12 */ static GPtrArray * -array_putenv (GPtrArray *env, char *variable) +array_putenv (GPtrArray *env, gchar *variable) { guint i, keylen; if (!env) { - char **envp; + gchar **envp; env = g_ptr_array_new (); envp = g_listenv (); for (i = 0; envp[i]; i++) { - const char *value; + const gchar *value; value = g_getenv (envp[i]); g_ptr_array_add (env, g_strdup_printf ("%s=%s", envp[i], @@ -1050,7 +1050,7 @@ array_putenv (GPtrArray *env, char *variable) /* Remove old value of key */ for (i = 0; i < env->len; i++) { - char *envvar = env->pdata[i]; + gchar *envvar = env->pdata[i]; if (!strncmp (envvar, variable, keylen) && envvar[keylen] == '=') { @@ -1073,25 +1073,25 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, { EggDesktopFileLaunchOption option; GSList *translated_documents = NULL, *docs = NULL; - char *command, **argv; - int argc, i, screen_num; + gchar *command, **argv; + gint argc, i, screen_num; gboolean success, current_success; GdkDisplay *display; - char *startup_id; + gchar *startup_id; GPtrArray *env = NULL; - char **variables = NULL; + gchar **variables = NULL; GdkScreen *screen = NULL; - int workspace = -1; - const char *directory = NULL; + gint workspace = -1; + const gchar *directory = NULL; guint32 launch_time = (guint32)-1; GSpawnFlags flags = G_SPAWN_SEARCH_PATH; GSpawnChildSetupFunc setup_func = NULL; gpointer setup_data = NULL; GPid *ret_pid = NULL; - int *ret_stdin = NULL, *ret_stdout = NULL, *ret_stderr = NULL; - char **ret_startup_id = NULL; + gint *ret_stdin = NULL, *ret_stdout = NULL, *ret_stderr = NULL; + gchar **ret_startup_id = NULL; if (documents && desktop_file->document_code == 0) { @@ -1105,7 +1105,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, * NULL-terminate the list of options (rather than 0-terminating * it), but NULL-terminating lets us use G_GNUC_NULL_TERMINATED, * it's more consistent with other glib/gtk methods, and it will - * work as long as sizeof (int) <= sizeof (NULL), and NULL is + * work as long as sizeof (gint) <= sizeof (NULL), and NULL is * represented as 0. (Which is true everywhere we care about.) */ while ((option = va_arg (args, EggDesktopFileLaunchOption))) @@ -1118,7 +1118,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, env = g_ptr_array_new (); break; case EGG_DESKTOP_FILE_LAUNCH_PUTENV: - variables = va_arg (args, char **); + variables = va_arg (args, gchar **); for (i = 0; variables[i]; i++) env = array_putenv (env, variables[i]); break; @@ -1127,11 +1127,11 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, screen = va_arg (args, GdkScreen *); break; case EGG_DESKTOP_FILE_LAUNCH_WORKSPACE: - workspace = va_arg (args, int); + workspace = va_arg (args, gint); break; case EGG_DESKTOP_FILE_LAUNCH_DIRECTORY: - directory = va_arg (args, const char *); + directory = va_arg (args, const gchar *); break; case EGG_DESKTOP_FILE_LAUNCH_TIME: launch_time = va_arg (args, guint32); @@ -1150,16 +1150,16 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, ret_pid = va_arg (args, GPid *); break; case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE: - ret_stdin = va_arg (args, int *); + ret_stdin = va_arg (args, gint *); break; case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE: - ret_stdout = va_arg (args, int *); + ret_stdout = va_arg (args, gint *); break; case EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE: - ret_stderr = va_arg (args, int *); + ret_stderr = va_arg (args, gint *); break; case EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID: - ret_startup_id = va_arg (args, char **); + ret_startup_id = va_arg (args, gchar **); break; default: @@ -1174,8 +1174,8 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, if (screen) { - char *display_name = gdk_screen_make_display_name (screen); - char *display_env = g_strdup_printf ("DISPLAY=%s", display_name); + gchar *display_name = gdk_screen_make_display_name (screen); + gchar *display_env = g_strdup_printf ("DISPLAY=%s", display_name); env = array_putenv (env, display_env); g_free (display_name); g_free (display_env); @@ -1213,7 +1213,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, workspace, launch_time); if (startup_id) { - char *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s", + gchar *startup_id_env = g_strdup_printf ("DESKTOP_STARTUP_ID=%s", startup_id); env = array_putenv (env, startup_id_env); g_free (startup_id_env); @@ -1228,7 +1228,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, current_success = g_spawn_async_with_pipes (directory, argv, - env ? (char **)(env->pdata) : NULL, + env ? (gchar **)(env->pdata) : NULL, flags, setup_func, setup_data, ret_pid, @@ -1294,14 +1294,14 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, * * %EGG_DESKTOP_FILE_LAUNCH_CLEARENV: (no arguments) * clears the environment in the child process - * %EGG_DESKTOP_FILE_LAUNCH_PUTENV: (char **variables) + * %EGG_DESKTOP_FILE_LAUNCH_PUTENV: (gchar **variables) * adds the NAME=VALUE strings in the given %NULL-terminated * array to the child process's environment * %EGG_DESKTOP_FILE_LAUNCH_SCREEN: (GdkScreen *screen) * causes the application to be launched on the given screen - * %EGG_DESKTOP_FILE_LAUNCH_WORKSPACE: (int workspace) + * %EGG_DESKTOP_FILE_LAUNCH_WORKSPACE: (gint workspace) * causes the application to be launched on the given workspace - * %EGG_DESKTOP_FILE_LAUNCH_DIRECTORY: (char *dir) + * %EGG_DESKTOP_FILE_LAUNCH_DIRECTORY: (gchar *dir) * causes the application to be launched in the given directory * %EGG_DESKTOP_FILE_LAUNCH_TIME: (guint32 launch_time) * sets the "launch time" for the application. If the user @@ -1320,16 +1320,16 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, * %EGG_DESKTOP_FILE_LAUNCH_RETURN_PID (GPid **pid) * On a successful launch, sets *@pid to the PID of the launched * application. - * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID (char **startup_id) + * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STARTUP_ID (gchar **startup_id) * On a successful launch, sets *@startup_id to the Startup * Notification "startup id" of the launched application. - * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE (int *fd) + * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDIN_PIPE (gint *fd) * On a successful launch, sets *@fd to the file descriptor of * a pipe connected to the application's stdin. - * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE (int *fd) + * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDOUT_PIPE (gint *fd) * On a successful launch, sets *@fd to the file descriptor of * a pipe connected to the application's stdout. - * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE (int *fd) + * %EGG_DESKTOP_FILE_LAUNCH_RETURN_STDERR_PIPE (gint *fd) * On a successful launch, sets *@fd to the file descriptor of * a pipe connected to the application's stderr. * @@ -1372,7 +1372,7 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file, EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE, _("Can't pass document URIs to a 'Type=Link' desktop entry")); return FALSE; - } + } if (!parse_link (desktop_file, &app_desktop_file, &documents, error)) return FALSE; @@ -1399,19 +1399,17 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file, return success; } - GQuark egg_desktop_file_error_quark (void) { return g_quark_from_static_string ("egg-desktop_file-error-quark"); } - G_LOCK_DEFINE_STATIC (egg_desktop_file); static EggDesktopFile *egg_desktop_file; static void -egg_set_desktop_file_internal (const char *desktop_file_path, +egg_set_desktop_file_internal (const gchar *desktop_file_path, gboolean set_defaults) { GError *error = NULL; @@ -1464,7 +1462,7 @@ egg_set_desktop_file_internal (const char *desktop_file_path, * egg_set_desktop_file_without_defaults(). **/ void -egg_set_desktop_file (const char *desktop_file_path) +egg_set_desktop_file (const gchar *desktop_file_path) { egg_set_desktop_file_internal (desktop_file_path, TRUE); } @@ -1484,17 +1482,17 @@ egg_set_desktop_file (const char *desktop_file_path) * egg_set_desktop_file(). **/ void -egg_set_desktop_file_without_defaults (const char *desktop_file_path) +egg_set_desktop_file_without_defaults (const gchar *desktop_file_path) { egg_set_desktop_file_internal (desktop_file_path, FALSE); } /** * egg_get_desktop_file: - * + * * Gets the application's #EggDesktopFile, as set by * egg_set_desktop_file(). - * + * * Return value: the #EggDesktopFile, or %NULL if it hasn't been set. **/ EggDesktopFile * diff --git a/smclient/eggdesktopfile.h b/smclient/eggdesktopfile.h index 18fe4631a1..2c99705d87 100644 --- a/smclient/eggdesktopfile.h +++ b/smclient/eggdesktopfile.h @@ -34,35 +34,35 @@ typedef enum { EGG_DESKTOP_FILE_TYPE_DIRECTORY } EggDesktopFileType; -EggDesktopFile *egg_desktop_file_new (const char *desktop_file_path, +EggDesktopFile *egg_desktop_file_new (const gchar *desktop_file_path, GError **error); -EggDesktopFile *egg_desktop_file_new_from_data_dirs (const char *desktop_file_path, +EggDesktopFile *egg_desktop_file_new_from_data_dirs (const gchar *desktop_file_path, GError **error); -EggDesktopFile *egg_desktop_file_new_from_dirs (const char *desktop_file_path, - const char **search_dirs, +EggDesktopFile *egg_desktop_file_new_from_dirs (const gchar *desktop_file_path, + const gchar **search_dirs, GError **error); EggDesktopFile *egg_desktop_file_new_from_key_file (GKeyFile *key_file, - const char *source, + const gchar *source, GError **error); void egg_desktop_file_free (EggDesktopFile *desktop_file); -const char *egg_desktop_file_get_source (EggDesktopFile *desktop_file); +const gchar *egg_desktop_file_get_source (EggDesktopFile *desktop_file); EggDesktopFileType egg_desktop_file_get_desktop_file_type (EggDesktopFile *desktop_file); -const char *egg_desktop_file_get_name (EggDesktopFile *desktop_file); -const char *egg_desktop_file_get_icon (EggDesktopFile *desktop_file); +const gchar *egg_desktop_file_get_name (EggDesktopFile *desktop_file); +const gchar *egg_desktop_file_get_icon (EggDesktopFile *desktop_file); gboolean egg_desktop_file_can_launch (EggDesktopFile *desktop_file, - const char *desktop_environment); + const gchar *desktop_environment); gboolean egg_desktop_file_accepts_documents (EggDesktopFile *desktop_file); gboolean egg_desktop_file_accepts_multiple (EggDesktopFile *desktop_file); gboolean egg_desktop_file_accepts_uris (EggDesktopFile *desktop_file); -char *egg_desktop_file_parse_exec (EggDesktopFile *desktop_file, +gchar *egg_desktop_file_parse_exec (EggDesktopFile *desktop_file, GSList *documents, GError **error); @@ -112,32 +112,31 @@ typedef enum { /* Accessors */ gboolean egg_desktop_file_has_key (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error); -char *egg_desktop_file_get_string (EggDesktopFile *desktop_file, - const char *key, +gchar *egg_desktop_file_get_string (EggDesktopFile *desktop_file, + const gchar *key, GError **error) G_GNUC_MALLOC; -char *egg_desktop_file_get_locale_string (EggDesktopFile *desktop_file, - const char *key, - const char *locale, +gchar *egg_desktop_file_get_locale_string (EggDesktopFile *desktop_file, + const gchar *key, + const gchar *locale, GError **error) G_GNUC_MALLOC; gboolean egg_desktop_file_get_boolean (EggDesktopFile *desktop_file, - const char *key, + const gchar *key, GError **error); -double egg_desktop_file_get_numeric (EggDesktopFile *desktop_file, - const char *key, +gdouble egg_desktop_file_get_numeric (EggDesktopFile *desktop_file, + const gchar *key, GError **error); -char **egg_desktop_file_get_string_list (EggDesktopFile *desktop_file, - const char *key, +gchar **egg_desktop_file_get_string_list (EggDesktopFile *desktop_file, + const gchar *key, gsize *length, GError **error) G_GNUC_MALLOC; -char **egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file, - const char *key, - const char *locale, +gchar **egg_desktop_file_get_locale_string_list (EggDesktopFile *desktop_file, + const gchar *key, + const gchar *locale, gsize *length, GError **error) G_GNUC_MALLOC; - /* Errors */ #define EGG_DESKTOP_FILE_ERROR egg_desktop_file_error_quark() @@ -150,11 +149,10 @@ typedef enum { } EggDesktopFileError; /* Global application desktop file */ -void egg_set_desktop_file (const char *desktop_file_path); -void egg_set_desktop_file_without_defaults (const char *desktop_file_path); +void egg_set_desktop_file (const gchar *desktop_file_path); +void egg_set_desktop_file_without_defaults (const gchar *desktop_file_path); EggDesktopFile *egg_get_desktop_file (void); - G_END_DECLS #endif /* __EGG_DESKTOP_FILE_H__ */ diff --git a/smclient/eggsmclient-private.h b/smclient/eggsmclient-private.h index ccb10bfc32..47fda7f2eb 100644 --- a/smclient/eggsmclient-private.h +++ b/smclient/eggsmclient-private.h @@ -49,5 +49,4 @@ EggSMClient *egg_sm_client_osx_new (void); G_END_DECLS - #endif /* __EGG_SM_CLIENT_PRIVATE_H__ */ diff --git a/smclient/eggsmclient-xsmp.c b/smclient/eggsmclient-xsmp.c index 8bebfba060..e709f6dd6d 100644 --- a/smclient/eggsmclient-xsmp.c +++ b/smclient/eggsmclient-xsmp.c @@ -65,7 +65,7 @@ typedef enum XSMP_STATE_CONNECTION_CLOSED } EggSMClientXSMPState; -static const char *state_names[] = { +static const gchar *state_names[] = { "idle", "save-yourself", "interact-request", @@ -82,12 +82,12 @@ struct _EggSMClientXSMP EggSMClient parent; SmcConn connection; - char *client_id; + gchar *client_id; EggSMClientXSMPState state; - char **restart_command; + gchar **restart_command; gboolean set_restart_command; - int restart_style; + gint restart_style; guint idle; @@ -113,10 +113,10 @@ struct _EggSMClientXSMPClass }; static void sm_client_xsmp_startup (EggSMClient *client, - const char *client_id); + const gchar *client_id); static void sm_client_xsmp_set_restart_command (EggSMClient *client, - int argc, - const char **argv); + gint argc, + const gchar **argv); static void sm_client_xsmp_will_quit (EggSMClient *client, gboolean will_quit); static gboolean sm_client_xsmp_end_session (EggSMClient *client, @@ -125,9 +125,9 @@ static gboolean sm_client_xsmp_end_session (EggSMClient *client, static void xsmp_save_yourself (SmcConn smc_conn, SmPointer client_data, - int save_style, + gint save_style, Bool shutdown, - int interact_style, + gint interact_style, Bool fast); static void xsmp_die (SmcConn smc_conn, SmPointer client_data); @@ -138,21 +138,21 @@ static void xsmp_shutdown_cancelled (SmcConn smc_conn, static void xsmp_interact (SmcConn smc_conn, SmPointer client_data); -static SmProp *array_prop (const char *name, +static SmProp *array_prop (const gchar *name, ...); -static SmProp *ptrarray_prop (const char *name, +static SmProp *ptrarray_prop (const gchar *name, GPtrArray *values); -static SmProp *string_prop (const char *name, - const char *value); -static SmProp *card8_prop (const char *name, - unsigned char value); +static SmProp *string_prop (const gchar *name, + const gchar *value); +static SmProp *card8_prop (const gchar *name, + guchar value); static void set_properties (EggSMClientXSMP *xsmp, ...); static void delete_properties (EggSMClientXSMP *xsmp, ...); -static GPtrArray *generate_command (char **restart_command, - const char *client_id, - const char *state_file); +static GPtrArray *generate_command (gchar **restart_command, + const gchar *client_id, + const gchar *state_file); static void save_state (EggSMClientXSMP *xsmp); static void do_save_yourself (EggSMClientXSMP *xsmp); @@ -162,10 +162,10 @@ static void ice_init (void); static gboolean process_ice_messages (IceConn ice_conn); static void smc_error_handler (SmcConn smc_conn, Bool swap, - int offending_minor_opcode, + gint offending_minor_opcode, unsigned long offending_sequence, - int error_class, - int severity, + gint error_class, + gint severity, SmPointer values); G_DEFINE_TYPE (EggSMClientXSMP, egg_sm_client_xsmp, EGG_TYPE_SM_CLIENT) @@ -204,7 +204,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) EggSMClientXSMP *xsmp = user_data; EggDesktopFile *desktop_file; GPtrArray *clone, *restart; - char pid_str[64]; + gchar pid_str[64]; if (xsmp->idle) { @@ -221,12 +221,12 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (desktop_file) { GError *err = NULL; - char *cmdline, **argv; - int argc; + gchar *cmdline, **argv; + gint argc; if (xsmp->restart_style == SmRestartIfRunning) { - if (egg_desktop_file_get_boolean (desktop_file, + if (egg_desktop_file_get_boolean (desktop_file, "X-GNOME-AutoRestart", NULL)) xsmp->restart_style = SmRestartImmediately; } @@ -237,7 +237,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (cmdline && g_shell_parse_argv (cmdline, &argc, &argv, &err)) { egg_sm_client_set_restart_command (EGG_SM_CLIENT (xsmp), - argc, (const char **)argv); + argc, (const gchar **)argv); g_strfreev (argv); } else @@ -310,12 +310,12 @@ sm_client_xsmp_disconnect (EggSMClientXSMP *xsmp) static void sm_client_xsmp_startup (EggSMClient *client, - const char *client_id) + const gchar *client_id) { EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; SmcCallbacks callbacks; - char *ret_client_id; - char error_string_ret[256]; + gchar *ret_client_id; + gchar error_string_ret[256]; xsmp->client_id = g_strdup (client_id); @@ -387,15 +387,15 @@ sm_client_xsmp_startup (EggSMClient *client, static void sm_client_xsmp_set_restart_command (EggSMClient *client, - int argc, - const char **argv) + gint argc, + const gchar **argv) { EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; - int i; + gint i; g_strfreev (xsmp->restart_command); - xsmp->restart_command = g_new (char *, argc + 1); + xsmp->restart_command = g_new (gchar *, argc + 1); for (i = 0; i < argc; i++) xsmp->restart_command[i] = g_strdup (argv[i]); xsmp->restart_command[i] = NULL; @@ -447,7 +447,7 @@ sm_client_xsmp_end_session (EggSMClient *client, gboolean request_confirmation) { EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client; - int save_type; + gint save_type; /* To end the session via XSMP, we have to send a * SaveYourselfRequest. We aren't allowed to do that if anything @@ -587,7 +587,7 @@ update_pending_events (EggSMClientXSMP *xsmp) } static void -fix_broken_state (EggSMClientXSMP *xsmp, const char *message, +fix_broken_state (EggSMClientXSMP *xsmp, const gchar *message, gboolean send_interact_done, gboolean send_save_yourself_done) { @@ -611,9 +611,9 @@ fix_broken_state (EggSMClientXSMP *xsmp, const char *message, static void xsmp_save_yourself (SmcConn smc_conn, SmPointer client_data, - int save_type, + gint save_type, Bool shutdown, - int interact_style, + gint interact_style, Bool fast) { EggSMClientXSMP *xsmp = client_data; @@ -666,13 +666,13 @@ xsmp_save_yourself (SmcConn smc_conn, * different combinations of save_type, shutdown and interact_style. * We interpret them as follows: * - * Type Shutdown Interact Interpretation - * G F A/E/N do nothing (1) - * G T N do nothing (1)* - * G T A/E quit_requested (2) - * L/B F A/E/N save_state (3) - * L/B T N save_state (3)* - * L/B T A/E quit_requested, then save_state (4) + * Type Shutdown Interact Interpretation + * G F A/E/N do nothing (1) + * G T N do nothing (1)* + * G T A/E quit_requested (2) + * L/B F A/E/N save_state (3) + * L/B T N save_state (3)* + * L/B T A/E quit_requested, then save_state (4) * * 1. Do nothing, because the SM asked us to do something * uninteresting (save open files, but then don't quit @@ -769,10 +769,10 @@ static void save_state (EggSMClientXSMP *xsmp) { GKeyFile *state_file; - char *state_file_path, *data; + gchar *state_file_path, *data; EggDesktopFile *desktop_file; GPtrArray *restart; - int offset, fd; + gint offset, fd; /* We set xsmp->state before emitting save_state, but our caller is * responsible for setting it back afterward. @@ -795,7 +795,7 @@ save_state (EggSMClientXSMP *xsmp) if (desktop_file) { GKeyFile *merged_file; - char *desktop_file_path; + gchar *desktop_file_path; merged_file = g_key_file_new (); desktop_file_path = @@ -807,7 +807,7 @@ save_state (EggSMClientXSMP *xsmp) G_KEY_FILE_KEEP_TRANSLATIONS, NULL)) { guint g, k, i; - char **groups, **keys, *value, *exec; + gchar **groups, **keys, *value, *exec; groups = g_key_file_get_groups (state_file, NULL); for (g = 0; groups[g]; g++) @@ -837,8 +837,8 @@ save_state (EggSMClientXSMP *xsmp) for (i = 0; i < restart->len; i++) restart->pdata[i] = g_shell_quote (restart->pdata[i]); g_ptr_array_add (restart, NULL); - exec = g_strjoinv (" ", (char **)restart->pdata); - g_strfreev ((char **)restart->pdata); + exec = g_strjoinv (" ", (gchar **)restart->pdata); + g_strfreev ((gchar **)restart->pdata); g_ptr_array_free (restart, FALSE); g_key_file_set_string (state_file, EGG_DESKTOP_FILE_GROUP, @@ -881,7 +881,7 @@ save_state (EggSMClientXSMP *xsmp) } else if (errno == ENOTDIR || errno == ENOENT) { - char *sep = strrchr (state_file_path, G_DIR_SEPARATOR); + gchar *sep = strrchr (state_file_path, G_DIR_SEPARATOR); *sep = '\0'; if (g_mkdir_with_parents (state_file_path, 0755) != 0) @@ -1041,25 +1041,25 @@ xsmp_shutdown_cancelled (SmcConn smc_conn, * then free the array, but not its contents. */ static GPtrArray * -generate_command (char **restart_command, const char *client_id, - const char *state_file) +generate_command (gchar **restart_command, const gchar *client_id, + const gchar *state_file) { GPtrArray *cmd; - int i; + gint i; cmd = g_ptr_array_new (); g_ptr_array_add (cmd, restart_command[0]); if (client_id) { - g_ptr_array_add (cmd, (char *)"--sm-client-id"); - g_ptr_array_add (cmd, (char *)client_id); + g_ptr_array_add (cmd, (gchar *)"--sm-client-id"); + g_ptr_array_add (cmd, (gchar *)client_id); } if (state_file) { - g_ptr_array_add (cmd, (char *)"--sm-client-state-file"); - g_ptr_array_add (cmd, (char *)state_file); + g_ptr_array_add (cmd, (gchar *)"--sm-client-state-file"); + g_ptr_array_add (cmd, (gchar *)state_file); } for (i = 1; restart_command[i]; i++) @@ -1107,7 +1107,7 @@ static void delete_properties (EggSMClientXSMP *xsmp, ...) { GPtrArray *props; - char *prop; + gchar *prop; va_list ap; if (!xsmp->connection) @@ -1116,12 +1116,12 @@ delete_properties (EggSMClientXSMP *xsmp, ...) props = g_ptr_array_new (); va_start (ap, xsmp); - while ((prop = va_arg (ap, char *))) + while ((prop = va_arg (ap, gchar *))) g_ptr_array_add (props, prop); va_end (ap); SmcDeleteProperties (xsmp->connection, props->len, - (char **)props->pdata); + (gchar **)props->pdata); g_ptr_array_free (props, TRUE); } @@ -1131,22 +1131,22 @@ delete_properties (EggSMClientXSMP *xsmp, ...) * until you're done with the SmProp. */ static SmProp * -array_prop (const char *name, ...) +array_prop (const gchar *name, ...) { SmProp *prop; SmPropValue pv; GArray *vals; - char *value; + gchar *value; va_list ap; prop = g_new (SmProp, 1); - prop->name = (char *)name; - prop->type = (char *)SmLISTofARRAY8; + prop->name = (gchar *)name; + prop->type = (gchar *)SmLISTofARRAY8; vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue)); va_start (ap, name); - while ((value = va_arg (ap, char *))) + while ((value = va_arg (ap, gchar *))) { pv.length = strlen (value); pv.value = value; @@ -1166,7 +1166,7 @@ array_prop (const char *name, ...) * remain valid until you're done with the SmProp. */ static SmProp * -ptrarray_prop (const char *name, GPtrArray *values) +ptrarray_prop (const gchar *name, GPtrArray *values) { SmProp *prop; SmPropValue pv; @@ -1174,8 +1174,8 @@ ptrarray_prop (const char *name, GPtrArray *values) guint i; prop = g_new (SmProp, 1); - prop->name = (char *)name; - prop->type = (char *)SmLISTofARRAY8; + prop->name = (gchar *)name; + prop->type = (gchar *)SmLISTofARRAY8; vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue)); @@ -1199,29 +1199,29 @@ ptrarray_prop (const char *name, GPtrArray *values) * done with the SmProp. */ static SmProp * -string_prop (const char *name, const char *value) +string_prop (const gchar *name, const gchar *value) { SmProp *prop; prop = g_new (SmProp, 1); - prop->name = (char *)name; - prop->type = (char *)SmARRAY8; + prop->name = (gchar *)name; + prop->type = (gchar *)SmARRAY8; prop->num_vals = 1; prop->vals = g_new (SmPropValue, 1); prop->vals[0].length = strlen (value); - prop->vals[0].value = (char *)value; + prop->vals[0].value = (gchar *)value; return prop; } -/* Takes a char and creates a CARD8 property. */ +/* Takes a gchar and creates a CARD8 property. */ static SmProp * -card8_prop (const char *name, unsigned char value) +card8_prop (const gchar *name, guchar value) { SmProp *prop; - char *card8val; + gchar *card8val; /* To avoid having to allocate and free prop->vals[0], we cheat and * make vals a 2-element-long array and then use the second element @@ -1229,12 +1229,12 @@ card8_prop (const char *name, unsigned char value) */ prop = g_new (SmProp, 1); - prop->name = (char *)name; - prop->type = (char *)SmCARD8; + prop->name = (gchar *)name; + prop->type = (gchar *)SmCARD8; prop->num_vals = 1; prop->vals = g_new (SmPropValue, 2); - card8val = (char *)(&prop->vals[1]); + card8val = (gchar *)(&prop->vals[1]); card8val[0] = value; prop->vals[0].length = 1; @@ -1258,10 +1258,10 @@ card8_prop (const char *name, unsigned char value) static void ice_error_handler (IceConn ice_conn, Bool swap, - int offending_minor_opcode, + gint offending_minor_opcode, unsigned long offending_sequence, - int error_class, - int severity, + gint error_class, + gint severity, IcePointer values); static void ice_io_error_handler (IceConn ice_conn); static void ice_connection_watch (IceConn ice_conn, @@ -1322,7 +1322,7 @@ ice_connection_watch (IceConn ice_conn, if (opening) { GIOChannel *channel; - int fd = IceConnectionNumber (ice_conn); + gint fd = IceConnectionNumber (ice_conn); fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC); channel = g_io_channel_unix_new (fd); @@ -1342,28 +1342,28 @@ ice_connection_watch (IceConn ice_conn, static void ice_error_handler (IceConn ice_conn, Bool swap, - int offending_minor_opcode, + gint offending_minor_opcode, unsigned long offending_sequence, - int error_class, - int severity, + gint error_class, + gint severity, IcePointer values) { /* Do nothing */ -} +} static void ice_io_error_handler (IceConn ice_conn) { /* Do nothing */ -} +} static void smc_error_handler (SmcConn smc_conn, Bool swap, - int offending_minor_opcode, + gint offending_minor_opcode, unsigned long offending_sequence, - int error_class, - int severity, + gint error_class, + gint severity, SmPointer values) { /* Do nothing */ diff --git a/smclient/eggsmclient.c b/smclient/eggsmclient.c index efa901d532..e17d98c3a9 100644 --- a/smclient/eggsmclient.c +++ b/smclient/eggsmclient.c @@ -25,9 +25,9 @@ #include "eggsmclient.h" #include "eggsmclient-private.h" -static void egg_sm_client_debug_handler (const char *log_domain, +static void egg_sm_client_debug_handler (const gchar *log_domain, GLogLevelFlags log_level, - const char *message, + const gchar *message, gpointer user_data); enum { @@ -116,7 +116,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) * handling this signal; if the user has requested that the session * be saved when logging out, then ::save_state will be emitted * separately. - * + * * If the application agrees to quit, it should then wait for either * the ::quit_cancelled or ::quit signals to be emitted. **/ @@ -176,9 +176,9 @@ 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 char *sm_config_prefix = NULL; +static gchar *sm_client_state_file = NULL; +static gchar *sm_client_id = NULL; +static gchar *sm_config_prefix = NULL; static gboolean sm_client_post_parse_func (GOptionContext *context, @@ -391,7 +391,7 @@ GKeyFile * egg_sm_client_get_state_file (EggSMClient *client) { EggSMClientPrivate *priv = EGG_SM_CLIENT_GET_PRIVATE (client); - char *state_file_path; + gchar *state_file_path; GError *err = NULL; g_return_val_if_fail (client == global_client, NULL); @@ -435,8 +435,8 @@ egg_sm_client_get_state_file (EggSMClient *client) **/ void egg_sm_client_set_restart_command (EggSMClient *client, - int argc, - const char **argv) + gint argc, + const gchar **argv) { g_return_if_fail (EGG_IS_SM_CLIENT (client)); @@ -511,7 +511,7 @@ GKeyFile * egg_sm_client_save_state (EggSMClient *client) { GKeyFile *state_file; - char *group; + gchar *group; g_return_val_if_fail (client == global_client, NULL); @@ -574,12 +574,12 @@ egg_sm_client_quit (EggSMClient *client) } static void -egg_sm_client_debug_handler (const char *log_domain, +egg_sm_client_debug_handler (const gchar *log_domain, GLogLevelFlags log_level, - const char *message, + const gchar *message, gpointer user_data) { - static int debug = -1; + static gint debug = -1; if (debug < 0) debug = (g_getenv ("EGG_SM_CLIENT_DEBUG") != NULL); diff --git a/smclient/eggsmclient.h b/smclient/eggsmclient.h index e620b754a3..5efc486df0 100644 --- a/smclient/eggsmclient.h +++ b/smclient/eggsmclient.h @@ -68,10 +68,10 @@ struct _EggSMClientClass /* virtual methods */ void (*startup) (EggSMClient *client, - const char *client_id); + const gchar *client_id); void (*set_restart_command) (EggSMClient *client, - int argc, - const char **argv); + gint argc, + const gchar **argv); void (*will_quit) (EggSMClient *client, gboolean will_quit); gboolean (*end_session) (EggSMClient *client, @@ -100,8 +100,8 @@ GKeyFile *egg_sm_client_get_state_file (EggSMClient *client); /* Alternate means of saving state */ void egg_sm_client_set_restart_command (EggSMClient *client, - int argc, - const char **argv); + gint argc, + const gchar **argv); /* Handling "quit_requested" signal */ void egg_sm_client_will_quit (EggSMClient *client, @@ -113,5 +113,4 @@ gboolean egg_sm_client_end_session (EggSMClientEndStyle style, G_END_DECLS - #endif /* __EGG_SM_CLIENT_H__ */ |