[balsa/gtk3] Resize the mailbox tree widget



commit 31ffd3689896ebfe966f80aa35c83d62258ebd99
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Jan 8 22:25:17 2011 -0500

    Resize the mailbox tree widget
    
    	* src/balsa-mblist.c (bmbl_mru_show_tree): make the mailbox tree
    	dialog a reasonable size.

 ChangeLog          |    5 ++++
 src/balsa-mblist.c |   58 ++++++++++++++++++++++++++-------------------------
 2 files changed, 35 insertions(+), 28 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 82607a9..6bad8c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-08  Peter Bloomfield
+
+	* src/balsa-mblist.c (bmbl_mru_show_tree): make the mailbox tree
+	dialog a reasonable size.
+
 2010-12-29  Peter Bloomfield
 
 	* src/balsa-mime-widget-image.c (img_check_size): revert; use
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index cfde605..bcf6a01 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -1831,48 +1831,50 @@ static void
 bmbl_mru_show_tree(GtkWidget * widget, gpointer data)
 {
     BalsaMBListMRUEntry *mru = data;
-    GtkWidget *dialog =
+    GtkWidget *dialog;
+    GtkWidget *scroll;
+    GtkWidget *mblist;
+    GtkTreeSelection *selection;
+    GtkRequisition req;
+
+    mblist = balsa_mblist_new();
+    g_signal_connect(mblist, "row-activated",
+                     G_CALLBACK(bmbl_mru_activated_cb), data);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(mblist));
+    g_signal_connect(selection, "changed",
+                     G_CALLBACK(bmbl_mru_selected_cb), data);
+
+    scroll = gtk_scrolled_window_new(NULL, NULL);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_AUTOMATIC);
+    gtk_container_add(GTK_CONTAINER(scroll), mblist);
+    gtk_widget_show_all(scroll);
+
+    dialog =
         gtk_dialog_new_with_buttons(_("Choose destination folder"),
                                     mru->window,
                                     GTK_DIALOG_MODAL,
                                     GTK_STOCK_CANCEL,
                                     GTK_RESPONSE_CANCEL,
                                     NULL);
-    GtkWidget *scroll;
-    GtkWidget *mblist = balsa_mblist_new();
-    GtkTreeSelection *selection =
-        gtk_tree_view_get_selection(GTK_TREE_VIEW(mblist));
-    GtkRequisition req;
-
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, mru->window);
 #endif
-    scroll = gtk_scrolled_window_new(NULL, NULL);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
-
-    g_signal_connect(selection, "changed",
-                     G_CALLBACK(bmbl_mru_selected_cb), data);
-    g_signal_connect(mblist, "row-activated",
-                     G_CALLBACK(bmbl_mru_activated_cb), data);
+    gtk_box_pack_start(GTK_BOX
+                      (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
+                      scroll, TRUE, TRUE, 0);
 
     /* Force the mailbox list to be a reasonable size. */
     gtk_widget_get_preferred_size(mblist, NULL, &req);
+    /* FIXME: Magic numbers to avoid showing scrollbars;
+     * probably theme-dependent: */
+    req.width += 25;
+    req.height += 50;
     if (req.height > balsa_app.mw_height)
         req.height = balsa_app.mw_height;
-    /* For the mailbox list width, we use the one used on the main
-     * window enhanced somewhat. This is the user choice and required
-     * because the mblist widget saves the size in
-     * balsa_app.mblist_width */
-    req.width = balsa_app.mblist_width> 200 ? balsa_app.mblist_width : 200;
-    if (FALSE) gtk_widget_set_size_request(GTK_WIDGET(mblist), req.width, req.height);
-
-    gtk_container_add(GTK_CONTAINER(scroll), mblist);
-    gtk_container_add(GTK_CONTAINER
-                      (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                      scroll);
-    gtk_widget_show_all(scroll);
+    gtk_window_set_default_size(GTK_WINDOW(dialog), req.width, req.height);
 
     gtk_dialog_run(GTK_DIALOG(dialog));
     gtk_widget_destroy(dialog);



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