gnome-session r5349 - in trunk: . gnome-session
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r5349 - in trunk: . gnome-session
- Date: Tue, 24 Mar 2009 22:19:25 +0000 (UTC)
Author: vuntz
Date: Tue Mar 24 22:19:25 2009
New Revision: 5349
URL: http://svn.gnome.org/viewvc/gnome-session?rev=5349&view=rev
Log:
2009-03-24 Vincent Untz <vuntz gnome org>
* gnome-session/gsm-inhibit-dialog.c: (add_inhibitor): use
gsm_util_get_desktop_dirs() instead of just gsm_util_get_app_dirs().
Also try to handle desktop filenames that are an absolute path the best
way possible (this happens with OpenOffice.org).
* gnome-session/gsm-util.[ch]: (gsm_util_get_desktop_dirs): new
function, to return all the directories where we look up for the
desktop files.
Modified:
trunk/ChangeLog
trunk/gnome-session/gsm-inhibit-dialog.c
trunk/gnome-session/gsm-util.c
trunk/gnome-session/gsm-util.h
Modified: trunk/gnome-session/gsm-inhibit-dialog.c
==============================================================================
--- trunk/gnome-session/gsm-inhibit-dialog.c (original)
+++ trunk/gnome-session/gsm-inhibit-dialog.c Tue Mar 24 22:19:25 2009
@@ -521,13 +521,36 @@
}
if (desktop_filename != NULL) {
- /* FIXME: maybe also append the autostart dirs ? */
- search_dirs = gsm_util_get_app_dirs ();
+ search_dirs = gsm_util_get_desktop_dirs ();
- error = NULL;
- desktop_file = egg_desktop_file_new_from_dirs (desktop_filename,
- (const char **)search_dirs,
- &error);
+ if (g_path_is_absolute (desktop_filename)) {
+ char *basename;
+
+ error = NULL;
+ desktop_file = egg_desktop_file_new (desktop_filename,
+ &error);
+ if (desktop_file == NULL) {
+ if (error) {
+ g_warning ("Unable to load desktop file '%s': %s",
+ desktop_filename, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Unable to load desktop file '%s'",
+ desktop_filename);
+ }
+
+ basename = g_path_get_basename (desktop_filename);
+ g_free (desktop_filename);
+ desktop_filename = basename;
+ }
+ }
+
+ if (desktop_file == NULL) {
+ error = NULL;
+ desktop_file = egg_desktop_file_new_from_dirs (desktop_filename,
+ (const char **)search_dirs,
+ &error);
+ }
/* look for a file with a vendor prefix */
if (desktop_file == NULL) {
Modified: trunk/gnome-session/gsm-util.c
==============================================================================
--- trunk/gnome-session/gsm-util.c (original)
+++ trunk/gnome-session/gsm-util.c Tue Mar 24 22:19:25 2009
@@ -232,6 +232,43 @@
return (char **) g_ptr_array_free (dirs, FALSE);
}
+char **
+gsm_util_get_desktop_dirs ()
+{
+ char **apps;
+ char **autostart;
+ char **result;
+ int size;
+ int i;
+
+ apps = gsm_util_get_app_dirs ();
+ autostart = gsm_util_get_autostart_dirs ();
+
+ size = 0;
+ for (i = 0; apps[i] != NULL; i++) { size++; }
+ for (i = 0; autostart[i] != NULL; i++) { size++; }
+ size += 2; /* saved session + last NULL */
+
+ result = g_new (char *, size + 1);
+
+ for (i = 0; apps[i] != NULL; i++) {
+ result[i] = apps[i];
+ }
+ g_free (apps);
+ size = i;
+
+ for (i = 0; autostart[i] != NULL; i++) {
+ result[size + i] = autostart[i];
+ }
+ g_free (autostart);
+ size = size + i;
+
+ result[size] = g_strdup (gsm_util_get_saved_session_dir ());
+ result[size + 1] = NULL;
+
+ return result;
+}
+
gboolean
gsm_util_text_is_blank (const char *str)
{
Modified: trunk/gnome-session/gsm-util.h
==============================================================================
--- trunk/gnome-session/gsm-util.h (original)
+++ trunk/gnome-session/gsm-util.h Tue Mar 24 22:19:25 2009
@@ -33,6 +33,8 @@
gchar** gsm_util_get_autostart_dirs (void);
+gchar ** gsm_util_get_desktop_dirs (void);
+
gboolean gsm_util_text_is_blank (const char *str);
void gsm_util_init_error (gboolean fatal,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]