forked from AuroraMiddleware/gtk
Use g_get_user_special_dir() to obtain the path for the DESKTOP directory.
2007-06-06 Matthias Clasen <mclasen@redhat.com> * gtk/gtkfilechooserbutton.c (model_add_special): * gtk/gtkfilechooserdefault.c (shortcuts_append_desktop): * gtk/gtkfilesystemunix.c (get_icon_name_for_directory): * gtk/gtkpathbar.c (_gtk_path_bar_set_file_system): Use g_get_user_special_dir() to obtain the path for the DESKTOP directory. svn path=/trunk/; revision=18070
This commit is contained in:
parent
ba95b0598b
commit
232f30f1ba
@ -1,3 +1,12 @@
|
||||
2007-06-06 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkfilechooserbutton.c (model_add_special):
|
||||
* gtk/gtkfilechooserdefault.c (shortcuts_append_desktop):
|
||||
* gtk/gtkfilesystemunix.c (get_icon_name_for_directory):
|
||||
* gtk/gtkpathbar.c (_gtk_path_bar_set_file_system):
|
||||
Use g_get_user_special_dir() to obtain the path for the
|
||||
DESKTOP directory.
|
||||
|
||||
2007-06-06 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/Makefile.am: Add the 16x16 version of gtk-select-color.png
|
||||
|
@ -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++;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user