[gedit] CloseConfirmationDialog: UI improvements



commit 6c9695d4ebf8a9de900d1fef054b3439dfca395b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Nov 3 16:08:02 2013 +0100

    CloseConfirmationDialog: UI improvements
    
    The dialog is now resizable on multi mode. It is useful when the list of
    unsaved documents is long, and we want to show all of them.
    
    The scrolled window around the tree view has a greater minimum height,
    so by default more documents can be shown.
    
    The vbox2 must have the expand and fill properties to true (with
    gtk_box_pack_start()), so the treeview expands when the dialog window is
    resized.
    
    The size request of the tree view is removed, since it has no effect
    inside a scrolled window (but it's maybe a bug in gtk, I just get used
    to work around the problem, and set the size on the scrolled window
    instead).
    
    (and the policy for a scrolled window is "automatic" by default in GTK+ 3)
    
    It would have been better to have (1) natural height if below N (2)
    scrolled window if above N. With N at a treeview row boundary. But it is
    not easily feasible with gtk+ afaik (in gtksourceview we use a custom
    container for that...).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708711

 gedit/gedit-close-confirmation-dialog.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-close-confirmation-dialog.c b/gedit/gedit-close-confirmation-dialog.c
index 32f836b..735672f 100644
--- a/gedit/gedit-close-confirmation-dialog.c
+++ b/gedit/gedit-close-confirmation-dialog.c
@@ -134,7 +134,6 @@ gedit_close_confirmation_dialog_init (GeditCloseConfirmationDialog *dlg)
        gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
        gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
                             14);
-       gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
        gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE);
 
        gtk_window_set_title (GTK_WINDOW (dlg), "");
@@ -445,6 +444,8 @@ build_single_doc_dialog (GeditCloseConfirmationDialog *dlg)
        gchar         *str;
        gchar         *markup_str;
 
+       gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+
        g_return_if_fail (dlg->priv->unsaved_documents->data != NULL);
        doc = GEDIT_DOCUMENT (dlg->priv->unsaved_documents->data);
 
@@ -573,7 +574,6 @@ create_treeview (GeditCloseConfirmationDialogPrivate *priv)
        GtkTreeViewColumn *column;
 
        treeview = gtk_tree_view_new ();
-       gtk_widget_set_size_request (treeview, 260, 120);
        gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
        gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
 
@@ -684,7 +684,7 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
        gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0);
 
        vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-       gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox), vbox2, TRUE, TRUE, 0);
 
        if (priv->disable_save_to_disk)
        {
@@ -701,11 +701,9 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
 
        scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
        gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
                                             GTK_SHADOW_IN);
+       gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolledwindow), 60);
 
        treeview = create_treeview (priv);
        gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);


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