gtk+ r22117 - in trunk: . gtk



Author: federico
Date: Wed Jan 14 20:18:40 2009
New Revision: 22117
URL: http://svn.gnome.org/viewvc/gtk+?rev=22117&view=rev

Log:
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>

Modified:
   trunk/ChangeLog
   trunk/gtk/gtkfilechooserdefault.c

Modified: trunk/gtk/gtkfilechooserdefault.c
==============================================================================
--- trunk/gtk/gtkfilechooserdefault.c	(original)
+++ trunk/gtk/gtkfilechooserdefault.c	Wed Jan 14 20:18:40 2009
@@ -274,6 +274,7 @@
 						       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 @@
   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 @@
 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 @@
   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 @@
   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 @@
 
   settings_load (impl);
 
-  emit_default_size_changed (impl);
-
   profile_end ("end", NULL);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]