[evolution/webkit: 122/134] Use GtkBox instead of GtkGrid in EMailDisplay



commit ac71dc259b70873ccc6a003c525e4f93e185353d
Author: Dan VrÃtil <dvratil redhat com>
Date:   Mon Nov 28 09:37:25 2011 +0100

    Use GtkBox instead of GtkGrid in EMailDisplay

 mail/e-mail-display.c |   45 ++++++++++++++++++++-------------------------
 1 files changed, 20 insertions(+), 25 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 793a498..fee7b9d 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -44,7 +44,7 @@
 #define d(x)
 
 struct _EMailDisplayPrivate {
-	GtkWidget *grid;
+	GtkWidget *box;
 
 	ESearchBar *searchbar;
 	EMFormatHTML *formatter;
@@ -489,7 +489,7 @@ mail_display_on_web_view_vadjustment_changed (GtkAdjustment* adjustment,
 	
 }
 
-static void
+static GtkWidget*
 mail_display_insert_web_view (EMailDisplay *display,
 			      EWebView *web_view)
 {
@@ -515,15 +515,10 @@ mail_display_insert_web_view (EMailDisplay *display,
 			  G_CALLBACK (mail_display_on_web_view_vadjustment_changed), scrolled_window);
 	gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
 
-	gtk_container_add (GTK_CONTAINER (display->priv->grid), scrolled_window);
+        gtk_box_pack_start (GTK_BOX (display->priv->box), scrolled_window, TRUE, TRUE, 0);
 	gtk_widget_show_all (scrolled_window);
 
-#if 0
-	g_object_set (G_OBJECT (web_view),
-		"expand", TRUE, NULL);
-	gtk_container_add (GTK_CONTAINER (display->priv->grid), GTK_WIDGET (web_view));
-	gtk_widget_show_all (GTK_WIDGET (web_view));
-#endif
+        return scrolled_window;
 }
 
 static void
@@ -547,7 +542,7 @@ mail_display_load_as_source (EMailDisplay *display,
 		NULL);
 	e_web_view_load_uri (web_view, uri);
 
-	gtk_widget_show_all (display->priv->grid);
+	gtk_widget_show_all (display->priv->box);
 }
 
 static void
@@ -560,7 +555,7 @@ mail_display_load_normal (EMailDisplay *display,
 	EAttachmentView *attachment_view;
 	gchar *uri;
 	GList *iter;
-	GtkContainer *grid;
+	GtkBox *box;
         gchar *start_part_id;
         GtkWidget *attachment_button;
 
@@ -578,8 +573,8 @@ mail_display_load_normal (EMailDisplay *display,
         attachment_view = NULL;
         attachment_button = NULL;
 
-	grid = GTK_CONTAINER (display->priv->grid);
-	gtk_widget_show (display->priv->grid);
+	box = GTK_BOX (display->priv->box);
+	gtk_widget_show (display->priv->box);
 
         /* If msg_uri contains part_id, then find it and start 'writing' from
          * this part_id. When there's no part_id or it's invalid, start from first
@@ -632,7 +627,7 @@ mail_display_load_normal (EMailDisplay *display,
 				continue;
 			}
 
-                        gtk_container_add (grid, widget);
+                        gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
 			
 			if (attachment_button) {
                                 g_object_bind_property (attachment_button, "expanded",
@@ -686,13 +681,14 @@ mail_display_load_normal (EMailDisplay *display,
 
 		if ((!puri->is_attachment && puri->write_func) || (puri->is_attachment && puri->write_func && puri->widget_func)) {
 
+                        GtkWidget *container;
 			web_view = mail_display_setup_webview (display);
-			mail_display_insert_web_view (display, web_view);
+			container = mail_display_insert_web_view (display, web_view);
 			e_web_view_load_uri (web_view, uri);
 
 			if (attachment_button) {
 				g_object_bind_property (widget, "expanded",
-					web_view, "visible", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+					container, "visible", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
                                 attachment_button = NULL;
 			}
 
@@ -775,10 +771,9 @@ mail_display_init (EMailDisplay *display)
 	display->priv = G_TYPE_INSTANCE_GET_PRIVATE (
 		display, E_TYPE_MAIL_DISPLAY, EMailDisplayPrivate);
 
-	display->priv->grid = g_object_new (GTK_TYPE_GRID,
-		"orientation", GTK_ORIENTATION_VERTICAL,
-		"margin", 10, NULL);
-	gtk_container_add (GTK_CONTAINER (display), display->priv->grid);
+	display->priv->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
+        gtk_container_set_reallocate_redraws (GTK_CONTAINER (display->priv->box), TRUE);
+	gtk_container_add (GTK_CONTAINER (display), display->priv->box);
 
 	display->priv->webviews = NULL;
 
@@ -1012,8 +1007,8 @@ e_mail_display_set_status (EMailDisplay *display,
 	e_mail_display_clear (display);
 
 	label = gtk_label_new (status);
-	gtk_container_add (GTK_CONTAINER (display->priv->grid), label);
-	gtk_widget_show_all (display->priv->grid);
+        gtk_box_pack_start (GTK_BOX (display->priv->box), label, TRUE, TRUE, 0);
+	gtk_widget_show_all (display->priv->box);
 }
 
 static void
@@ -1024,7 +1019,7 @@ remove_widget (GtkWidget *widget, gpointer user_data)
 	if (!GTK_IS_WIDGET (widget))
 		return;
 
-	gtk_container_remove  (GTK_CONTAINER (display->priv->grid), widget);
+	gtk_container_remove  (GTK_CONTAINER (display->priv->box), widget);
 }
 
 void
@@ -1032,9 +1027,9 @@ e_mail_display_clear (EMailDisplay *display)
 {
 	g_return_if_fail (E_IS_MAIL_DISPLAY (display));
 
-	gtk_widget_hide (display->priv->grid);
+	gtk_widget_hide (display->priv->box);
 
-	gtk_container_foreach (GTK_CONTAINER (display->priv->grid),
+	gtk_container_foreach (GTK_CONTAINER (display->priv->box),
 		(GtkCallback) remove_widget, display);
 
 	g_list_free (display->priv->webviews);



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