2004-04-01  Federico Mena Quintero  <federico@ximian.com>

	Fix #136077.

	* gtk/gtkpathbar.h (struct _GtkPathBarClass): Add a
	"child_is_hidden" boolean argument to the "path-clicked" signal.

	* gtk/gtkpathbar.c (struct _ButtonData): Added a file_is_hidden
	field.
	(make_directory_button): Take a file_is_hidden argument; put it in
	the ButtonData.
	(_gtk_path_bar_set_path): See whether each path component path is
	a hidden file.
	(gtk_path_bar_class_init): Add the file_is_hidden argument to the
	"path-clicked" signal.
	(button_clicked_cb): See if the downwards button represents a
	hidden file for the file_is_hidden argument in the signal
	emission.

	* gtk/gtkmarshalers.list: Added a signal type VOID:POINTER,BOOLEAN.

	* gtk/gtkfilechooserdefault.c
	(gtk_file_chooser_default_select_path): If we fail to switch
	folders, don't try to select the path in the file system model.
	Also, return the result from _gtk_file_system_model_path_do().
	(gtk_file_chooser_default_select_path): Turn on show_hidden in the
	file system model if we are asked to select a hidden file.
	(path_bar_clicked): Show hidden files based on whether the
	immediate downwards folder in the path bar is a hidden file
	itself.
	(struct _GtkFileChooserDefault): Added fields
	browse_files_popup_menu and browse_files_popup_menu_hidden_files_item.
	(create_file_list): Set an object data key of
	"GtkFileChooserDefault" on the tree view so that we can find the
	impl from the popup menu callbacks.  Also, hook up to the
	"button-press-event" and "popup-menu" signals in the file list to
	bring up a popup menu.
	(list_popup_menu_cb): New callback.
	(list_button_press_event_cb): New callback.

	Fix #138763:

	* gtk/gtkfilesystemmodel.c
	(_gtk_file_system_model_new): Oops, connect_object to
	"finished-loading".
This commit is contained in:
Federico Mena Quintero
2004-04-02 00:35:07 +00:00
committed by Federico Mena Quintero
parent 3d76be337d
commit 8e661364c6
10 changed files with 428 additions and 22 deletions

View File

@ -61,6 +61,7 @@ struct _ButtonData
GtkWidget *image;
GtkWidget *label;
gboolean ignore_changes;
gboolean file_is_hidden;
};
G_DEFINE_TYPE (GtkPathBar,
@ -155,14 +156,15 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
/* container_class->child_type = gtk_path_bar_child_type;*/
path_bar_signals [PATH_CLICKED] =
g_signal_new ("path_clicked",
g_signal_new ("path-clicked",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkPathBarClass, path_clicked),
NULL, NULL,
_gtk_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
_gtk_marshal_VOID__POINTER_BOOLEAN,
G_TYPE_NONE, 2,
G_TYPE_POINTER,
G_TYPE_BOOLEAN);
}
@ -744,17 +746,32 @@ button_clicked_cb (GtkWidget *button,
gpointer data)
{
ButtonData *button_data;
GtkWidget *path_bar;
GtkPathBar *path_bar;
GList *button_list;
gboolean child_is_hidden;
button_data = BUTTON_DATA (data);
if (button_data->ignore_changes)
return;
path_bar = button->parent;
g_assert (GTK_IS_PATH_BAR (path_bar));
path_bar = GTK_PATH_BAR (button->parent);
button_list = g_list_find (path_bar->button_list, button_data);
g_assert (button_list != NULL);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0, button_data->path);
if (button_list->prev)
{
ButtonData *child_data;
child_data = BUTTON_DATA (button_list->prev->data);
child_is_hidden = child_data->file_is_hidden;
}
else
child_is_hidden = FALSE;
g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0, button_data->path, child_is_hidden);
}
static GdkPixbuf *
@ -880,7 +897,8 @@ static ButtonData *
make_directory_button (GtkPathBar *path_bar,
const char *dir_name,
GtkFilePath *path,
gboolean current_dir)
gboolean current_dir,
gboolean file_is_hidden)
{
GtkWidget *child = NULL;
ButtonData *button_data;
@ -915,6 +933,7 @@ make_directory_button (GtkPathBar *path_bar,
button_data->dir_name = g_strdup (dir_name);
button_data->path = gtk_file_path_new_dup (gtk_file_path_get_string (path));
button_data->file_is_hidden = file_is_hidden;
gtk_container_add (GTK_CONTAINER (button_data->button), child);
gtk_widget_show_all (button_data->button);
@ -993,6 +1012,7 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
GtkFilePath *parent_path = NULL;
ButtonData *button_data;
const gchar *display_name;
gboolean is_hidden;
GtkFileFolder *file_folder;
GtkFileInfo *file_info;
gboolean valid;
@ -1010,7 +1030,7 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
file_folder = gtk_file_system_get_folder (path_bar->file_system,
parent_path ? parent_path : path,
GTK_FILE_INFO_DISPLAY_NAME,
GTK_FILE_INFO_DISPLAY_NAME | GTK_FILE_INFO_IS_HIDDEN,
NULL);
if (!file_folder)
{
@ -1032,8 +1052,9 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
}
display_name = gtk_file_info_get_display_name (file_info);
is_hidden = gtk_file_info_get_is_hidden (file_info);
button_data = make_directory_button (path_bar, display_name, path, first_directory);
button_data = make_directory_button (path_bar, display_name, path, first_directory, is_hidden);
gtk_file_info_free (file_info);
gtk_file_path_free (path);