[evolution/webkit] Slightly nicer EAlertDialog after move to gtk3



commit 56bee7835e882e9add54aafa337bc32798b771e7
Author: Milan Crha <mcrha redhat com>
Date:   Tue Feb 15 19:19:41 2011 +0100

    Slightly nicer EAlertDialog after move to gtk3

 e-util/e-alert-dialog.c |   17 ++++++++++++-----
 mail/em-utils.c         |    3 +--
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-alert-dialog.c b/e-util/e-alert-dialog.c
index 1d1571c..f714574 100644
--- a/e-util/e-alert-dialog.c
+++ b/e-util/e-alert-dialog.c
@@ -120,6 +120,10 @@ alert_dialog_constructed (GObject *object)
 	PangoAttrList *list;
 	GList *actions;
 	const gchar *primary, *secondary;
+	gint min_width = -1, prefer_width = -1;
+
+	/* Chain up to parent's constructed() method. */
+	G_OBJECT_CLASS (e_alert_dialog_parent_class)->constructed (object);
 
 	dialog = E_ALERT_DIALOG (object);
 	alert = e_alert_dialog_get_alert (dialog);
@@ -159,7 +163,7 @@ alert_dialog_constructed (GObject *object)
 
 		gtk_box_pack_end (
 			GTK_BOX (action_area),
-			button, FALSE, TRUE, 0);
+			button, FALSE, FALSE, 0);
 
 		actions = g_list_next (actions);
 	}
@@ -171,7 +175,7 @@ alert_dialog_constructed (GObject *object)
 
 	widget = gtk_hbox_new (FALSE, 12);
 	gtk_container_set_border_width (GTK_CONTAINER (widget), 12);
-	gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (content_area), widget, FALSE, FALSE, 0);
 	gtk_widget_show (widget);
 
 	container = widget;
@@ -213,10 +217,13 @@ alert_dialog_constructed (GObject *object)
 	gtk_widget_set_can_focus (widget, FALSE);
 	gtk_widget_show (widget);
 
-	pango_attr_list_unref (list);
+	widget = GTK_WIDGET (dialog);
 
-	/* Chain up to parent's constructed() method. */
-	G_OBJECT_CLASS (e_alert_dialog_parent_class)->constructed (object);
+	gtk_widget_get_preferred_width_for_height (widget, gtk_widget_get_allocated_height (widget), &min_width, &prefer_width);
+	if (min_width < prefer_width)
+		gtk_window_set_default_size (GTK_WINDOW (dialog), MIN ((min_width + prefer_width) / 2, min_width * 5 / 4), -1);
+
+	pango_attr_list_unref (list);
 }
 
 static void
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ad75c48..cea8871 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -151,9 +151,8 @@ em_utils_prompt_user (GtkWindow *parent,
 
 	if (promptkey) {
 		check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again"));
-		gtk_container_set_border_width ((GtkContainer *)check, 12);
 		container = gtk_dialog_get_content_area (GTK_DIALOG (mbox));
-		gtk_box_pack_start (GTK_BOX (container), check, TRUE, TRUE, 0);
+		gtk_box_pack_start (GTK_BOX (container), check, FALSE, FALSE, 0);
 		gtk_widget_show (check);
 	}
 



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