[gthumb/ext] resize the file chooser dialog when the expander is closed



commit dbce4320a9f69f9d430b374c28e5aa510fcbf920
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Nov 29 13:25:33 2009 +0100

    resize the file chooser dialog when the expander is closed

 gthumb/eggfileformatchooser.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/eggfileformatchooser.c b/gthumb/eggfileformatchooser.c
index 20b8b33..b1e51c4 100644
--- a/gthumb/eggfileformatchooser.c
+++ b/gthumb/eggfileformatchooser.c
@@ -355,6 +355,28 @@ find_by_extension (GtkTreeModel *model,
   return search->success;
 }
 
+static int
+emit_default_size_changed (gpointer data)
+{
+  g_signal_emit_by_name (data, "default-size-changed");
+  return FALSE;
+}
+
+static void
+expander_unmap_cb (GtkWidget *widget,
+		   gpointer   user_data)
+{
+  GtkWidget *parent;
+
+  parent = gtk_widget_get_parent (widget);
+  while ((parent != NULL) && !GTK_IS_FILE_CHOOSER (parent))
+    parent = gtk_widget_get_parent (parent);
+  if (parent != NULL)
+    {
+      gdk_threads_add_idle (emit_default_size_changed, parent);
+    }
+}
+
 static void
 egg_file_format_chooser_init (EggFileFormatChooser *self)
 {
@@ -438,6 +460,8 @@ egg_file_format_chooser_init (EggFileFormatChooser *self)
   gtk_widget_show_all (scroller);
 
   gtk_container_add (GTK_CONTAINER (self), scroller);
+
+  g_signal_connect_after (scroller, "unmap", G_CALLBACK (expander_unmap_cb), self);
 }
 
 static void



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