summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/gtkfilechooserbutton.c20
-rw-r--r--gtk/gtkfilechooserdefault.c16
-rw-r--r--gtk/gtkfilesystemunix.c7
-rw-r--r--gtk/gtkpathbar.c10
4 files changed, 18 insertions, 35 deletions
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index dfeba8d83c..7b08b933e8 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -1622,6 +1622,7 @@ model_add_special_get_info_cb (GtkFileSystemHandle *handle,
GdkPixbuf *pixbuf;
GtkFileSystemHandle *model_handle;
struct ChangeIconThemeData *data = user_data;
+ const gchar *name;
if (!data->button->priv->model)
/* button got destroyed */
@@ -1659,9 +1660,13 @@ model_add_special_get_info_cb (GtkFileSystemHandle *handle,
g_object_unref (pixbuf);
}
- gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
- DISPLAY_NAME_COLUMN, gtk_file_info_get_display_name (info),
- -1);
+ gtk_tree_model_get (data->button->priv->model, &iter,
+ DISPLAY_NAME_COLUMN, &name,
+ -1);
+ if (!name)
+ gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
+ DISPLAY_NAME_COLUMN, gtk_file_info_get_display_name (info),
+ -1);
out:
g_object_unref (data->button);
@@ -1717,15 +1722,9 @@ model_add_special (GtkFileChooserButton *button)
-1);
button->priv->n_special++;
-
-#ifndef G_OS_WIN32
- desktopdir = g_build_filename (homedir, DESKTOP_DISPLAY_NAME, NULL);
-#endif
}
-#ifdef G_OS_WIN32
- desktopdir = _gtk_file_system_win32_get_desktop ();
-#endif
+ desktopdir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
if (desktopdir)
{
@@ -1734,7 +1733,6 @@ model_add_special (GtkFileChooserButton *button)
struct ChangeIconThemeData *info;
path = gtk_file_system_filename_to_path (button->priv->fs, desktopdir);
- g_free (desktopdir);
gtk_list_store_insert (store, &iter, pos);
pos++;
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index dd0cb692d3..e3791f9def 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -1961,22 +1961,8 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
profile_start ("start", NULL);
-#ifdef G_OS_WIN32
- name = _gtk_file_system_win32_get_desktop ();
-#else
- home = g_get_home_dir ();
- if (home == NULL)
- {
- profile_end ("end - no home directory!?", NULL);
- return;
- }
-
- name = g_build_filename (home, "Desktop", NULL);
-#endif
-
+ name = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
path = gtk_file_system_filename_to_path (impl->file_system, name);
- g_free (name);
-
shortcuts_insert_path (impl, -1, SHORTCUT_TYPE_PATH, NULL, path, _("Desktop"), FALSE, SHORTCUTS_DESKTOP);
impl->has_desktop = TRUE;
diff --git a/gtk/gtkfilesystemunix.c b/gtk/gtkfilesystemunix.c
index 38a6cd064b..b426afe764 100644
--- a/gtk/gtkfilesystemunix.c
+++ b/gtk/gtkfilesystemunix.c
@@ -1601,17 +1601,12 @@ gtk_file_system_unix_filename_to_path (GtkFileSystem *file_system,
static const char *
get_icon_name_for_directory (const char *path)
{
- static char *desktop_path = NULL;
-
if (!g_get_home_dir ())
return "gnome-fs-directory";
- if (!desktop_path)
- desktop_path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
-
if (strcmp (g_get_home_dir (), path) == 0)
return "gnome-fs-home";
- else if (strcmp (desktop_path, path) == 0)
+ else if (strcmp (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP), path) == 0)
return "gnome-fs-desktop";
else
return "gnome-fs-directory";
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index e63eeac9b9..55c36522b5 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -1675,13 +1675,17 @@ _gtk_path_bar_set_file_system (GtkPathBar *path_bar,
home = g_get_home_dir ();
if (home != NULL)
{
+ gchar *freeme = NULL;
+
path_bar->home_path = gtk_file_system_filename_to_path (path_bar->file_system, home);
/* FIXME: Need file system backend specific way of getting the
* Desktop path.
*/
- desktop = g_build_filename (home, "Desktop", NULL);
- path_bar->desktop_path = gtk_file_system_filename_to_path (path_bar->file_system, desktop);
- g_free (desktop);
+ desktop = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+ if (desktop != NULL)
+ path_bar->desktop_path = gtk_file_system_filename_to_path (path_bar->file_system, desktop);
+ else
+ path_bar->desktop_path = NULL;
}
else
{