Commit 9f558a15 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero
Browse files

Merged from gtk-2-4:

2004-12-14  Federico Mena Quintero  <federico@ximian.com>

	Merged from gtk-2-4:

	Fix #145470:

	* gtk/gtkfilechooserdefault.c
	(gtk_file_chooser_default_initial_focus): Queue a pending
	operation to select the first row if we are not finished loading
	yet.
	(gtk_file_chooser_default_class_init): Override GtkWidget::map().
	(gtk_file_chooser_default_map): New ::map() handler; refresh the
	file and bookmark lists.

	* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_class_init):
	Override GtkWidget::map() and GtkWidget::unmap().
	(gtk_file_chooser_dialog_constructor): Don't call initial_focus()
	here.
	(gtk_file_chooser_dialog_map): Map the file chooser widget if
	needed.  Call initial_focus() here.
	(gtk_file_chooser_dialog_unmap): Unmap the file chooser widget.
	When we are re-mapped, the widget will get mapped as well and it
	will have a chance to refresh.
parent faa58ba4
2004-12-14 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
Fix #145470:
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_initial_focus): Queue a pending
operation to select the first row if we are not finished loading
yet.
(gtk_file_chooser_default_class_init): Override GtkWidget::map().
(gtk_file_chooser_default_map): New ::map() handler; refresh the
file and bookmark lists.
* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_class_init):
Override GtkWidget::map() and GtkWidget::unmap().
(gtk_file_chooser_dialog_constructor): Don't call initial_focus()
here.
(gtk_file_chooser_dialog_map): Map the file chooser widget if
needed. Call initial_focus() here.
(gtk_file_chooser_dialog_unmap): Unmap the file chooser widget.
When we are re-mapped, the widget will get mapped as well and it
will have a chance to refresh.
2004-12-14 Matthias Clasen <mclasen@redhat.com> 2004-12-14 Matthias Clasen <mclasen@redhat.com>
* README.win32: Fix a typo * README.win32: Fix a typo
......
2004-12-14 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
Fix #145470:
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_initial_focus): Queue a pending
operation to select the first row if we are not finished loading
yet.
(gtk_file_chooser_default_class_init): Override GtkWidget::map().
(gtk_file_chooser_default_map): New ::map() handler; refresh the
file and bookmark lists.
* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_class_init):
Override GtkWidget::map() and GtkWidget::unmap().
(gtk_file_chooser_dialog_constructor): Don't call initial_focus()
here.
(gtk_file_chooser_dialog_map): Map the file chooser widget if
needed. Call initial_focus() here.
(gtk_file_chooser_dialog_unmap): Unmap the file chooser widget.
When we are re-mapped, the widget will get mapped as well and it
will have a chance to refresh.
2004-12-14 Matthias Clasen <mclasen@redhat.com> 2004-12-14 Matthias Clasen <mclasen@redhat.com>
* README.win32: Fix a typo * README.win32: Fix a typo
......
2004-12-14 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
Fix #145470:
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_initial_focus): Queue a pending
operation to select the first row if we are not finished loading
yet.
(gtk_file_chooser_default_class_init): Override GtkWidget::map().
(gtk_file_chooser_default_map): New ::map() handler; refresh the
file and bookmark lists.
* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_class_init):
Override GtkWidget::map() and GtkWidget::unmap().
(gtk_file_chooser_dialog_constructor): Don't call initial_focus()
here.
(gtk_file_chooser_dialog_map): Map the file chooser widget if
needed. Call initial_focus() here.
(gtk_file_chooser_dialog_unmap): Unmap the file chooser widget.
When we are re-mapped, the widget will get mapped as well and it
will have a chance to refresh.
2004-12-14 Matthias Clasen <mclasen@redhat.com> 2004-12-14 Matthias Clasen <mclasen@redhat.com>
* README.win32: Fix a typo * README.win32: Fix a typo
......
2004-12-14 Federico Mena Quintero <federico@ximian.com>
Merged from gtk-2-4:
Fix #145470:
* gtk/gtkfilechooserdefault.c
(gtk_file_chooser_default_initial_focus): Queue a pending
operation to select the first row if we are not finished loading
yet.
(gtk_file_chooser_default_class_init): Override GtkWidget::map().
(gtk_file_chooser_default_map): New ::map() handler; refresh the
file and bookmark lists.
* gtk/gtkfilechooserdialog.c (gtk_file_chooser_dialog_class_init):
Override GtkWidget::map() and GtkWidget::unmap().
(gtk_file_chooser_dialog_constructor): Don't call initial_focus()
here.
(gtk_file_chooser_dialog_map): Map the file chooser widget if
needed. Call initial_focus() here.
(gtk_file_chooser_dialog_unmap): Unmap the file chooser widget.
When we are re-mapped, the widget will get mapped as well and it
will have a chance to refresh.
2004-12-14 Matthias Clasen <mclasen@redhat.com> 2004-12-14 Matthias Clasen <mclasen@redhat.com>
* README.win32: Fix a typo * README.win32: Fix a typo
......
...@@ -303,6 +303,7 @@ static void gtk_file_chooser_default_get_property (GObject *ob ...@@ -303,6 +303,7 @@ static void gtk_file_chooser_default_get_property (GObject *ob
GParamSpec *pspec); GParamSpec *pspec);
static void gtk_file_chooser_default_dispose (GObject *object); static void gtk_file_chooser_default_dispose (GObject *object);
static void gtk_file_chooser_default_show_all (GtkWidget *widget); static void gtk_file_chooser_default_show_all (GtkWidget *widget);
static void gtk_file_chooser_default_map (GtkWidget *widget);
static void gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget, static void gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel); GtkWidget *previous_toplevel);
static void gtk_file_chooser_default_style_set (GtkWidget *widget, static void gtk_file_chooser_default_style_set (GtkWidget *widget,
...@@ -537,6 +538,7 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) ...@@ -537,6 +538,7 @@ gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
gobject_class->dispose = gtk_file_chooser_default_dispose; gobject_class->dispose = gtk_file_chooser_default_dispose;
widget_class->show_all = gtk_file_chooser_default_show_all; widget_class->show_all = gtk_file_chooser_default_show_all;
widget_class->map = gtk_file_chooser_default_map;
widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed; widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
widget_class->style_set = gtk_file_chooser_default_style_set; widget_class->style_set = gtk_file_chooser_default_style_set;
widget_class->screen_changed = gtk_file_chooser_default_screen_changed; widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
...@@ -4037,6 +4039,20 @@ get_is_file_filtered (GtkFileChooserDefault *impl, ...@@ -4037,6 +4039,20 @@ get_is_file_filtered (GtkFileChooserDefault *impl,
return !result; return !result;
} }
/* GtkWidget::map method */
static void
gtk_file_chooser_default_map (GtkWidget *widget)
{
GtkFileChooserDefault *impl;
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
GTK_WIDGET_CLASS (parent_class)->map (widget);
change_folder_and_display_error (impl, impl->current_folder);
bookmarks_changed_cb (impl->file_system, impl);
}
static gboolean static gboolean
list_model_filter_func (GtkFileSystemModel *model, list_model_filter_func (GtkFileSystemModel *model,
GtkFilePath *path, GtkFilePath *path,
...@@ -5288,6 +5304,8 @@ gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed) ...@@ -5288,6 +5304,8 @@ gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed)
{ {
if (impl->load_state == LOAD_FINISHED) if (impl->load_state == LOAD_FINISHED)
browse_files_select_first_row (impl); browse_files_select_first_row (impl);
else
pending_op_queue (impl, PENDING_OP_SELECT_FIRST, NULL);
widget = impl->browse_files_tree_view; widget = impl->browse_files_tree_view;
} }
......
...@@ -60,6 +60,8 @@ static void gtk_file_chooser_dialog_get_property (GObject *obj ...@@ -60,6 +60,8 @@ static void gtk_file_chooser_dialog_get_property (GObject *obj
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gtk_file_chooser_dialog_map (GtkWidget *widget);
static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
static void gtk_file_chooser_dialog_style_set (GtkWidget *widget, static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style); GtkStyle *previous_style);
...@@ -118,6 +120,8 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class) ...@@ -118,6 +120,8 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class)
gobject_class->get_property = gtk_file_chooser_dialog_get_property; gobject_class->get_property = gtk_file_chooser_dialog_get_property;
gobject_class->finalize = gtk_file_chooser_dialog_finalize; gobject_class->finalize = gtk_file_chooser_dialog_finalize;
widget_class->map = gtk_file_chooser_dialog_map;
widget_class->unmap = gtk_file_chooser_dialog_unmap;
widget_class->style_set = gtk_file_chooser_dialog_style_set; widget_class->style_set = gtk_file_chooser_dialog_style_set;
_gtk_file_chooser_install_properties (gobject_class); _gtk_file_chooser_install_properties (gobject_class);
...@@ -397,8 +401,6 @@ gtk_file_chooser_dialog_constructor (GType type, ...@@ -397,8 +401,6 @@ gtk_file_chooser_dialog_constructor (GType type,
_gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object), _gtk_file_chooser_set_delegate (GTK_FILE_CHOOSER (object),
GTK_FILE_CHOOSER (priv->widget)); GTK_FILE_CHOOSER (priv->widget));
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
gtk_widget_pop_composite_child (); gtk_widget_pop_composite_child ();
return object; return object;
...@@ -487,6 +489,39 @@ set_default_size (GtkFileChooserDialog *dialog) ...@@ -487,6 +489,39 @@ set_default_size (GtkFileChooserDialog *dialog)
} }
#endif #endif
/* GtkWidget::map handler */
static void
gtk_file_chooser_dialog_map (GtkWidget *widget)
{
GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
if (!GTK_WIDGET_MAPPED (priv->widget))
gtk_widget_map (priv->widget);
GTK_WIDGET_CLASS (parent_class)->map (widget);
_gtk_file_chooser_embed_initial_focus (GTK_FILE_CHOOSER_EMBED (priv->widget));
}
/* GtkWidget::unmap handler */
static void
gtk_file_chooser_dialog_unmap (GtkWidget *widget)
{
GtkFileChooserDialog *dialog = GTK_FILE_CHOOSER_DIALOG (widget);
GtkFileChooserDialogPrivate *priv = GTK_FILE_CHOOSER_DIALOG_GET_PRIVATE (dialog);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
/* See bug #145470. We unmap the GtkFileChooserWidget so that if the dialog
* is remapped, the widget will be remapped as well. Implementations should
* refresh their contents when this happens, as some applications keep a
* single file chooser alive and map/unmap it as needed, rather than creating
* a new file chooser every time they need one.
*/
gtk_widget_unmap (priv->widget);
}
static void static void
gtk_file_chooser_dialog_style_set (GtkWidget *widget, gtk_file_chooser_dialog_style_set (GtkWidget *widget,
GtkStyle *previous_style) GtkStyle *previous_style)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment