diff --git a/ChangeLog b/ChangeLog index b871701bc3..74a305ac96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-02-20 Alexander Larsson + + * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop): + Desktop directory is not translated. + (set_tree_model): + There might not be volumes for all paths. + * gtk/gtkfilechooserwidget.c: + (gtk_file_chooser_widget_constructor): + Use gtk_file_chooser_set_current_folder to set cwd. + Thu Feb 19 19:58:53 2004 Jonathan Blandford * gtk/gtkpathbar.[ch]: New widget to handle the path in the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b871701bc3..74a305ac96 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2004-02-20 Alexander Larsson + + * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop): + Desktop directory is not translated. + (set_tree_model): + There might not be volumes for all paths. + * gtk/gtkfilechooserwidget.c: + (gtk_file_chooser_widget_constructor): + Use gtk_file_chooser_set_current_folder to set cwd. + Thu Feb 19 19:58:53 2004 Jonathan Blandford * gtk/gtkpathbar.[ch]: New widget to handle the path in the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b871701bc3..74a305ac96 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +2004-02-20 Alexander Larsson + + * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop): + Desktop directory is not translated. + (set_tree_model): + There might not be volumes for all paths. + * gtk/gtkfilechooserwidget.c: + (gtk_file_chooser_widget_constructor): + Use gtk_file_chooser_set_current_folder to set cwd. + Thu Feb 19 19:58:53 2004 Jonathan Blandford * gtk/gtkpathbar.[ch]: New widget to handle the path in the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b871701bc3..74a305ac96 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +2004-02-20 Alexander Larsson + + * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop): + Desktop directory is not translated. + (set_tree_model): + There might not be volumes for all paths. + * gtk/gtkfilechooserwidget.c: + (gtk_file_chooser_widget_constructor): + Use gtk_file_chooser_set_current_folder to set cwd. + Thu Feb 19 19:58:53 2004 Jonathan Blandford * gtk/gtkpathbar.[ch]: New widget to handle the path in the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b871701bc3..74a305ac96 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2004-02-20 Alexander Larsson + + * gtk/gtkfilechooserdefault.c: (shortcuts_append_desktop): + Desktop directory is not translated. + (set_tree_model): + There might not be volumes for all paths. + * gtk/gtkfilechooserwidget.c: + (gtk_file_chooser_widget_constructor): + Use gtk_file_chooser_set_current_folder to set cwd. + Thu Feb 19 19:58:53 2004 Jonathan Blandford * gtk/gtkpathbar.[ch]: New widget to handle the path in the diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 50ac4eb978..cee3e6b0fc 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -649,9 +649,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl) char *name; GtkFilePath *path; - /* FIXME: What is the Right Way of finding the desktop directory? */ - - name = g_build_filename (g_get_home_dir (), _("Desktop"), NULL); + name = g_build_filename (g_get_home_dir (), "Desktop", NULL); path = gtk_file_system_filename_to_path (impl->file_system, name); g_free (name); @@ -2127,18 +2125,36 @@ static void set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path) { GtkFileSystemVolume *volume; - GtkFilePath *volume_path; + GtkFilePath *base_path, *parent_path; + base_path = NULL; + volume = gtk_file_system_get_volume_for_path (impl->file_system, path); - volume_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); + + if (volume) + base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); + + if (base_path == NULL) + { + base_path = gtk_file_path_copy (path); + while (gtk_file_system_get_parent (impl->file_system, + base_path, + &parent_path, + NULL) && + parent_path != NULL) + { + gtk_file_path_free (base_path); + base_path = parent_path; + } + } - if (impl->current_volume_path && gtk_file_path_compare (volume_path, impl->current_volume_path) == 0) + if (impl->current_volume_path && gtk_file_path_compare (base_path, impl->current_volume_path) == 0) goto out; if (impl->tree_model) g_object_unref (impl->tree_model); - impl->current_volume_path = gtk_file_path_copy (volume_path); + impl->current_volume_path = gtk_file_path_copy (base_path); impl->tree_model = _gtk_file_system_model_new (impl->file_system, impl->current_volume_path, -1, GTK_FILE_INFO_DISPLAY_NAME); @@ -2150,8 +2166,9 @@ set_tree_model (GtkFileChooserDefault *impl, const GtkFilePath *path) out: - gtk_file_path_free (volume_path); - gtk_file_system_volume_free (impl->file_system, volume); + gtk_file_path_free (base_path); + if (volume) + gtk_file_system_volume_free (impl->file_system, volume); } static void diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index 2e9d3bef4d..41bf628674 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -144,12 +144,7 @@ gtk_file_chooser_widget_constructor (GType type, gtk_widget_show (priv->impl); current_folder = g_get_current_dir (); - current_folder_uri = g_filename_to_uri (current_folder, NULL, NULL); - if (current_folder_uri) - { - gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (priv->impl), current_folder_uri); - g_free (current_folder_uri); - } + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (priv->impl), current_folder); g_free (current_folder); _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),