[evolution/wip/webkit-composer: 237/372] EMailSignatureEditor: Subclass GtkWindow instead of EEditorWindow.
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 237/372] EMailSignatureEditor: Subclass GtkWindow instead of EEditorWindow.
- Date: Thu, 6 Feb 2014 11:43:26 +0000 (UTC)
commit 3f22b7cdd76bea135144ef45c5b1426e311c5e02
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Feb 8 12:30:54 2013 -0500
EMailSignatureEditor: Subclass GtkWindow instead of EEditorWindow.
e-util/e-mail-signature-editor.c | 66 ++++++++++++++++++++++++++++++++------
e-util/e-mail-signature-editor.h | 6 ++--
2 files changed, 59 insertions(+), 13 deletions(-)
---
diff --git a/e-util/e-mail-signature-editor.c b/e-util/e-mail-signature-editor.c
index 53f8380..59904e6 100644
--- a/e-util/e-mail-signature-editor.c
+++ b/e-util/e-mail-signature-editor.c
@@ -32,6 +32,7 @@
typedef struct _AsyncContext AsyncContext;
struct _EMailSignatureEditorPrivate {
+ EEditor *editor;
GtkActionGroup *action_group;
EFocusTracker *focus_tracker;
GCancellable *cancellable;
@@ -51,6 +52,7 @@ struct _AsyncContext {
enum {
PROP_0,
+ PROP_EDITOR,
PROP_FOCUS_TRACKER,
PROP_REGISTRY,
PROP_SOURCE
@@ -77,7 +79,7 @@ static const gchar *ui =
G_DEFINE_TYPE (
EMailSignatureEditor,
e_mail_signature_editor,
- E_TYPE_EDITOR_WINDOW)
+ GTK_TYPE_WINDOW)
static void
async_context_free (AsyncContext *async_context)
@@ -386,6 +388,13 @@ mail_signature_editor_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EDITOR:
+ g_value_set_object (
+ value,
+ e_mail_signature_editor_get_editor (
+ E_MAIL_SIGNATURE_EDITOR (object)));
+ return;
+
case PROP_FOCUS_TRACKER:
g_value_set_object (
value,
@@ -418,6 +427,11 @@ mail_signature_editor_dispose (GObject *object)
priv = E_MAIL_SIGNATURE_EDITOR_GET_PRIVATE (object);
+ if (priv->editor != NULL) {
+ g_object_unref (priv->editor);
+ priv->editor = NULL;
+ }
+
if (priv->action_group != NULL) {
g_object_unref (priv->action_group);
priv->action_group = NULL;
@@ -477,6 +491,7 @@ mail_signature_editor_constructed (GObject *object)
GtkAction *action;
GtkWidget *container;
GtkWidget *widget;
+ GtkWidget *hbox;
const gchar *display_name;
GError *error = NULL;
@@ -517,27 +532,45 @@ mail_signature_editor_constructed (GObject *object)
gtk_window_set_title (GTK_WINDOW (window), _("Edit Signature"));
- /* Construct the signature name entry. */
+ widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+ gtk_container_add (GTK_CONTAINER (window), widget);
+ gtk_widget_show (widget);
+
+ container = widget;
- container = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- e_editor_window_pack_above (E_EDITOR_WINDOW (window), container);
- gtk_widget_show (container);
+ /* 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 signature name entry. */
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
- e_editor_window_pack_above (E_EDITOR_WINDOW (window), widget);
+ gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
- container = widget;
+ hbox = widget;
widget = gtk_entry_new ();
- gtk_box_pack_end (GTK_BOX (container), widget, TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
window->priv->entry = widget; /* not referenced */
gtk_widget_show (widget);
widget = gtk_label_new_with_mnemonic (_("_Signature Name:"));
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), window->priv->entry);
- gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
+
+ /* Construct the main editing area. */
+
+ widget = GTK_WIDGET (editor);
+ gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
gtk_widget_show (widget);
g_signal_connect (
@@ -619,6 +652,17 @@ e_mail_signature_editor_class_init (EMailSignatureEditorClass *class)
g_object_class_install_property (
object_class,
+ PROP_EDITOR,
+ g_param_spec_object (
+ "editor",
+ NULL,
+ NULL,
+ E_TYPE_EDITOR,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
PROP_FOCUS_TRACKER,
g_param_spec_object (
"focus-tracker",
@@ -657,6 +701,8 @@ static void
e_mail_signature_editor_init (EMailSignatureEditor *editor)
{
editor->priv = E_MAIL_SIGNATURE_EDITOR_GET_PRIVATE (editor);
+
+ editor->priv->editor = g_object_ref_sink (e_editor_new ());
}
GtkWidget *
@@ -679,7 +725,7 @@ e_mail_signature_editor_get_editor (EMailSignatureEditor *editor)
{
g_return_val_if_fail (E_IS_MAIL_SIGNATURE_EDITOR (editor), NULL);
- return e_editor_window_get_editor (E_EDITOR_WINDOW (editor));
+ return editor->priv->editor;
}
EFocusTracker *
diff --git a/e-util/e-mail-signature-editor.h b/e-util/e-mail-signature-editor.h
index 43bb26e..0a1ef13 100644
--- a/e-util/e-mail-signature-editor.h
+++ b/e-util/e-mail-signature-editor.h
@@ -24,7 +24,7 @@
#include <libedataserver/libedataserver.h>
-#include <e-util/e-editor-window.h>
+#include <e-util/e-editor.h>
#include <e-util/e-focus-tracker.h>
/* Standard GObject macros */
@@ -53,12 +53,12 @@ typedef struct _EMailSignatureEditorClass EMailSignatureEditorClass;
typedef struct _EMailSignatureEditorPrivate EMailSignatureEditorPrivate;
struct _EMailSignatureEditor {
- EEditorWindow parent;
+ GtkWindow parent;
EMailSignatureEditorPrivate *priv;
};
struct _EMailSignatureEditorClass {
- EEditorWindowClass parent_class;
+ GtkWindowClass parent_class;
};
GType e_mail_signature_editor_get_type
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]