[gedit/wip/revamp-close-confirm-dialog: 7/7] CloseConfirmationDialog: make the content expandable



commit 6048abc1cc73b528d660ce10dfb462334c0a14a0
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Nov 28 14:24:38 2015 +0100

    CloseConfirmationDialog: make the content expandable
    
    It's a hack, it pokes at GtkMessageDialog internals... The purpose is to
    demonstrate that it is possible without a GTK+ change.
    
    Look at:
    https://bugzilla.gnome.org/show_bug.cgi?id=758776
    for a solution in GTK+.

 gedit/gedit-close-confirmation-dialog.c |   46 +++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-close-confirmation-dialog.c b/gedit/gedit-close-confirmation-dialog.c
index bf6cc0e..71d34af 100644
--- a/gedit/gedit-close-confirmation-dialog.c
+++ b/gedit/gedit-close-confirmation-dialog.c
@@ -479,6 +479,51 @@ create_list_box (GeditCloseConfirmationDialog *dlg)
 }
 
 static void
+make_content_expandable (GeditCloseConfirmationDialog *dlg)
+{
+       GtkWidget *content_area;
+       GtkWidget *widget;
+
+       content_area = gtk_dialog_get_content_area (GTK_DIALOG (dlg));
+
+       widget = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dlg));
+
+       while (widget != NULL && widget != content_area)
+       {
+               GtkWidget *parent;
+
+               parent = gtk_widget_get_parent (widget);
+
+               if (GTK_IS_BOX (parent))
+               {
+                       gboolean expand;
+                       gboolean fill;
+                       guint padding;
+                       GtkPackType pack_type;
+
+                       gtk_box_query_child_packing (GTK_BOX (parent),
+                                                    widget,
+                                                    &expand,
+                                                    &fill,
+                                                    &padding,
+                                                    &pack_type);
+
+                       expand = TRUE;
+                       fill = TRUE;
+
+                       gtk_box_set_child_packing (GTK_BOX (parent),
+                                                  widget,
+                                                  expand,
+                                                  fill,
+                                                  padding,
+                                                  pack_type);
+               }
+
+               widget = parent;
+       }
+}
+
+static void
 build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
 {
        GtkWidget *message_area;
@@ -492,6 +537,7 @@ build_multiple_docs_dialog (GeditCloseConfirmationDialog *dlg)
        add_buttons (dlg);
 
        gtk_window_set_resizable (GTK_WINDOW (dlg), TRUE);
+       make_content_expandable (dlg);
 
        /* Primary message */
        if (dlg->disable_save_to_disk)


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