[gedit/wip/revamp-close-confirm-dialog-2] CloseConfirmationDialog: pack custom content in content_area



commit 444104a855fe910e9b5002e536d12d6fddc0e362
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Nov 30 21:39:29 2015 +0100

    CloseConfirmationDialog: pack custom content in content_area
    
    Not message_area. That way, the scrolled window is expandable and fills
    the available space when the dialog is resized.
    
    But we need to set ourselves the spacing and margins, which is less
    convenient and needs to be updated when GtkMessageDialog changes (or it
    is possible to compute the total margins of message_area plus its
    parents and apply the same, but to be future-proof it needs to take into
    account all the ways to add extra space around a widget: margins,
    padding, borders, the spacing between children in containers, etc, which
    can be a bit tricky).

 gedit/gedit-close-confirmation-dialog.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-close-confirmation-dialog.c b/gedit/gedit-close-confirmation-dialog.c
index bf6cc0e..46dfc64 100644
--- a/gedit/gedit-close-confirmation-dialog.c
+++ b/gedit/gedit-close-confirmation-dialog.c
@@ -481,7 +481,7 @@ create_list_box (GeditCloseConfirmationDialog *dlg)
 static void
 build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
 {
-       GtkWidget *message_area;
+       GtkWidget *content_area;
        GtkWidget *vbox;
        GtkWidget *select_label;
        GtkWidget *scrolledwindow;
@@ -520,9 +520,14 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
        g_free (markup_str);
 
        /* List of unsaved documents */
+       content_area = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
+       gtk_box_set_spacing (GTK_BOX (content_area), 10);
+
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
-       message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dlg));
-       gtk_box_pack_start (GTK_BOX (message_area), vbox, TRUE, TRUE, 0);
+       gtk_widget_set_margin_start (vbox, 30);
+       gtk_widget_set_margin_end (vbox, 30);
+       gtk_widget_set_margin_bottom (vbox, 12);
+       gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
 
        if (dlg->disable_save_to_disk)
        {


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