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

@ -1,3 +1,49 @@
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".
2004-03-31 Tor Lillqvist <tml@iki.fi> 2004-03-31 Tor Lillqvist <tml@iki.fi>
* configure.in: Move AC_CANONICAL_HOST earlier, before the check * configure.in: Move AC_CANONICAL_HOST earlier, before the check

View File

@ -1,3 +1,49 @@
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".
2004-03-31 Tor Lillqvist <tml@iki.fi> 2004-03-31 Tor Lillqvist <tml@iki.fi>
* configure.in: Move AC_CANONICAL_HOST earlier, before the check * configure.in: Move AC_CANONICAL_HOST earlier, before the check

View File

@ -1,3 +1,49 @@
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".
2004-03-31 Tor Lillqvist <tml@iki.fi> 2004-03-31 Tor Lillqvist <tml@iki.fi>
* configure.in: Move AC_CANONICAL_HOST earlier, before the check * configure.in: Move AC_CANONICAL_HOST earlier, before the check

View File

@ -1,3 +1,49 @@
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".
2004-03-31 Tor Lillqvist <tml@iki.fi> 2004-03-31 Tor Lillqvist <tml@iki.fi>
* configure.in: Move AC_CANONICAL_HOST earlier, before the check * configure.in: Move AC_CANONICAL_HOST earlier, before the check

View File

@ -1,3 +1,49 @@
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".
2004-03-31 Tor Lillqvist <tml@iki.fi> 2004-03-31 Tor Lillqvist <tml@iki.fi>
* configure.in: Move AC_CANONICAL_HOST earlier, before the check * configure.in: Move AC_CANONICAL_HOST earlier, before the check

View File

