summaryrefslogtreecommitdiff
path: root/gtk/gtkpathbar.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2004-03-08 22:53:35 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2004-03-08 22:53:35 +0000
commit8383c8f7fe6425bc0010f1cf30c8310a606088ba (patch)
tree13183fc38d6888539460d5adc9ed8c8f7e1b4467 /gtk/gtkpathbar.c
parent2247fc6659fc9ffeb7d169f01d7e9c11e68f239c (diff)
downloadgdk-pixbuf-8383c8f7fe6425bc0010f1cf30c8310a606088ba.tar.gz
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.
Diffstat (limited to 'gtk/gtkpathbar.c')
-rw-r--r--gtk/gtkpathbar.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 4a6d979e9..a0b24f776 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -784,7 +784,6 @@ gtk_path_bar_check_parent_path (GtkPathBar *path_bar,
current_path = list;
break;
}
-
}
if (current_path)
@@ -815,9 +814,12 @@ _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;
-
+
path = gtk_file_path_copy (file_path);
gtk_widget_push_composite_child ();
@@ -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,
- parent_path ? parent_path : path,
- needed,
- NULL);
+ file_folder = gtk_file_system_get_folder (path_bar->file_system,
+ parent_path ? parent_path : path,
+ 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,15 +866,13 @@ _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);
+ gtk_file_path_free (parent_path);
break;
}