gnome-session r4771 - in branches/dbus_based: . egg gnome-session



Author: mccann
Date: Tue Jun 24 23:52:09 2008
New Revision: 4771
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4771&view=rev

Log:
2008-06-24  William Jon McCann  <jmccann redhat com>

	* egg/eggdesktopfile.c (egg_desktop_file_new_from_dirs):
	* egg/eggdesktopfile.h:
	* gnome-session/gsm-logout-inhibit-dialog.c (find_inhibitor),
	(add_inhibitor):
	* gnome-session/test-inhibit.c (do_inhibit):
	Search the correct dirs when looking up app ids.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/egg/eggdesktopfile.c
   branches/dbus_based/egg/eggdesktopfile.h
   branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
   branches/dbus_based/gnome-session/test-inhibit.c

Modified: branches/dbus_based/egg/eggdesktopfile.c
==============================================================================
--- branches/dbus_based/egg/eggdesktopfile.c	(original)
+++ branches/dbus_based/egg/eggdesktopfile.c	Tue Jun 24 23:52:09 2008
@@ -104,6 +104,42 @@
 }
 
 /**
+ * egg_desktop_file_new_from_dirs:
+ * @desktop_file_path: relative path to a Freedesktop-style Desktop file
+ * @search_dirs: NULL-terminated array of directories to search
+ * @error: error pointer
+ *
+ * Looks for @desktop_file_path in the paths returned from
+ * g_get_user_data_dir() and g_get_system_data_dirs(), and creates
+ * a new #EggDesktopFile from it.
+ *
+ * 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,
+				GError     **error)
+{
+  EggDesktopFile *desktop_file;
+  GKeyFile *key_file;
+  char *full_path;
+
+  key_file = g_key_file_new ();
+  if (!g_key_file_load_from_dirs (key_file, desktop_file_path, search_dirs,
+				       &full_path, 0, error))
+    {
+      g_key_file_free (key_file);
+      return NULL;
+    }
+
+  desktop_file = egg_desktop_file_new_from_key_file (key_file,
+						     full_path,
+						     error);
+  g_free (full_path);
+  return desktop_file;
+}
+
+/**
  * egg_desktop_file_new_from_key_file:
  * @key_file: a #GKeyFile representing a desktop file
  * @source: the path or URI that @key_file was loaded from, or %NULL

Modified: branches/dbus_based/egg/eggdesktopfile.h
==============================================================================
--- branches/dbus_based/egg/eggdesktopfile.h	(original)
+++ branches/dbus_based/egg/eggdesktopfile.h	Tue Jun 24 23:52:09 2008
@@ -39,6 +39,9 @@
 
 EggDesktopFile     *egg_desktop_file_new_from_data_dirs (const char   *desktop_file_path,
 							 GError      **error);
+EggDesktopFile     *egg_desktop_file_new_from_dirs      (const char   *desktop_file_path,
+							 const char  **search_dirs,
+							 GError      **error);
 EggDesktopFile     *egg_desktop_file_new_from_key_file  (GKeyFile     *key_file,
 							 const char   *source,
 							 GError      **error);

Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c	(original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c	Tue Jun 24 23:52:09 2008
@@ -103,7 +103,6 @@
                                     iter,
                                     INHIBIT_COOKIE_COLUMN, &item_cookie,
                                     -1);
-                g_debug ("Comparing cookie %u %u", item_cookie, cookie);
                 if (cookie == item_cookie) {
                         found_item = TRUE;
                 }
@@ -228,6 +227,7 @@
         GdkPixbuf      *pixbuf;
         EggDesktopFile *desktop_file;
         GError         *error;
+        char          **search_dirs;
 
         /* FIXME: get info from xid */
 
@@ -240,8 +240,15 @@
                 desktop_filename = g_strdup (app_id);
         }
 
+        /* FIXME: maybe also append the autostart dirs ? */
+        search_dirs = gsm_util_get_app_dirs ();
+
         error = NULL;
-        desktop_file = egg_desktop_file_new_from_data_dirs (desktop_filename, &error);
+        desktop_file = egg_desktop_file_new_from_dirs (desktop_filename,
+                                                       search_dirs,
+                                                       &error);
+        g_strfreev (search_dirs);
+
         if (desktop_file == NULL) {
                 g_warning ("Unable to find desktop file '%s': %s", desktop_filename, error->message);
                 g_error_free (error);

Modified: branches/dbus_based/gnome-session/test-inhibit.c
==============================================================================
--- branches/dbus_based/gnome-session/test-inhibit.c	(original)
+++ branches/dbus_based/gnome-session/test-inhibit.c	Tue Jun 24 23:52:09 2008
@@ -73,8 +73,13 @@
         guint       flags;
 
         startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+#if 1
         app_id = "nautilus-cd-burner";
         reason = "A CD burn is in progress.";
+#else
+        app_id = "nautilus";
+        reason = "A file transfer is in progress.";
+#endif
         toplevel_xid = 0;
         flags = 0;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]