[evolution/wip/webkit-composer: 94/262] Bug #689797 - Picture gallery should be above message body
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 94/262] Bug #689797 - Picture gallery should be above message body
- Date: Thu, 16 Jan 2014 09:55:47 +0000 (UTC)
commit 51ba6ae06af5814c8d8a7b39eb411c117f44b9a7
Author: Dan Vrátil <dvratil redhat com>
Date: Thu Dec 6 23:09:00 2012 +0100
Bug #689797 - Picture gallery should be above message body
Converted EEditor from GtkBox to GtkGrid and added method to
insert widget between the EEditorWidget and toolbars.
composer/e-composer-private.c | 13 ++-----------
e-util/e-editor-private.h | 2 ++
e-util/e-editor-window.c | 19 +++++++++++++++++++
e-util/e-editor-window.h | 3 +++
e-util/e-editor.c | 36 +++++++++++++++++++++++++++++-------
e-util/e-editor.h | 7 +++++--
6 files changed, 60 insertions(+), 20 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 702ecca..3fc145e 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -244,15 +244,6 @@ 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),
@@ -260,9 +251,9 @@ 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);
- gtk_widget_show (widget);
+ container = priv->gallery_scrolled_window;
+ e_editor_window_pack_inside (E_EDITOR_WINDOW (composer), container);
/* Construct the picture gallery. */
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index 0144b8d..e62f825 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -92,6 +92,8 @@ struct _EEditorPrivate {
WebKitDOMNode *image;
WebKitDOMNode *table_cell;
+
+ int editor_layout_row;
};
void editor_actions_init (EEditor *editor);
diff --git a/e-util/e-editor-window.c b/e-util/e-editor-window.c
index 9b77aaf..cbf1005 100644
--- a/e-util/e-editor-window.c
+++ b/e-util/e-editor-window.c
@@ -210,3 +210,22 @@ e_editor_window_pack_below (EEditorWindow *window,
window->priv->main_layout, child,
NULL, GTK_POS_BOTTOM, 1, 1);
}
+
+/**
+ * e_editor_window_pack_inside:
+ * @window: an #EEditorWindow
+ * @child: a #GtkWidget
+ *
+ * Inserts @child between the editor's toolbars and the editor itself.
+ * If there are multiple children, the new @child is places at the end
+ * (immediatelly adjacent to the editor itself).
+ */
+void
+e_editor_window_pack_inside (EEditorWindow* window,
+ GtkWidget* child)
+{
+ g_return_if_fail (E_IS_EDITOR_WINDOW (window));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ e_editor_pack_above (e_editor_window_get_editor (window), child);
+}
diff --git a/e-util/e-editor-window.h b/e-util/e-editor-window.h
index bcd9e7a..f73acc0 100644
--- a/e-util/e-editor-window.h
+++ b/e-util/e-editor-window.h
@@ -72,6 +72,9 @@ EEditor * e_editor_window_get_editor (EEditorWindow *window);
void e_editor_window_pack_above (EEditorWindow *window,
GtkWidget *child);
+void e_editor_window_pack_inside (EEditorWindow *window,
+ GtkWidget *child);
+
void e_editor_window_pack_below (EEditorWindow *window,
GtkWidget *child);
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index f7aa0b4..ecbaf28 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -33,7 +33,7 @@
G_DEFINE_TYPE (
EEditor,
e_editor,
- GTK_TYPE_BOX);
+ GTK_TYPE_GRID);
/**
* EEditor:
@@ -586,14 +586,16 @@ editor_constructed (GObject *object)
/* Construct main window widgets. */
widget = e_editor_get_managed_widget (editor, "/edit-toolbar");
+ gtk_widget_set_hexpand (widget, TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
- gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+ gtk_grid_attach (GTK_GRID (editor), widget, 0, 0, 1, 1);
priv->edit_toolbar = g_object_ref (widget);
gtk_widget_show (widget);
widget = e_editor_get_managed_widget (editor, "/html-toolbar");
+ gtk_widget_set_hexpand (widget, TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
- gtk_box_pack_start (GTK_BOX (editor), widget, FALSE, FALSE, 0);
+ gtk_grid_attach (GTK_GRID (editor), widget, 0, 1, 1, 1);
priv->html_toolbar = g_object_ref (widget);
gtk_widget_show (widget);
@@ -603,7 +605,9 @@ editor_constructed (GObject *object)
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (
GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN);
- gtk_box_pack_start (GTK_BOX (editor), widget, TRUE, TRUE, 0);
+ gtk_widget_set_hexpand (widget, TRUE);
+ gtk_widget_set_vexpand (widget, TRUE);
+ gtk_grid_attach (GTK_GRID (editor), widget, 0, 2, 1, 1);
priv->scrolled_window = g_object_ref (widget);
gtk_widget_show (widget);
@@ -800,6 +804,7 @@ e_editor_init (EEditor *editor)
g_free (filename);
editor_actions_init (editor);
+ priv->editor_layout_row = 2;
}
/**
@@ -812,9 +817,7 @@ e_editor_init (EEditor *editor)
GtkWidget *
e_editor_new (void)
{
- return g_object_new (E_TYPE_EDITOR,
- "orientation", GTK_ORIENTATION_VERTICAL,
- NULL);
+ return g_object_new (E_TYPE_EDITOR, NULL);
}
/**
@@ -969,6 +972,25 @@ e_editor_set_filename (EEditor *editor,
}
/**
+ * e_editor_pack_above:
+ * @editor: an #EEditor
+ * @child: a #GtkWidget
+ *
+ * Inserts @child right between the toolbars and the editor widget itself.
+ */
+void
+e_editor_pack_above (EEditor* editor,
+ GtkWidget* child)
+{
+ g_return_if_fail (E_IS_EDITOR (editor));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ gtk_grid_insert_row (GTK_GRID (editor), editor->priv->editor_layout_row);
+ gtk_grid_attach (GTK_GRID (editor), child, 0, editor->priv->editor_layout_row, 1, 1);
+ editor->priv->editor_layout_row++;
+}
+
+/**
* e_editor_save:
* @editor: an #EEditor
* @filename: file into which to save the content
diff --git a/e-util/e-editor.h b/e-util/e-editor.h
index ab4b352..76e3c62 100644
--- a/e-util/e-editor.h
+++ b/e-util/e-editor.h
@@ -54,13 +54,13 @@ typedef struct _EEditorClass EEditorClass;
typedef struct _EEditorPrivate EEditorPrivate;
struct _EEditor {
- GtkBox parent;
+ GtkGrid parent;
EEditorPrivate *priv;
};
struct _EEditorClass {
- GtkBoxClass parent_class;
+ GtkGridClass parent_class;
void (*update_actions) (EEditor *editor,
GdkEventButton *event);
@@ -90,6 +90,9 @@ const gchar * e_editor_get_filename (EEditor *editor);
void e_editor_set_filename (EEditor *editor,
const gchar *filename);
+void e_editor_pack_above (EEditor *editor,
+ GtkWidget *child);
+
void e_editor_emit_spell_languages_changed
(EEditor *editor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]