[evolution/webkit-composer: 178/185] EMsgComposer: Subclass GtkWindow instead of EEditorWindow.



commit a974d25d3db541d0a1fbe3c1dc8ae03f8ed98d1b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Feb 8 15:42:42 2013 -0500

    EMsgComposer: Subclass GtkWindow instead of EEditorWindow.

 composer/e-composer-private.c | 57 ++++++++++++++++++++++++++++++++++---------
 composer/e-composer-private.h |  2 ++
 composer/e-msg-composer.c     |  7 ++++--
 composer/e-msg-composer.h     |  4 +--
 4 files changed, 55 insertions(+), 15 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 636474f..743ce80 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -179,17 +179,27 @@ e_composer_private_constructed (EMsgComposer *composer)
 
        priv->focus_tracker = focus_tracker;
 
-       container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_widget_set_vexpand (container, FALSE);
-       gtk_widget_show (container);
-       e_editor_window_pack_above (E_EDITOR_WINDOW (composer), container);
+       widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+       gtk_container_add (GTK_CONTAINER (composer), widget);
+       gtk_widget_show (widget);
+
+       container = widget;
+
+       /* Construct the main menu and toolbar. */
+
+       widget = e_editor_get_managed_widget (editor, "/main-menu");
+       gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+       gtk_widget_show (widget);
+
+       widget = e_editor_get_managed_widget (editor, "/main-toolbar");
+       gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+       gtk_widget_show (widget);
 
        /* Construct the header table. */
 
        widget = e_composer_header_table_new (shell, registry);
        gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
-       gtk_widget_set_hexpand (widget, TRUE);
-       gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
        priv->header_table = g_object_ref (widget);
        gtk_widget_show (widget);
 
@@ -198,9 +208,6 @@ e_composer_private_constructed (EMsgComposer *composer)
                widget, "sensitive",
                G_BINDING_SYNC_CREATE);
 
-       priv->header_table = g_object_ref (widget);
-       gtk_widget_show (widget);
-
        header = e_composer_header_table_get_header (
                E_COMPOSER_HEADER_TABLE (widget),
                E_COMPOSER_HEADER_SUBJECT);
@@ -209,6 +216,13 @@ e_composer_private_constructed (EMsgComposer *composer)
                header->input_widget, "spell-checker",
                G_BINDING_SYNC_CREATE);
 
+       /* Construct the editing toolbars.  We'll have to reparent
+        * the embedded EEditorWidget a little further down. */
+
+       widget = GTK_WIDGET (editor);
+       gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
+       gtk_widget_show (widget);
+
        /* Construct the attachment paned. */
 
        widget = e_attachment_paned_new ();
@@ -221,6 +235,15 @@ e_composer_private_constructed (EMsgComposer *composer)
                widget, "sensitive",
                G_BINDING_SYNC_CREATE);
 
+       container = e_attachment_paned_get_content_area (
+               E_ATTACHMENT_PANED (priv->attachment_paned));
+
+       widget = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
+       gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
+       gtk_widget_show (widget);
+
+       container = widget;
+
        widget = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (
                GTK_SCROLLED_WINDOW (widget),
@@ -228,9 +251,16 @@ e_composer_private_constructed (EMsgComposer *composer)
        gtk_scrolled_window_set_shadow_type (
                GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
        gtk_widget_set_size_request (widget, -1, GALLERY_INITIAL_HEIGHT);
+       gtk_paned_pack1 (GTK_PANED (container), widget, FALSE, FALSE);
        priv->gallery_scrolled_window = g_object_ref (widget);
-       container = priv->gallery_scrolled_window;
-       e_editor_window_pack_inside (E_EDITOR_WINDOW (composer), container);
+       gtk_widget_show (widget);
+
+       /* Reparent the scrolled window containing the web view
+        * widget into the content area of the top attachment pane. */
+
+       widget = GTK_WIDGET (editor_widget);
+       widget = gtk_widget_get_parent (widget);
+       gtk_widget_reparent (widget, container);
 
        /* Construct the picture gallery. */
 
@@ -318,6 +348,11 @@ e_composer_private_dispose (EMsgComposer *composer)
                composer->priv->shell = NULL;
        }
 
+       if (composer->priv->editor != NULL) {
+               g_object_unref (composer->priv->editor);
+               composer->priv->editor = NULL;
+       }
+
        if (composer->priv->header_table != NULL) {
                g_object_unref (composer->priv->header_table);
                composer->priv->header_table = NULL;
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 5e61c9f..4ad4f29 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -58,6 +58,8 @@ struct _EMsgComposerPrivate {
 
        gpointer shell;  /* weak pointer */
 
+       EEditor *editor;
+
        /*** UI Management ***/
 
        GtkWidget *header_table;
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index ad33139..d27022d 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -86,6 +86,7 @@ typedef enum {
 
 enum {
        PROP_0,
+       PROP_EDITOR,
        PROP_FOCUS_TRACKER,
        PROP_SHELL
 };
@@ -128,7 +129,7 @@ static void handle_multipart_signed         (EMsgComposer *composer,
 G_DEFINE_TYPE_WITH_CODE (
        EMsgComposer,
        e_msg_composer,
-       E_TYPE_EDITOR_WINDOW,
+       GTK_TYPE_WINDOW,
        G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
 
 static void
@@ -2427,6 +2428,8 @@ static void
 e_msg_composer_init (EMsgComposer *composer)
 {
        composer->priv = E_MSG_COMPOSER_GET_PRIVATE (composer);
+
+       composer->priv->editor = g_object_ref_sink (e_editor_new ());
 }
 
 /**
@@ -2460,7 +2463,7 @@ e_msg_composer_get_editor (EMsgComposer *composer)
 {
        g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
 
-       return e_editor_window_get_editor (E_EDITOR_WINDOW (composer));
+       return composer->priv->editor;
 }
 
 EFocusTracker *
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index f945be5..4eb8682 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -57,12 +57,12 @@ typedef struct _EMsgComposerClass EMsgComposerClass;
 typedef struct _EMsgComposerPrivate EMsgComposerPrivate;
 
 struct _EMsgComposer {
-       EEditorWindow parent;
+       GtkWindow parent;
        EMsgComposerPrivate *priv;
 };
 
 struct _EMsgComposerClass {
-       EEditorWindowClass parent_class;
+       GtkWindowClass parent_class;
 
        /* Signals */
        gboolean        (*presend)              (EMsgComposer *composer);


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