[evolution/wip/webkit-composer: 239/372] EMsgComposer: Subclass GtkWindow instead of EEditorWindow.



commit 9e7a44463a90d345f42a96872dad889c424cf260
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 210373f..d4840f0 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -178,17 +178,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 (client_cache);
        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);
 
@@ -197,9 +207,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);
@@ -208,6 +215,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 ();
@@ -220,6 +234,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),
@@ -227,9 +250,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. */
 
@@ -317,6 +347,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 ae59254..abec841 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -57,6 +57,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 2395109..8fce777 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
 };
@@ -132,7 +133,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
@@ -2444,6 +2445,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 ());
 }
 
 /**
@@ -2477,7 +2480,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 82af452..6f18d31 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -56,12 +56,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]