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



commit dab82f043cd512637ca797e00e9a6e52b4ad2bd8
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 |   68 ++++++++++++++++++++++++++++++-----------
 composer/e-composer-private.h |    2 +
 composer/e-msg-composer.c     |    7 +++-
 composer/e-msg-composer.h     |    4 +-
 4 files changed, 59 insertions(+), 22 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 1c02fc1..4a72e42 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -202,31 +202,35 @@ 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);
+
        g_object_bind_property (
                editor_widget, "editable",
                widget, "sensitive",
                G_BINDING_SYNC_CREATE);
 
-       /* FIXME WEBKIT
-       if (small_screen_mode)
-               gtk_box_reorder_child (GTK_BOX (container), widget, 1);
-       else
-               gtk_box_reorder_child (GTK_BOX (container), widget, 2);
-       */
-       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);
@@ -235,6 +239,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. */
 
        if (small_screen_mode) {
@@ -244,7 +255,7 @@ e_composer_private_constructed (EMsgComposer *composer)
        }
 
        widget = e_attachment_paned_new ();
-       e_editor_window_pack_below (E_EDITOR_WINDOW (composer), widget);
+       gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
        priv->attachment_paned = g_object_ref (widget);
        gtk_widget_show (widget);
 
@@ -309,6 +320,15 @@ e_composer_private_constructed (EMsgComposer *composer)
                gtk_box_pack_end (GTK_BOX (container), tmp_box, FALSE, FALSE, 3);
        }
 
+       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),
@@ -316,9 +336,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. */
 
@@ -406,6 +433,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 af35ef8..1897096 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
@@ -2434,6 +2435,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 ());
 }
 
 /**
@@ -2467,7 +2470,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]