[Xfce4-commits] r29767 - in thunar/branches/migration-to-gio: . thunar
Jannis Pohlmann
jannis at xfce.org
Sat Apr 11 21:45:00 CEST 2009
Author: jannis
Date: 2009-04-11 19:45:00 +0000 (Sat, 11 Apr 2009)
New Revision: 29767
Modified:
thunar/branches/migration-to-gio/ChangeLog
thunar/branches/migration-to-gio/thunar/thunar-file.c
thunar/branches/migration-to-gio/thunar/thunar-window.c
Log:
* thunar/thunar-file.c: Fix segfault in thunar_file_get().
* thunar/thunar-window.c: Re-implement
thunar_window_open_user_folder() based on GFile.
Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog 2009-04-11 19:10:11 UTC (rev 29766)
+++ thunar/branches/migration-to-gio/ChangeLog 2009-04-11 19:45:00 UTC (rev 29767)
@@ -1,5 +1,11 @@
2009-04-11 Jannis Pohlmann <jannis at xfce.org>
+ * thunar/thunar-file.c: Fix segfault in thunar_file_get().
+ * thunar/thunar-window.c: Re-implement
+ thunar_window_open_user_folder() based on GFile.
+
+2009-04-11 Jannis Pohlmann <jannis at xfce.org>
+
* thunar/thunar-file.{c,h}: Add new function thunar_file_get(GFile*).
Internally this still uses thunar_file_load() and can thus block the
UI. For the sake of a smoother transition, asynchronous loading will
Modified: thunar/branches/migration-to-gio/thunar/thunar-file.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-04-11 19:10:11 UTC (rev 29766)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.c 2009-04-11 19:45:00 UTC (rev 29767)
@@ -595,7 +595,7 @@
}
else
{
- uri = g_file_get_uri (file->gfile);
+ uri = g_file_get_uri (gfile);
path = thunar_vfs_path_new (uri, error);
g_free (uri);
Modified: thunar/branches/migration-to-gio/thunar/thunar-window.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-window.c 2009-04-11 19:10:11 UTC (rev 29766)
+++ thunar/branches/migration-to-gio/thunar/thunar-window.c 2009-04-11 19:45:00 UTC (rev 29767)
@@ -1899,29 +1899,33 @@
const gchar *default_name)
{
ThunarFile *user_file = NULL;
- GError *error = NULL;
- gchar *user_dir = NULL;
- gboolean result = FALSE;
+ gboolean result = FALSE;
+ GError *error = NULL;
+ GFile *home_dir;
+ GFile *user_dir;
+ gchar *path = NULL;
-#if GLIB_CHECK_VERSION(2, 14, 0)
- user_dir = g_strdup (g_get_user_special_dir (thunar_user_dir));
-#endif
+ path = g_strdup (g_get_user_special_dir (thunar_user_dir));
- if (G_UNLIKELY (user_dir == NULL))
+ if (G_UNLIKELY (path == NULL))
{
- user_dir = g_build_filename (G_DIR_SEPARATOR_S, xfce_get_homedir (),
- default_name, NULL);
+ home_dir = g_file_new_for_home ();
+ user_dir = g_file_resolve_relative_path (home_dir, default_name);
+ path = g_file_get_path (user_dir);
+ g_object_unref (home_dir);
}
+ else
+ user_dir = g_file_new_for_path (path);
- user_file = thunar_file_get_for_uri (user_dir, &error);
- if (G_UNLIKELY (user_file == NULL && error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_EXIST))
+ user_file = thunar_file_get (user_dir, &error);
+ if (G_UNLIKELY (user_file == NULL && error->domain == G_FILE_ERROR && error->code == G_FILE_ERROR_NOENT))
{
g_error_free (error);
error = NULL;
/* try to create the folder */
- if (G_LIKELY (xfce_mkdirhier (user_dir, 0755, &error)))
- user_file = thunar_file_get_for_uri (user_dir, &error);
+ if (G_LIKELY (xfce_mkdirhier (path, 0755, &error)))
+ user_file = thunar_file_get (user_dir, &error);
}
if (G_LIKELY (user_file != NULL))
@@ -1941,7 +1945,8 @@
g_error_free (error);
}
- g_free (user_dir);
+ g_object_unref (user_dir);
+ g_free (path);
return result;
}
More information about the Xfce4-commits
mailing list