Avoid visibly resizing the file chooser at startup

* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_map):
	Don't change the default size in ::map() so we don't flicker...
	(gtk_file_chooser_default_realize): ... so do it in ::realize()
	instead, when the window is not yet visible.  This avoids a
	dialog-that-resizes when you first pop up the file chooser.
	(emit_default_size_changed): Just emit the signal; don't check for
	the widget's state so we can be emitted during the initial
	::realize() when we are not mapped yet.
	(update_preview_widget_visibility): Only emit default_size_changed
	if the widget is not mapped, to avoid resizing the dialog while it
	is visible.

Signed-off-by: Federico Mena Quintero <federico@novell.com>

svn path=/trunk/; revision=22117
This commit is contained in:
Federico Mena Quintero 2009-01-14 20:18:40 +00:00 committed by Federico Mena Quintero
parent b05fcd7e6b
commit 1d4694ec79
2 changed files with 30 additions and 6 deletions

View File

@ -16,6 +16,18 @@
(_gtk_file_chooser_settings_get_geometry): New public function.
(_gtk_file_chooser_settings_set_geometry): New public function.
* gtk/gtkfilechooserdefault.c (gtk_file_chooser_default_map):
Don't change the default size in ::map() so we don't flicker...
(gtk_file_chooser_default_realize): ... so do it in ::realize()
instead, when the window is not yet visible. This avoids a
dialog-that-resizes when you first pop up the file chooser.
(emit_default_size_changed): Just emit the signal; don't check for
the widget's state so we can be emitted during the initial
::realize() when we are not mapped yet.
(update_preview_widget_visibility): Only emit default_size_changed
if the widget is not mapped, to avoid resizing the dialog while it
is visible.
2009-01-13 Matthias Clasen <mclasen@redhat.com>
Bug 450716 New API to change global IM

View File

@ -274,6 +274,7 @@ static void gtk_file_chooser_default_get_property (GObject *ob
GParamSpec *pspec);
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_realize (GtkWidget *widget);
static void gtk_file_chooser_default_map (GtkWidget *widget);
static void gtk_file_chooser_default_unmap (GtkWidget *widget);
static void gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
@ -564,6 +565,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
gobject_class->dispose = gtk_file_chooser_default_dispose;
widget_class->show_all = gtk_file_chooser_default_show_all;
widget_class->realize = gtk_file_chooser_default_realize;
widget_class->map = gtk_file_chooser_default_map;
widget_class->unmap = gtk_file_chooser_default_unmap;
widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
@ -1156,9 +1158,6 @@ change_folder_and_display_error (GtkFileChooserDefault *impl,
static void
emit_default_size_changed (GtkFileChooserDefault *impl)
{
if (!GTK_WIDGET_MAPPED (impl))
return;
profile_msg (" emit default-size-changed start", NULL);
g_signal_emit_by_name (impl, "default-size-changed");
profile_msg (" emit default-size-changed end", NULL);
@ -1192,7 +1191,8 @@ update_preview_widget_visibility (GtkFileChooserDefault *impl)
else
gtk_widget_hide (impl->preview_box);
emit_default_size_changed (impl);
if (!GTK_WIDGET_MAPPED (impl))
emit_default_size_changed (impl);
}
static void
@ -6042,6 +6042,20 @@ settings_save (GtkFileChooserDefault *impl)
g_object_unref (settings);
}
/* GtkWidget::realize method */
static void
gtk_file_chooser_default_realize (GtkWidget *widget)
{
GtkFileChooserDefault *impl;
char *current_working_dir;
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->realize (widget);
emit_default_size_changed (impl);
}
/* GtkWidget::map method */
static void
gtk_file_chooser_default_map (GtkWidget *widget)
@ -6095,8 +6109,6 @@ gtk_file_chooser_default_map (GtkWidget *widget)
settings_load (impl);
emit_default_size_changed (impl);
profile_end ("end", NULL);
}