Patch "1a" from #136185, by Morten Welinder.

2004-03-08  Federico Mena Quintero  <federico@ximian.com>

	Patch "1a" from #136185, by Morten Welinder.

	* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
	that says whether the caller just wants the display name.
	(shortcuts_insert_path): We only want the name in the call to
	get_file_info().

	* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
	info than needed from the file_folder.
This commit is contained in:
Federico Mena Quintero 2004-03-08 22:53:35 +00:00 committed by Federico Mena Quintero
parent 2247fc6659
commit 8383c8f7fe
7 changed files with 94 additions and 45 deletions

View File

@ -1,3 +1,15 @@
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Patch "1a" from #136185, by Morten Welinder.
* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
that says whether the caller just wants the display name.
(shortcuts_insert_path): We only want the name in the call to
get_file_info().
* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
info than needed from the file_folder.
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.

View File

@ -1,3 +1,15 @@
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Patch "1a" from #136185, by Morten Welinder.
* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
that says whether the caller just wants the display name.
(shortcuts_insert_path): We only want the name in the call to
get_file_info().
* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
info than needed from the file_folder.
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.

View File

@ -1,3 +1,15 @@
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Patch "1a" from #136185, by Morten Welinder.
* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
that says whether the caller just wants the display name.
(shortcuts_insert_path): We only want the name in the call to
get_file_info().
* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
info than needed from the file_folder.
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.

View File

@ -1,3 +1,15 @@
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Patch "1a" from #136185, by Morten Welinder.
* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
that says whether the caller just wants the display name.
(shortcuts_insert_path): We only want the name in the call to
get_file_info().
* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
info than needed from the file_folder.
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.

View File

@ -1,3 +1,15 @@
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Patch "1a" from #136185, by Morten Welinder.
* gtk/gtkfilechooserdefault.c (get_file_info): Take in an argument
that says whether the caller just wants the display name.
(shortcuts_insert_path): We only want the name in the call to
get_file_info().
* gtk/gtkpathbar.c (_gtk_path_bar_set_path): Don't request more
info than needed from the file_folder.
2004-03-08 Federico Mena Quintero <federico@ximian.com>
Fixes #136105.

View File

@ -751,7 +751,7 @@ shortcuts_unselect_all (GtkFileChooserDefault *impl)
/* Convenience function to get the display name and icon info for a path */
static GtkFileInfo *
get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, GError **error)
get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, gboolean name_only, GError **error)
{
GtkFilePath *parent_path;
GtkFileFolder *parent_folder;
@ -765,7 +765,7 @@ get_file_info (GtkFileSystem *file_system, const GtkFilePath *path, GError **err
#if 0
| GTK_FILE_INFO_ICON
#endif
| GTK_FILE_INFO_IS_FOLDER,
| (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER),
error);
gtk_file_path_free (parent_path);
@ -808,24 +808,21 @@ shortcuts_insert_path (GtkFileChooserDefault *impl,
}
else
{
GtkFileInfo *info;
info = get_file_info (impl->file_system, path, error);
if (!info)
return FALSE;
data = gtk_file_path_copy (path);
if (label)
label_copy = g_strdup (label);
else
{
GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
if (!info)
return FALSE;
label_copy = g_strdup (gtk_file_info_get_display_name (info));
pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), ICON_SIZE, NULL);
gtk_file_info_free (info);
}
data = gtk_file_path_copy (path);
pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl), ICON_SIZE, NULL);
}
if (pos == -1)
gtk_list_store_append (impl->shortcuts_model, &iter);
else
@ -1426,7 +1423,7 @@ shortcuts_add_bookmark_from_path (GtkFileChooserDefault *impl,
return;
error = NULL;
info = get_file_info (impl->file_system, path, &error);
info = get_file_info (impl->file_system, path, FALSE, &error);
if (!info)
error_getting_info_dialog (impl, path, error);
@ -2879,14 +2876,16 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
GError **error)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
GError *err;
GtkFileInfo *info;
err = NULL;
if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, &err))
{
g_propagate_error (error, err);
/* Test validity of path here. */
info = get_file_info (impl->file_system, path, FALSE, error);
if (!info)
return FALSE;
gtk_file_info_free (info);
if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, error))
return FALSE;
}
if (impl->current_folder != path)
{
@ -2896,7 +2895,7 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser,
impl->current_folder = gtk_file_path_copy (path);
}
/* Update the widgets that may trigger a folder chnage themselves */
/* Update the widgets that may trigger a folder change themselves. */
if (!impl->changing_folder)
{

View File

@ -784,7 +784,6 @@ gtk_path_bar_check_parent_path (GtkPathBar *path_bar,
current_path = list;
break;
}
}
if (current_path)
@ -815,6 +814,9 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
result = TRUE;
/* Check whether the new path is already present in the pathbar as buttons.
* This could be a parent directory or a previous selected subdirectory.
*/
if (gtk_path_bar_check_parent_path (path_bar, file_path, path_bar->file_system))
return TRUE;
@ -827,43 +829,33 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
GtkFilePath *parent_path = NULL;
GtkWidget *button;
const gchar *display_name;
GError *err = NULL;
GtkFileFolder *file_folder;
GtkFileInfo *file_info;
gboolean valid;
GtkFileInfoType needed = GTK_FILE_INFO_DISPLAY_NAME;
ButtonType button_type;
valid = gtk_file_system_get_parent (path_bar->file_system,
path,
&parent_path,
&err);
error);
if (!valid)
{
result = FALSE;
g_propagate_error (error, err);
gtk_file_path_free (path);
break;
}
if (first_directory)
needed |= GTK_FILE_INFO_IS_FOLDER;
file_folder = gtk_file_system_get_folder
(path_bar->file_system,
file_folder = gtk_file_system_get_folder (path_bar->file_system,
parent_path ? parent_path : path,
needed,
GTK_FILE_INFO_DISPLAY_NAME,
NULL);
file_info = gtk_file_folder_get_info (file_folder, path, error);
g_object_unref (file_folder);
file_info = gtk_file_folder_get_info (file_folder, path, &err);
if (!file_info || (first_directory && !gtk_file_info_get_is_folder (file_info)))
if (!file_info)
{
result = FALSE;
g_propagate_error (error, err);
if (file_info)
gtk_file_info_free (file_info);
g_object_unref (file_folder);
gtk_file_path_free (parent_path);
gtk_file_path_free (path);
break;
@ -874,14 +866,12 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
button = make_directory_button (path_bar, display_name, path, first_directory);
gtk_file_info_free (file_info);
gtk_file_path_free (path);
g_object_unref (file_folder);
new_buttons = g_list_prepend (new_buttons, button);
button_type = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "gtk-path-bar-button-type"));
if (button_type != NORMAL_BUTTON)
{
if (parent_path)
gtk_file_path_free (parent_path);
break;
}