@ -27,6 +27,7 @@
#include "gtkcellrendererpixbuf.h" #include "gtkcellrendererpixbuf.h"
#include "gtkcellrendererseptext.h" #include "gtkcellrendererseptext.h"
#include "gtkcellrenderertext.h" #include "gtkcellrenderertext.h"
#include "gtkcheckmenuitem.h"
#include "gtkcombobox.h" #include "gtkcombobox.h"
#include "gtkentry.h" #include "gtkentry.h"
#include "gtkexpander.h" #include "gtkexpander.h"
@ -106,6 +107,8 @@ struct _GtkFileChooserDefault
GtkWidget *browse_shortcuts_add_button; GtkWidget *browse_shortcuts_add_button;
GtkWidget *browse_shortcuts_remove_button; GtkWidget *browse_shortcuts_remove_button;
GtkWidget *browse_files_tree_view; GtkWidget *browse_files_tree_view;
GtkWidget *browse_files_popup_menu;
GtkWidget *browse_files_popup_menu_hidden_files_item;
GtkWidget *browse_new_folder_button; GtkWidget *browse_new_folder_button;
GtkWidget *browse_path_bar; GtkWidget *browse_path_bar;
GtkWidget *browse_extra_align; GtkWidget *browse_extra_align;
@ -347,6 +350,7 @@ static void list_row_activated (GtkTreeView *tree_view,
static void path_bar_clicked (GtkPathBar *path_bar, static void path_bar_clicked (GtkPathBar *path_bar,
GtkFilePath *file_path, GtkFilePath *file_path,
gboolean child_is_hidden,
GtkFileChooserDefault *impl); GtkFileChooserDefault *impl);
static void add_bookmark_button_clicked_cb (GtkButton *button, static void add_bookmark_button_clicked_cb (GtkButton *button,
@ -1676,7 +1680,7 @@ add_bookmark_foreach_cb (GtkTreeModel *model,
fs_model = impl->browse_files_model; fs_model = impl->browse_files_model;
gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, iter); gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, iter);
file_path = _gtk_file_system_model_get_path (GTK_FILE_SYSTEM_MODEL (fs_model), &child_iter); file_path = _gtk_file_system_model_get_path (fs_model, &child_iter);
shortcuts_add_bookmark_from_path (impl, file_path, -1); shortcuts_add_bookmark_from_path (impl, file_path, -1);
} }
@ -2546,6 +2550,9 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
return vbox; return vbox;
} }
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own.
*/
static gboolean static gboolean
trap_activate_cb (GtkWidget *widget, trap_activate_cb (GtkWidget *widget,
GdkEventKey *event, GdkEventKey *event,
@ -2574,6 +2581,106 @@ trap_activate_cb (GtkWidget *widget,
return FALSE; return FALSE;
} }
/* Callback used when the file list's popup menu is detached */
static void
popup_menu_detach_cb (GtkWidget *attach_widget,
GtkMenu *menu)
{
GtkFileChooserDefault *impl;
impl = g_object_get_data (G_OBJECT (attach_widget), "GtkFileChooserDefault");
g_assert (GTK_IS_FILE_CHOOSER_DEFAULT (impl));
impl->browse_files_popup_menu = NULL;
impl->browse_files_popup_menu_hidden_files_item = NULL;
}
/* Callback used when the "Show Hidden Files" menu item is toggled */
static void
show_hidden_toggled_cb (GtkCheckMenuItem *item,
GtkFileChooserDefault *impl)
{
g_object_set (impl,
"show-hidden", gtk_check_menu_item_get_active (item),
NULL);
}
/* Constructs the popup menu for the file list if needed */
static void
file_list_build_popup_menu (GtkFileChooserDefault *impl)
{
if (!impl->browse_files_popup_menu)
{
impl->browse_files_popup_menu = gtk_menu_new ();
gtk_menu_attach_to_widget (GTK_MENU (impl->browse_files_popup_menu),
impl->browse_files_tree_view,
popup_menu_detach_cb);
impl->browse_files_popup_menu_hidden_files_item =
gtk_check_menu_item_new_with_mnemonic (_("Show _Hidden Files"));
g_signal_connect (impl->browse_files_popup_menu_hidden_files_item, "toggled",
G_CALLBACK (show_hidden_toggled_cb), impl);
gtk_widget_show (impl->browse_files_popup_menu_hidden_files_item);
gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu),
impl->browse_files_popup_menu_hidden_files_item);
}
g_signal_handlers_block_by_func (impl->browse_files_popup_menu_hidden_files_item,
G_CALLBACK (show_hidden_toggled_cb), impl);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->browse_files_popup_menu_hidden_files_item),
impl->show_hidden);
g_signal_handlers_unblock_by_func (impl->browse_files_popup_menu_hidden_files_item,
G_CALLBACK (show_hidden_toggled_cb), impl);
}
static void
file_list_popup_menu (GtkFileChooserDefault *impl,
GdkEventButton *event)
{
int button;
guint32 timestamp;
if (event)
{
button = event->button;
timestamp = event->time;
}
else
{
button = 0;
timestamp = GDK_CURRENT_TIME;
}
file_list_build_popup_menu (impl);
gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu),
NULL, NULL, NULL, NULL,
button, timestamp);
}
/* Callback used for the GtkWidget::popup-menu signal of the file list */
static gboolean
list_popup_menu_cb (GtkWidget *widget,
GtkFileChooserDefault *impl)
{
file_list_popup_menu (impl, NULL);
return TRUE;
}
/* Callback used when a button is pressed on the file list. We trap button 3 to
* bring up a popup menu.
*/
static gboolean
list_button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
GtkFileChooserDefault *impl)
{
if (event->button != 3)
return FALSE;
file_list_popup_menu (impl, event);
return TRUE;
}
/* Creates the widgets for the file list */ /* Creates the widgets for the file list */
static GtkWidget * static GtkWidget *
@ -2595,12 +2702,18 @@ create_file_list (GtkFileChooserDefault *impl)
/* Tree/list view */ /* Tree/list view */
impl->browse_files_tree_view = gtk_tree_view_new (); impl->browse_files_tree_view = gtk_tree_view_new ();
g_object_set_data (G_OBJECT (impl->browse_files_tree_view), "GtkFileChooserDefault", impl);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->browse_files_tree_view), TRUE); gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->browse_files_tree_view), TRUE);
gtk_container_add (GTK_CONTAINER (swin), impl->browse_files_tree_view); gtk_container_add (GTK_CONTAINER (swin), impl->browse_files_tree_view);
g_signal_connect (impl->browse_files_tree_view, "row-activated", g_signal_connect (impl->browse_files_tree_view, "row-activated",
G_CALLBACK (list_row_activated), impl); G_CALLBACK (list_row_activated), impl);
g_signal_connect (impl->browse_files_tree_view, "key-press-event", g_signal_connect (impl->browse_files_tree_view, "key-press-event",
G_CALLBACK (trap_activate_cb), impl); G_CALLBACK (trap_activate_cb), impl);
g_signal_connect (impl->browse_files_tree_view, "popup-menu",
G_CALLBACK (list_popup_menu_cb), impl);
g_signal_connect (impl->browse_files_tree_view, "button-press-event",
G_CALLBACK (list_button_press_event_cb), impl);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_files_tree_view), gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_files_tree_view),
@ -3272,8 +3385,7 @@ gtk_file_chooser_default_set_property (GObject *object,
if (show_hidden != impl->show_hidden) if (show_hidden != impl->show_hidden)
{ {
impl->show_hidden = show_hidden; impl->show_hidden = show_hidden;
_gtk_file_system_model_set_show_hidden (GTK_FILE_SYSTEM_MODEL (impl->browse_files_model), _gtk_file_system_model_set_show_hidden (impl->browse_files_model, show_hidden);
show_hidden);
} }
} }
break; break;
@ -3825,11 +3937,43 @@ gtk_file_chooser_default_select_path (GtkFileChooser *chooser,
else else
{ {
gboolean result; gboolean result;
GtkFileFolder *folder;
GtkFileInfo *info;
gboolean is_hidden;
result = _gtk_file_chooser_set_current_folder_path (chooser, parent_path, error); result = _gtk_file_chooser_set_current_folder_path (chooser, parent_path, error);
if (!result)
{
gtk_file_path_free (parent_path);
return result;
}
folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error);
gtk_file_path_free (parent_path); gtk_file_path_free (parent_path);
_gtk_file_system_model_path_do (impl->browse_files_model, path,
select_func, impl); if (!folder)
return FALSE;
info = gtk_file_folder_get_info (folder, path, error);
g_object_unref (folder);
if (!info)
return FALSE;
is_hidden = gtk_file_info_get_is_hidden (info);
gtk_file_info_free (info);
if (is_hidden)
g_object_set (impl, "show-hidden", TRUE, NULL);
result = _gtk_file_system_model_path_do (impl->browse_files_model, path,
select_func, impl);
if (!result)
g_set_error (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
_("Could not find the path"));
return result; return result;
} }
@ -3861,7 +4005,7 @@ gtk_file_chooser_default_unselect_path (GtkFileChooser *chooser,
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
_gtk_file_system_model_path_do (impl->browse_files_model, path, _gtk_file_system_model_path_do (impl->browse_files_model, path,
unselect_func, impl); unselect_func, impl);
} }
static void static void
@ -3943,7 +4087,7 @@ get_paths_foreach (GtkTreeModel *model,
fs_model = info->impl->browse_files_model; fs_model = info->impl->browse_files_model;
gtk_tree_model_sort_convert_iter_to_child_iter (info->impl->sort_model, &sel_iter, iter); gtk_tree_model_sort_convert_iter_to_child_iter (info->impl->sort_model, &sel_iter, iter);
file_path = _gtk_file_system_model_get_path (GTK_FILE_SYSTEM_MODEL (fs_model), &sel_iter); file_path = _gtk_file_system_model_get_path (fs_model, &sel_iter);
if (!file_path) if (!file_path)
return; /* We are on the editable row */ return; /* We are on the editable row */
@ -4731,9 +4875,18 @@ list_row_activated (GtkTreeView *tree_view,
static void static void
path_bar_clicked (GtkPathBar *path_bar, path_bar_clicked (GtkPathBar *path_bar,
GtkFilePath *file_path, GtkFilePath *file_path,
gboolean child_is_hidden,
GtkFileChooserDefault *impl) GtkFileChooserDefault *impl)
{ {
change_folder_and_display_error (impl, file_path); if (!change_folder_and_display_error (impl, file_path))
return;
/* Say we have "/foo/bar/[.baz]" and the user clicks on "bar". We should then
* show hidden files so that ".baz" appears in the file list, as it will still
* be shown in the path bar: "/foo/[bar]/.baz"
*/
if (child_is_hidden)
g_object_set (impl, "show-hidden", TRUE, NULL);
} }
static const GtkFileInfo * static const GtkFileInfo *

View File

@ -770,8 +770,8 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
if (gtk_file_folder_is_finished_loading (model->root_folder)) if (gtk_file_folder_is_finished_loading (model->root_folder))
queue_finished_loading (model); /* done in an idle because we are being created */ queue_finished_loading (model); /* done in an idle because we are being created */
else else
g_signal_connect (model->root_folder, "finished-loading", g_signal_connect_object (model->root_folder, "finished-loading",
G_CALLBACK (root_folder_finished_loading_cb), model); G_CALLBACK (root_folder_finished_loading_cb), model, 0);
g_signal_connect_object (model->root_folder, "deleted", g_signal_connect_object (model->root_folder, "deleted",
G_CALLBACK (root_deleted_callback), model, 0); G_CALLBACK (root_deleted_callback), model, 0);

View File

@ -82,6 +82,7 @@ VOID:OBJECT,UINT
VOID:OBJECT,UINT,FLAGS VOID:OBJECT,UINT,FLAGS
VOID:POINTER VOID:POINTER
VOID:POINTER,INT VOID:POINTER,INT
VOID:POINTER,BOOLEAN
VOID:POINTER,POINTER,POINTER VOID:POINTER,POINTER,POINTER
VOID:POINTER,UINT VOID:POINTER,UINT
VOID:STRING VOID:STRING

View File

@ -61,6 +61,7 @@ struct _ButtonData
GtkWidget *image; GtkWidget *image;
GtkWidget *label; GtkWidget *label;
gboolean ignore_changes; gboolean ignore_changes;
gboolean file_is_hidden;
}; };
G_DEFINE_TYPE (GtkPathBar, 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;*/ /* container_class->child_type = gtk_path_bar_child_type;*/
path_bar_signals [PATH_CLICKED] = path_bar_signals [PATH_CLICKED] =
g_signal_new ("path_clicked", g_signal_new ("path-clicked",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkPathBarClass, path_clicked), G_STRUCT_OFFSET (GtkPathBarClass, path_clicked),
NULL, NULL, NULL, NULL,
_gtk_marshal_VOID__POINTER, _gtk_marshal_VOID__POINTER_BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_NONE, 2,
G_TYPE_POINTER); G_TYPE_POINTER,
G_TYPE_BOOLEAN);
} }
@ -744,17 +746,32 @@ button_clicked_cb (GtkWidget *button,
gpointer data) gpointer data)
{ {
ButtonData *button_data; ButtonData *button_data;
GtkWidget *path_bar; GtkPathBar *path_bar;
GList *button_list;
gboolean child_is_hidden;
button_data = BUTTON_DATA (data); button_data = BUTTON_DATA (data);
if (button_data->ignore_changes) if (button_data->ignore_changes)
return; return;
path_bar = button->parent; path_bar = GTK_PATH_BAR (button->parent);
g_assert (GTK_IS_PATH_BAR (path_bar));
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); 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 * static GdkPixbuf *
@ -880,7 +897,8 @@ static ButtonData *
make_directory_button (GtkPathBar *path_bar, make_directory_button (GtkPathBar *path_bar,
const char *dir_name, const char *dir_name,
GtkFilePath *path, GtkFilePath *path,
gboolean current_dir) gboolean current_dir,
gboolean file_is_hidden)
{ {
GtkWidget *child = NULL; GtkWidget *child = NULL;
ButtonData *button_data; ButtonData *button_data;
@ -915,6 +933,7 @@ make_directory_button (GtkPathBar *path_bar,
button_data->dir_name = g_strdup (dir_name); button_data->dir_name = g_strdup (dir_name);
button_data->path = gtk_file_path_new_dup (gtk_file_path_get_string (path)); 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_container_add (GTK_CONTAINER (button_data->button), child);
gtk_widget_show_all (button_data->button); gtk_widget_show_all (button_data->button);
@ -993,6 +1012,7 @@ _gtk_path_bar_set_path (GtkPathBar *path_bar,
GtkFilePath *parent_path = NULL; GtkFilePath *parent_path = NULL;
ButtonData *button_data; ButtonData *button_data;
const gchar *display_name; const gchar *display_name;
gboolean is_hidden;
GtkFileFolder *file_folder; GtkFileFolder *file_folder;
GtkFileInfo *file_info; GtkFileInfo *file_info;
gboolean valid; 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, file_folder = gtk_file_system_get_folder (path_bar->file_system,
parent_path ? parent_path : path, parent_path ? parent_path : path,
GTK_FILE_INFO_DISPLAY_NAME, GTK_FILE_INFO_DISPLAY_NAME | GTK_FILE_INFO_IS_HIDDEN,
NULL); NULL);
if (!file_folder) 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); 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_info_free (file_info);
gtk_file_path_free (path); gtk_file_path_free (path);

View File

@ -66,7 +66,8 @@ struct _GtkPathBarClass
GtkContainerClass parent_class; GtkContainerClass parent_class;
void (* path_clicked) (GtkPathBar *path_bar, void (* path_clicked) (GtkPathBar *path_bar,
GtkFilePath *file_path); GtkFilePath *file_path,
gboolean child_is_hidden);
}; };
GType gtk_path_bar_get_type (void) G_GNUC_CONST; GType gtk_path_bar_get_type (void) G_GNUC_CONST;