[evolution/wip/webkit-composer: 158/372] Add documentation to basic classes and update copyright
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 158/372] Add documentation to basic classes and update copyright
- Date: Thu, 6 Feb 2014 11:36:47 +0000 (UTC)
commit 491b5a3775ad53579227ccde698aa454e347fdc0
Author: Dan Vrátil <dvratil redhat com>
Date: Sun Dec 2 14:54:21 2012 +0100
Add documentation to basic classes and update copyright
Add documentation to EEditor, EEditorSelection, EEditorWidget and
EEditorWindow.
Add copyright to all source files.
e-util/e-color-chooser-widget.c | 11 +-
e-util/e-color-chooser-widget.h | 4 +-
e-util/e-color-combo.c | 2 +
e-util/e-color-combo.h | 2 +
e-util/e-editor-actions.c | 2 +
e-util/e-editor-actions.h | 3 +
e-util/e-editor-cell-dialog.c | 10 +-
e-util/e-editor-cell-dialog.h | 2 +
e-util/e-editor-dialog.c | 2 +
e-util/e-editor-dialog.h | 2 +
e-util/e-editor-find-dialog.c | 2 +
e-util/e-editor-find-dialog.h | 2 +
e-util/e-editor-hrule-dialog.c | 7 +-
e-util/e-editor-hrule-dialog.h | 2 +
e-util/e-editor-image-dialog.c | 2 +
e-util/e-editor-image-dialog.h | 2 +
e-util/e-editor-link-dialog.c | 9 +-
e-util/e-editor-link-dialog.h | 2 +
e-util/e-editor-page-dialog.c | 4 +-
e-util/e-editor-page-dialog.h | 2 +
e-util/e-editor-paragraph-dialog.c | 2 +
e-util/e-editor-paragraph-dialog.h | 2 +
e-util/e-editor-private.h | 5 +-
e-util/e-editor-replace-dialog.c | 2 +
e-util/e-editor-replace-dialog.h | 2 +
e-util/e-editor-selection.c | 707 +++++++++++++++++++++++++++-------
e-util/e-editor-selection.h | 8 +-
e-util/e-editor-spell-check-dialog.c | 7 +-
e-util/e-editor-spell-check-dialog.h | 5 +-
e-util/e-editor-table-dialog.c | 4 +-
e-util/e-editor-table-dialog.h | 2 +
e-util/e-editor-text-dialog.c | 2 +
e-util/e-editor-text-dialog.h | 2 +
e-util/e-editor-utils.c | 26 ++
e-util/e-editor-utils.h | 2 +
e-util/e-editor-widget.c | 382 +++++++++++++++++--
e-util/e-editor-widget.h | 115 ++++++
e-util/e-editor-window.c | 44 ++-
e-util/e-editor-window.h | 2 +
e-util/e-editor.c | 80 ++++-
e-util/e-editor.h | 5 +-
e-util/e-emoticon-action.c | 6 +-
e-util/e-emoticon-action.h | 6 +-
e-util/e-emoticon-chooser-menu.c | 6 +-
e-util/e-emoticon-chooser-menu.h | 6 +-
e-util/e-emoticon-chooser.c | 6 +-
e-util/e-emoticon-chooser.h | 6 +-
e-util/e-emoticon-tool-button.c | 6 +-
e-util/e-emoticon-tool-button.h | 6 +-
e-util/e-emoticon.c | 6 +-
e-util/e-emoticon.h | 6 +-
e-util/e-image-chooser-dialog.c | 2 +
e-util/e-image-chooser-dialog.h | 2 +
e-util/test-editor.c | 2 +
54 files changed, 1348 insertions(+), 198 deletions(-)
---
diff --git a/e-util/e-color-chooser-widget.c b/e-util/e-color-chooser-widget.c
index 18339f5..7cc0b06 100644
--- a/e-util/e-color-chooser-widget.c
+++ b/e-util/e-color-chooser-widget.c
@@ -1,6 +1,8 @@
-
+
/* e-color-chooser-widget.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
@@ -29,6 +31,13 @@ G_DEFINE_TYPE (
e_color_chooser_widget,
GTK_TYPE_COLOR_CHOOSER_WIDGET);
+/**
+ * EColorChooserWidget:
+ *
+ * This widget wrapps around #GtkColorChooserWidget and allows the widget to be
+ * used as a delegate for #GtkComboBox for instance.
+ */
+
struct _EColorChooserWidgetPrivate {
gboolean showing_editor;
};
diff --git a/e-util/e-color-chooser-widget.h b/e-util/e-color-chooser-widget.h
index b68062c..5960542 100644
--- a/e-util/e-color-chooser-widget.h
+++ b/e-util/e-color-chooser-widget.h
@@ -1,5 +1,7 @@
/* e-color-chooser-widget.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
@@ -68,4 +70,4 @@ GtkWidget * e_color_chooser_widget_new (void);
G_END_DECLS
#endif /* E_COLOR_CHOOSER_WIDGET_H */
-
+
diff --git a/e-util/e-color-combo.c b/e-util/e-color-combo.c
index f426aef..53584be 100644
--- a/e-util/e-color-combo.c
+++ b/e-util/e-color-combo.c
@@ -1,5 +1,7 @@
/* e-color-combo.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/e-color-combo.h b/e-util/e-color-combo.h
index 1b90a35..265d1ee 100644
--- a/e-util/e-color-combo.h
+++ b/e-util/e-color-combo.h
@@ -1,5 +1,7 @@
/* e-color-combo.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/e-editor-actions.c b/e-util/e-editor-actions.c
index 678bf17..01b87ac 100644
--- a/e-util/e-editor-actions.c
+++ b/e-util/e-editor-actions.c
@@ -1,5 +1,7 @@
/* e-editor-actions.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/e-editor-actions.h b/e-util/e-editor-actions.h
index 7c1bb2e..4d50ac7 100644
--- a/e-util/e-editor-actions.h
+++ b/e-util/e-editor-actions.h
@@ -1,4 +1,7 @@
/* e-editor-actions.h
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/e-editor-cell-dialog.c b/e-util/e-editor-cell-dialog.c
index ba21ec5..13640e3 100644
--- a/e-util/e-editor-cell-dialog.c
+++ b/e-util/e-editor-cell-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-cell-dialog.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -15,7 +17,7 @@
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
-
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -598,7 +600,7 @@ e_editor_cell_dialog_init (EEditorCellDialog *dialog)
g_signal_connect_swapped (
widget, "toggled",
- G_CALLBACK (editor_cell_dialog_set_scope), dialog);
+ G_CALLBACK (editor_cell_dialog_set_scope), dialog);
/* Scope: row */
widget = gtk_image_new_from_icon_name ("stock_select-row", GTK_ICON_SIZE_BUTTON);
@@ -611,7 +613,7 @@ e_editor_cell_dialog_init (EEditorCellDialog *dialog)
g_signal_connect_swapped (
widget, "toggled",
- G_CALLBACK (editor_cell_dialog_set_scope), dialog);
+ G_CALLBACK (editor_cell_dialog_set_scope), dialog);
/* Scope: table */
widget = gtk_image_new_from_icon_name ("stock_select-table", GTK_ICON_SIZE_BUTTON);
@@ -624,7 +626,7 @@ e_editor_cell_dialog_init (EEditorCellDialog *dialog)
g_signal_connect_swapped (
widget, "toggled",
- G_CALLBACK (editor_cell_dialog_set_scope), dialog);
+ G_CALLBACK (editor_cell_dialog_set_scope), dialog);
/* Scope: column */
widget = gtk_image_new_from_icon_name ("stock_select-column", GTK_ICON_SIZE_BUTTON);
diff --git a/e-util/e-editor-cell-dialog.h b/e-util/e-editor-cell-dialog.h
index 2ea9514..62a4009 100644
--- a/e-util/e-editor-cell-dialog.h
+++ b/e-util/e-editor-cell-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-cell-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-dialog.c b/e-util/e-editor-dialog.c
index 0adfa56..22a303e 100644
--- a/e-util/e-editor-dialog.c
+++ b/e-util/e-editor-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-dialog.h b/e-util/e-editor-dialog.h
index 6f305fd..cfa44c0 100644
--- a/e-util/e-editor-dialog.h
+++ b/e-util/e-editor-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-find-dialog.c b/e-util/e-editor-find-dialog.c
index ae28732..3499652 100644
--- a/e-util/e-editor-find-dialog.c
+++ b/e-util/e-editor-find-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-find-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-find-dialog.h b/e-util/e-editor-find-dialog.h
index 633318b..66a1556 100644
--- a/e-util/e-editor-find-dialog.h
+++ b/e-util/e-editor-find-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-find-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-hrule-dialog.c b/e-util/e-editor-hrule-dialog.c
index 1c572a5..bca6b20 100644
--- a/e-util/e-editor-hrule-dialog.c
+++ b/e-util/e-editor-hrule-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-hrule-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -22,6 +24,7 @@
#include "e-editor-hrule-dialog.h"
#include "e-editor-utils.h"
+#include "e-editor-widget.h"
#include <glib/gi18n-lib.h>
#include <webkit/webkitdom.h>
@@ -231,8 +234,8 @@ editor_hrule_dialog_show (GtkWidget *widget)
}
if (!rule) {
- webkit_dom_document_exec_command (
- document, "insertHorizontalRule", FALSE, "");
+ e_editor_widget_exec_command (
+ editor_widget, E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE, NULL);
rule = e_editor_dom_node_find_child_element (
webkit_dom_range_get_start_container (range, NULL), "HR");
diff --git a/e-util/e-editor-hrule-dialog.h b/e-util/e-editor-hrule-dialog.h
index d36b589..46877f7 100644
--- a/e-util/e-editor-hrule-dialog.h
+++ b/e-util/e-editor-hrule-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-hrule-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-image-dialog.c b/e-util/e-editor-image-dialog.c
index 0004e8d..8f7288d 100644
--- a/e-util/e-editor-image-dialog.c
+++ b/e-util/e-editor-image-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-image-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-image-dialog.h b/e-util/e-editor-image-dialog.h
index c6fdaa5..21f7a93 100644
--- a/e-util/e-editor-image-dialog.h
+++ b/e-util/e-editor-image-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-image-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-link-dialog.c b/e-util/e-editor-link-dialog.c
index 6fe9945..ea75db8 100644
--- a/e-util/e-editor-link-dialog.c
+++ b/e-util/e-editor-link-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-link-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -23,6 +25,7 @@
#include "e-editor-link-dialog.h"
#include "e-editor-selection.h"
#include "e-editor-utils.h"
+#include "e-editor-widget.h"
#include <glib/gi18n-lib.h>
@@ -166,8 +169,8 @@ editor_link_dialog_ok (EEditorLinkDialog *dialog)
gtk_entry_get_text (
GTK_ENTRY (dialog->priv->label_edit)));
- webkit_dom_document_exec_command (
- document, "insertHTML", FALSE, html);
+ e_editor_widget_exec_command (
+ widget, E_EDITOR_WIDGET_COMMAND_INSERT_HTML, html);
g_free (html);
@@ -334,7 +337,7 @@ e_editor_link_dialog_init (EEditorLinkDialog *dialog)
G_CALLBACK (editor_link_dialog_description_changed), dialog);
g_signal_connect_swapped (
widget, "key-press-event",
- G_CALLBACK (editor_link_dialog_entry_key_pressed), dialog);
+ G_CALLBACK (editor_link_dialog_entry_key_pressed), dialog);
dialog->priv->label_edit = widget;
widget = gtk_label_new_with_mnemonic (_("_Description:"));
diff --git a/e-util/e-editor-link-dialog.h b/e-util/e-editor-link-dialog.h
index 8f0ea49..921d718 100644
--- a/e-util/e-editor-link-dialog.h
+++ b/e-util/e-editor-link-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-link-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-page-dialog.c b/e-util/e-editor-page-dialog.c
index 0ce56a4..a5681e3 100644
--- a/e-util/e-editor-page-dialog.c
+++ b/e-util/e-editor-page-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-page-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -417,7 +419,7 @@ e_editor_page_dialog_init (EEditorPageDialog *dialog)
dialog->priv->text_color_picker = widget;
widget = gtk_label_new_with_mnemonic (_("_Text:"));
- gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
+ gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
gtk_label_set_mnemonic_widget (
GTK_LABEL (widget), dialog->priv->text_color_picker);
gtk_grid_attach (grid, widget, 0, 0, 1, 1);
diff --git a/e-util/e-editor-page-dialog.h b/e-util/e-editor-page-dialog.h
index 21a6399..145a092 100644
--- a/e-util/e-editor-page-dialog.h
+++ b/e-util/e-editor-page-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-page-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-paragraph-dialog.c b/e-util/e-editor-paragraph-dialog.c
index 7b4327f..477ce10 100644
--- a/e-util/e-editor-paragraph-dialog.c
+++ b/e-util/e-editor-paragraph-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-text-dialog.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-paragraph-dialog.h b/e-util/e-editor-paragraph-dialog.h
index cadd32d..1c8f0e7 100644
--- a/e-util/e-editor-paragraph-dialog.h
+++ b/e-util/e-editor-paragraph-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-paragraph-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index f04b1b2..0144b8d 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -1,4 +1,7 @@
-/* e-editor-private.h
+/*
+ * e-editor-private.h
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-editor-replace-dialog.c b/e-util/e-editor-replace-dialog.c
index 52df61a..fbf7771 100644
--- a/e-util/e-editor-replace-dialog.c
+++ b/e-util/e-editor-replace-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-replace-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-replace-dialog.h b/e-util/e-editor-replace-dialog.h
index 8912751..f6c80ee 100644
--- a/e-util/e-editor-replace-dialog.h
+++ b/e-util/e-editor-replace-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-replace-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index f370e62..d374782 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -1,6 +1,8 @@
/*
* e-editor-selection.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -21,6 +23,7 @@
#endif
#include "e-editor-selection.h"
+#include "e-editor-widget.h"
#include "e-editor.h"
#include "e-editor-utils.h"
@@ -39,6 +42,20 @@
#define WORD_WRAP_LENGTH 71
+G_DEFINE_TYPE (
+ EEditorSelection,
+ e_editor_selection,
+ G_TYPE_OBJECT
+);
+
+/**
+ * EEditorSelection:
+ *
+ * The #EEditorSelection object represents current position of the cursor
+ * with the editor or current text selection within the editor. To obtain
+ * valid #EEditorSelection, call #e_editor_widget_get_selection().
+ */
+
struct _EEditorSelectionPrivate {
WebKitWebView *webview;
@@ -51,15 +68,9 @@ struct _EEditorSelectionPrivate {
gulong selection_offset;
};
-G_DEFINE_TYPE (
- EEditorSelection,
- e_editor_selection,
- G_TYPE_OBJECT
-);
-
enum {
PROP_0,
- PROP_WEBVIEW,
+ PROP_EDITOR_WIDGET,
PROP_ALIGNMENT,
PROP_BACKGROUND_COLOR,
PROP_BOLD,
@@ -214,12 +225,12 @@ webview_selection_changed (WebKitWebView *webview,
}
static void
-editor_selection_set_webview (EEditorSelection *selection,
- WebKitWebView *webview)
+editor_selection_set_editor_widget (EEditorSelection *selection,
+ EEditorWidget *editor_widget)
{
- selection->priv->webview = g_object_ref (webview);
+ selection->priv->webview = g_object_ref (E_EDITOR_WIDGET (editor_widget));
g_signal_connect (
- webview, "selection-changed",
+ editor_widget, "selection-changed",
G_CALLBACK (webview_selection_changed), selection);
}
@@ -322,8 +333,8 @@ e_editor_selection_set_property (GObject *object,
EEditorSelection *selection = E_EDITOR_SELECTION (object);
switch (property_id) {
- case PROP_WEBVIEW:
- editor_selection_set_webview (
+ case PROP_EDITOR_WIDGET:
+ editor_selection_set_editor_widget (
selection, g_value_get_object (value));
return;
@@ -421,14 +432,21 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
g_object_class_install_property (
object_class,
- PROP_WEBVIEW,
+ PROP_EDITOR_WIDGET,
g_param_spec_object (
- "webview",
+ "editor-widget",
NULL,
NULL,
- WEBKIT_TYPE_WEB_VIEW,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-
+ E_TYPE_EDITOR_WIDGET,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
+ * EEditorSelection:alignment
+ *
+ * Holds alignment of current paragraph.
+ */
+ /* FIXME: Convert the enum to a proper type */
g_object_class_install_property (
object_class,
PROP_ALIGNMENT,
@@ -441,6 +459,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
E_EDITOR_SELECTION_ALIGNMENT_LEFT,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:background-color
+ *
+ * Holds background color of current selection or at current cursor
+ * position.
+ */
g_object_class_install_property (
object_class,
PROP_BACKGROUND_COLOR,
@@ -451,6 +475,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
NULL,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:bold
+ *
+ * Holds whether current selection or text at current cursor position
+ * is bold.
+ */
g_object_class_install_property (
object_class,
PROP_BOLD,
@@ -461,6 +491,11 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:font-name
+ *
+ * Holds name of font in current selection or at current cursor position.
+ */
g_object_class_install_property (
object_class,
PROP_FONT_NAME,
@@ -471,6 +506,11 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
NULL,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:font-size
+ *
+ * Holds point size of current selection or at current cursor position.
+ */
g_object_class_install_property (
object_class,
PROP_FONT_SIZE,
@@ -483,6 +523,11 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
3,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:font-color
+ *
+ * Holds font color of current selection or at current cursor position
+ */
g_object_class_install_property (
object_class,
PROP_FONT_COLOR,
@@ -493,6 +538,13 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
GDK_TYPE_RGBA,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:block-format
+ *
+ * Holds block format of current paragraph. See #EEditorSelectionBlockFormat
+ * for valid values.
+ */
+ /* FIXME: Convert the EEditorSelectionBlockFormat enum to a propert type */
g_object_class_install_property (
object_class,
PROP_BLOCK_FORMAT,
@@ -505,6 +557,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
0,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:indented
+ *
+ * Holds whether current paragraph is indented. This does not include
+ * citations.
+ */
g_object_class_install_property (
object_class,
PROP_INDENTED,
@@ -515,6 +573,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorSelection:italic
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is italic.
+ */
g_object_class_install_property (
object_class,
PROP_ITALIC,
@@ -525,6 +589,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:monospaced
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is monospaced.
+ */
g_object_class_install_property (
object_class,
PROP_MONOSPACED,
@@ -535,6 +605,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:strike-through
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is strike-through.
+ */
g_object_class_install_property (
object_class,
PROP_STRIKE_THROUGH,
@@ -545,6 +621,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:superscript
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is in superscript.
+ */
g_object_class_install_property (
object_class,
PROP_SUPERSCRIPT,
@@ -555,6 +637,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:subscript
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is in subscript.
+ */
g_object_class_install_property (
object_class,
PROP_SUBSCRIPT,
@@ -565,6 +653,11 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorSelection:text
+ *
+ * Holds always up-to-date text of current selection.
+ */
g_object_class_install_property (
object_class,
PROP_TEXT,
@@ -575,6 +668,12 @@ e_editor_selection_class_init (EEditorSelectionClass *klass)
NULL,
G_PARAM_READABLE));
+ /**
+ * EEditorSelection:underline
+ *
+ * Holds whether current selection or letter at current cursor position
+ * is underlined.
+ */
g_object_class_install_property (
object_class,
PROP_UNDERLINE,
@@ -593,16 +692,14 @@ e_editor_selection_init (EEditorSelection *selection)
selection->priv = E_EDITOR_SELECTION_GET_PRIVATE (selection);
}
-EEditorSelection *
-e_editor_selection_new (WebKitWebView *parent_view)
-{
- g_return_val_if_fail (WEBKIT_IS_WEB_VIEW (parent_view), NULL);
-
- return g_object_new (
- E_TYPE_EDITOR_SELECTION,
- "webview", parent_view, NULL);
-}
-
+/**
+ * e_editor_selection_has_text:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection contains any text.
+ *
+ * Returns: @TRUE when current selection contains text, @FALSE otherwise.
+ */
gboolean
e_editor_selection_has_text (EEditorSelection *selection)
{
@@ -644,6 +741,15 @@ e_editor_selection_has_text (EEditorSelection *selection)
return FALSE;
}
+/**
+ * e_editor_selection_get_caret_word:
+ * @selection: an #EEditorSelection
+ *
+ * Returns word under cursor.
+ *
+ * Returns: A newly allocated string with current caret word or @NULL when there
+ * is no text under cursor or when selection is active. [transfer-full].
+ */
gchar *
e_editor_selection_get_caret_word (EEditorSelection *selection)
{
@@ -660,6 +766,13 @@ e_editor_selection_get_caret_word (EEditorSelection *selection)
return webkit_dom_range_to_string (range, NULL);
}
+/**
+ * e_editor_selection_replace_caret_word:
+ * @selection: an #EEditorSelection
+ * @replacement: a string to replace current caret word with
+ *
+ * Replaces current word under cursor with @replacement.
+ */
void
e_editor_selection_replace_caret_word (EEditorSelection *selection,
const gchar *replacement)
@@ -683,6 +796,15 @@ e_editor_selection_replace_caret_word (EEditorSelection *selection,
e_editor_selection_insert_html (selection, replacement);
}
+/**
+ * e_editor_selection_get_string:
+ * @selection: an #EEditorSelection
+ *
+ * Returns currently selected string.
+ *
+ * Returns: A pointer to content of current selection. The string is owned by
+ * #EEditorSelection and should not be free'd.
+ */
const gchar *
e_editor_selection_get_string (EEditorSelection *selection)
{
@@ -698,6 +820,13 @@ e_editor_selection_get_string (EEditorSelection *selection)
return selection->priv->text;
}
+/**
+ * e_editor_selection_replace:
+ * @selection: an #EEditorSelection
+ * @new_string: a string to replace current selection with
+ *
+ * Replaces currently selected text with @new_string.
+ */
void
e_editor_selection_replace (EEditorSelection *selection,
const gchar *new_string)
@@ -716,6 +845,14 @@ e_editor_selection_replace (EEditorSelection *selection,
webkit_dom_range_insert_node (range, WEBKIT_DOM_NODE (frag), NULL);
}
+/**
+ * e_editor_selection_get_alignment:
+ * @selection: #an EEditorSelection
+ *
+ * Returns alignment of current paragraph
+ *
+ * Returns: #EEditorSelectionAlignment
+ */
EEditorSelectionAlignment
e_editor_selection_get_alignment (EEditorSelection *selection)
{
@@ -766,12 +903,18 @@ e_editor_selection_get_alignment (EEditorSelection *selection)
return alignment;
}
+/**
+ * e_editor_selection_set_alignment:
+ * @selection: an #EEditorSelection
+ * @alignment: an #EEditorSelectionAlignment value to apply
+ *
+ * Sets alignment of current paragraph to give @alignment.
+ */
void
e_editor_selection_set_alignment (EEditorSelection *selection,
EEditorSelectionAlignment alignment)
{
- WebKitDOMDocument *document;
- const gchar *command;
+ EEditorWidgetCommand command;
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
@@ -781,27 +924,35 @@ e_editor_selection_set_alignment (EEditorSelection *selection,
switch (alignment) {
case E_EDITOR_SELECTION_ALIGNMENT_CENTER:
- command = "justifyCenter";
+ command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER;
break;
case E_EDITOR_SELECTION_ALIGNMENT_LEFT:
- command = "justifyLeft";
+ command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT;
break;
case E_EDITOR_SELECTION_ALIGNMENT_RIGHT:
- command = "justifyRight";
+ command = E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT;
break;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, command, FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview), command, NULL);
g_object_notify (G_OBJECT (selection), "alignment");
}
-
+/**
+ * e_editor_selection_get_background_color:
+ * @selection: an #EEditorSelection
+ *
+ * Returns background color of currently selected text or letter at current
+ * cursor position.
+ *
+ * Returns: A string with code of current background color.
+ */
const gchar *
-e_editor_selection_get_background_color (EEditorSelection *selection)
+e_editor_selection_get_background_color (EEditorSelection *selection)
{
WebKitDOMNode *ancestor;
WebKitDOMRange *range;
@@ -821,22 +972,36 @@ e_editor_selection_get_background_color (EEditorSelection *selection)
return selection->priv->background_color;
}
+/**
+ * e_editor_selection_set_background_color:
+ * @selection: an #EEditorSelection
+ * @color: code of new background color to set
+ *
+ * Changes background color of current selection or letter at current cursor
+ * position to @color.
+ */
void
e_editor_selection_set_background_color (EEditorSelection *selection,
const gchar *color)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
g_return_if_fail (color && *color);
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (
- document, "backColor", FALSE, color);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR, color);
g_object_notify (G_OBJECT (selection), "background-color");
}
+/**
+ * e_editor_selection_get_block_format:
+ * @selection: an #EEditorSelection
+ *
+ * Returns block format of current paragraph.
+ *
+ * Returns: #EEditorSelectionBlockFormat
+ */
EEditorSelectionBlockFormat
e_editor_selection_get_block_format (EEditorSelection *selection)
{
@@ -901,13 +1066,19 @@ e_editor_selection_get_block_format (EEditorSelection *selection)
return result;
}
+/**
+ * e_editor_selection_set_block_format:
+ * @selection: an #EEditorSelection
+ * @format: an #EEditorSelectionBlockFormat value
+ *
+ * Changes block format of current paragraph to @format.
+ */
void
e_editor_selection_set_block_format (EEditorSelection *selection,
EEditorSelectionBlockFormat format)
{
EEditorSelectionBlockFormat current_format;
- WebKitDOMDocument *document;
- const gchar *command;
+ EEditorWidgetCommand command;
const gchar *value;
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
@@ -917,80 +1088,80 @@ e_editor_selection_set_block_format (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
-
switch (format) {
case E_EDITOR_SELECTION_BLOCK_FORMAT_BLOCKQUOTE:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "BLOCKQUOTE";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H1:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H1";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H2:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H2";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H3:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H3";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H4:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H4";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H5:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H5";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_H6:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "H6";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "P";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_PRE:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "PRE";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_ADDRESS:
- command = "formatBlock";
+ command = E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK;
value = "ADDRESS";
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST:
case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA:
case E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ROMAN:
- command = "insertOrderedList";
- value = "";
+ command = E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST;
+ value = NULL;
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST:
- command = "insertUnorderedList";
- value = "";
+ command = E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST;
+ value = NULL;
break;
case E_EDITOR_SELECTION_BLOCK_FORMAT_NONE:
default:
- command = "removeFormat";
- value = "";
+ command = E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT;
+ value = NULL;
break;
}
/* First remove (un)ordered list before changing formatting */
if (current_format == E_EDITOR_SELECTION_BLOCK_FORMAT_UNORDERED_LIST) {
- webkit_dom_document_exec_command (
- document, "insertUnorderedList", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST, NULL);
/* ^-- not a typo, "insert" toggles the formatting
* if already present */
} else if (current_format >= E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST) {
- webkit_dom_document_exec_command (
- document, "insertOrderedList", FALSE ,"");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST, NULL);
}
- webkit_dom_document_exec_command (
- document, command, FALSE, value);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview), command, value);
/* Fine tuning - set the specific marker type for ordered lists */
if ((format == E_EDITOR_SELECTION_BLOCK_FORMAT_ORDERED_LIST_ALPHA) ||
@@ -1018,7 +1189,14 @@ e_editor_selection_set_block_format (EEditorSelection *selection,
g_object_notify (G_OBJECT (selection), "block-format");
}
-
+/**
+ * e_editor_selection_get_font_color:
+ * @selection: an #EEditorSelection
+ * @rgba:[out] a #GdkRGBA object to be set to current font color
+ *
+ * Sets @rgba to contain color of current text selection or letter at current
+ * cursor position.
+ */
void
e_editor_selection_get_font_color (EEditorSelection *selection,
GdkRGBA *rgba)
@@ -1036,11 +1214,18 @@ e_editor_selection_get_font_color (EEditorSelection *selection,
g_free (color);
}
+/**
+ * e_editor_selection_set_font_color:
+ * @selection: an #EEditorSelection
+ * @rgba: a #GdkRGBA
+ *
+ * Sets font color of current selection or letter at current cursor position to
+ * color defined in @rgba.
+ */
void
e_editor_selection_set_font_color (EEditorSelection *selection,
const GdkRGBA *rgba)
{
- WebKitDOMDocument *document;
gchar *color;
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
@@ -1051,14 +1236,24 @@ e_editor_selection_set_font_color (EEditorSelection *selection,
color = g_strdup_printf ("#%06x", e_rgba_to_value ((GdkRGBA *) rgba));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "foreColor", FALSE, color);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_FORE_COLOR, color);
g_free (color);
g_object_notify (G_OBJECT (selection), "font-color");
}
+/**
+ * e_editor_selection_get_font_name:
+ * @selection: an #EEditorSelection
+ *
+ * Returns name of font used in current selection or at letter at current cursor
+ * position.
+ *
+ * Returns: A string with font name. [transfer-none]
+ */
const gchar *
e_editor_selection_get_font_name (EEditorSelection *selection)
{
@@ -1079,21 +1274,35 @@ e_editor_selection_get_font_name (EEditorSelection *selection)
return selection->priv->font_family;
}
+/**
+ * e_editor_selection_set_font_name:
+ * @selection: an #EEditorSelection
+ * @font_name: a font name to apply
+ *
+ * Sets font name of current selection or of letter at current cursor position
+ * to @font_name.
+ */
void
e_editor_selection_set_font_name (EEditorSelection *selection,
const gchar *font_name)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "fontName", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_FONT_NAME, font_name);
+
g_object_notify (G_OBJECT (selection), "font-name");
}
-guint
+/**
+ * e_editor_Selection_get_font_size:
+ * @selection: an #EEditorSelection
+ *
+ * Returns point size of current selection or of letter at current cursor position.
+ */
+ guint
e_editor_selection_get_font_size (EEditorSelection *selection)
{
gchar *size;
@@ -1118,24 +1327,40 @@ e_editor_selection_get_font_size (EEditorSelection *selection)
return size_int;
}
+/**
+ * e_editor_selection_set_font_size:
+ * @selection: an #EEditorSelection
+ * @font_size: point size to apply
+ *
+ * Sets font size of current selection or of letter at current cursor position
+ * to @font_size.
+ */
void
e_editor_selection_set_font_size (EEditorSelection *selection,
guint font_size)
{
- WebKitDOMDocument *document;
gchar *size_str;
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
size_str = g_strdup_printf("%d", font_size);
- webkit_dom_document_exec_command (document, "fontSize", FALSE, size_str);
+
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_FONT_SIZE, size_str);
g_free (size_str);
g_object_notify (G_OBJECT (selection), "font-size");
}
-/* Not a property! */
+/**
+ * e_editor_selection_is_citation:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current paragraph is a citation.
+ *
+ * Returns: @TRUE when current paragraph is a citation, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_citation (EEditorSelection* selection)
{
@@ -1145,6 +1370,15 @@ e_editor_selection_is_citation (EEditorSelection* selection)
return get_has_style (selection, "citation");
}
+/**
+ * e_editor_selection_is_indented:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current paragraph is indented. This does not include citations.
+ * To check, whether paragraph is a citation, use #e_editor_selection_is_citation().
+ *
+ * Returns: @TRUE when current paragraph is indented, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_indented (EEditorSelection *selection)
{
@@ -1153,32 +1387,53 @@ e_editor_selection_is_indented (EEditorSelection *selection)
return get_has_style (selection, "blockquote");
}
+/**
+ * e_editor_selection_indent:
+ * @selection: an #EEditorSelection
+ *
+ * Indents current paragraph by one level.
+ */
void
e_editor_selection_indent (EEditorSelection *selection)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "indent", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INDENT, NULL);
+
g_object_notify (G_OBJECT (selection), "indented");
}
+/**
+ * e_editor_selection_unindent:
+ * @selection: an #EEditorSelection
+ *
+ * Unindents current paragraph by one level.
+ */
void
e_editor_selection_unindent (EEditorSelection *selection)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "outdent", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_OUTDENT, NULL);
+
g_object_notify (G_OBJECT (selection), "indented");
}
+/**
+ * e_editor_selection_is_bold:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is bold.
+ *
+ * Returns @TRUE when selection is bold, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_bold (EEditorSelection *selection)
{
@@ -1187,12 +1442,18 @@ e_editor_selection_is_bold (EEditorSelection *selection)
return get_has_style (selection, "b");
}
+/**
+ * e_editor_selection_set_bold:
+ * @selection: an #EEditorSelection
+ * @bold: @TRUE to enable bold, @FALSE to disable
+ *
+ * Toggles bold formatting of current selection or letter at current cursor
+ * position, depending on whether @bold is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_bold (EEditorSelection *selection,
gboolean bold)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_bold (selection) ? TRUE : FALSE)
@@ -1200,12 +1461,23 @@ e_editor_selection_set_bold (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "bold", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_BOLD, NULL);
+
g_object_notify (G_OBJECT (selection), "bold");
}
+/**
+ * e_editor_selection_is_italic:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is italic.
+ *
+ * Returns @TRUE when selection is italic, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_italic (EEditorSelection *selection)
{
@@ -1214,12 +1486,18 @@ e_editor_selection_is_italic (EEditorSelection *selection)
return get_has_style (selection, "i");
}
+/**
+ * e_editor_selection_set_italic:
+ * @selection: an #EEditorSelection
+ * @italic: @TRUE to enable italic, @FALSE to disable
+ *
+ * Toggles italic formatting of current selection or letter at current cursor
+ * position, depending on whether @italic is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_italic (EEditorSelection *selection,
gboolean italic)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_italic (selection) ? TRUE : FALSE)
@@ -1227,12 +1505,22 @@ e_editor_selection_set_italic (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "italic", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_ITALIC, NULL);
g_object_notify (G_OBJECT (selection), "italic");
}
+/**
+ * e_editor_selection_is_monospaced:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is monospaced.
+ *
+ * Returns @TRUE when selection is monospaced, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_monospaced (EEditorSelection *selection)
{
@@ -1241,6 +1529,14 @@ e_editor_selection_is_monospaced (EEditorSelection *selection)
return get_has_style (selection, "tt");
}
+/**
+ * e_editor_selection_set_monospaced:
+ * @selection: an #EEditorSelection
+ * @monospaced: @TRUE to enable monospaced, @FALSE to disable
+ *
+ * Toggles monospaced formatting of current selection or letter at current cursor
+ * position, depending on whether @monospaced is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_monospaced (EEditorSelection *selection,
gboolean monospaced)
@@ -1280,13 +1576,23 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
* In theory it's possible to write a code that would remove
* the <TT> from selection using advanced DOM manipulation,
* but right now I don't really feel like writing it all... */
- webkit_dom_document_exec_command (
- document, "removeFormat", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT, NULL);
}
g_object_notify (G_OBJECT (selection), "monospaced");
}
+/**
+ * e_editor_selection_is_strike_through:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is striked through.
+ *
+ * Returns @TRUE when selection is striked through, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_strike_through (EEditorSelection *selection)
{
@@ -1295,12 +1601,18 @@ e_editor_selection_is_strike_through (EEditorSelection *selection)
return get_has_style (selection, "strike");
}
+/**
+ * e_editor_selection_set_strike_through:
+ * @selection: an #EEditorSelection
+ * @strike_through: @TRUE to enable strike through, @FALSE to disable
+ *
+ * Toggles strike through formatting of current selection or letter at current
+ * cursor position, depending on whether @strike_through is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_strike_through (EEditorSelection *selection,
gboolean strike_through)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_strike_through (selection) ? TRUE : FALSE)
@@ -1308,12 +1620,22 @@ e_editor_selection_set_strike_through (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "strikeThrough", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH, NULL);
g_object_notify (G_OBJECT (selection), "strike-through");
}
+/**
+ * e_editor_selection_is_subscript:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is in subscript.
+ *
+ * Returns @TRUE when selection is in subscript, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_subscript (EEditorSelection *selection)
{
@@ -1342,12 +1664,18 @@ e_editor_selection_is_subscript (EEditorSelection *selection)
return (node != NULL);
}
+/**
+ * e_editor_selection_set_subscript:
+ * @selection: an #EEditorSelection
+ * @subscrupt: @TRUE to enable subscript, @FALSE to disable
+ *
+ * Toggles subscript of current selection or letter at current cursor position,
+ * depending on whether @subscript is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_subscript (EEditorSelection *selection,
gboolean subscript)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_subscript (selection) ? TRUE : FALSE)
@@ -1355,12 +1683,22 @@ e_editor_selection_set_subscript (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "subscript", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_SUBSCRIPT, NULL);
g_object_notify (G_OBJECT (selection), "subscript");
}
+/**
+ * e_editor_selection_is_superscript:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is in superscript.
+ *
+ * Returns @TRUE when selection is in superscript, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_superscript (EEditorSelection *selection)
{
@@ -1389,12 +1727,18 @@ e_editor_selection_is_superscript (EEditorSelection *selection)
return (node != NULL);
}
+/**
+ * e_editor_selection_set_superscript:
+ * @selection: an #EEditorSelection
+ * @superscript: @TRUE to enable superscript, @FALSE to disable
+ *
+ * Toggles superscript of current selection or letter at current cursor position,
+ * depending on whether @superscript is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_superscript (EEditorSelection *selection,
gboolean superscript)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_superscript (selection) ? TRUE : FALSE)
@@ -1402,12 +1746,22 @@ e_editor_selection_set_superscript (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "superscript", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT, NULL);
g_object_notify (G_OBJECT (selection), "superscript");
}
+/**
+ * e_editor_selection_is_underline:
+ * @selection: an #EEditorSelection
+ *
+ * Returns whether current selection or letter at current cursor position
+ * is underlined.
+ *
+ * Returns @TRUE when selection is underlined, @FALSE otherwise.
+ */
gboolean
e_editor_selection_is_underline (EEditorSelection *selection)
{
@@ -1416,12 +1770,18 @@ e_editor_selection_is_underline (EEditorSelection *selection)
return get_has_style (selection, "u");
}
+/**
+ * e_editor_selection_set_underline:
+ * @selection: an #EEditorSelection
+ * @underline: @TRUE to enable underline, @FALSE to disable
+ *
+ * Toggles underline formatting of current selection or letter at current
+ * cursor position, depending on whether @underline is @TRUE or @FALSE.
+ */
void
e_editor_selection_set_underline (EEditorSelection *selection,
gboolean underline)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
if ((e_editor_selection_is_underline (selection) ? TRUE : FALSE)
@@ -1429,78 +1789,107 @@ e_editor_selection_set_underline (EEditorSelection *selection,
return;
}
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "underline", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_UNDERLINE, NULL);
g_object_notify (G_OBJECT (selection), "underline");
}
+/**
+ * e_editor_selection_unlink:
+ * @selection: an #EEditorSelection
+ *
+ * Removes any links (<A> elements) from current selection or at current
+ * cursor position.
+ */
void
e_editor_selection_unlink (EEditorSelection *selection)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "unlink", FALSE, "");
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_UNLINK, NULL);
}
+/**
+ * e_editor_selection_create_link:
+ * @selection: an #EEditorSelection
+ * @uri: destination of the new link
+ *
+ * Converts current selection into a link pointing to @url.
+ */
void
e_editor_selection_create_link (EEditorSelection *selection,
const gchar *uri)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
g_return_if_fail (uri && *uri);
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (document, "createLink", FALSE, uri);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_CREATE_LINK, uri);
}
-
+/**
+ * e_editor_selection_insert_text:
+ * @selection: an #EEditorSelection
+ * @plain_text: text to insert
+ *
+ * Inserts @plain_text at current cursor position. When a text range is selected,
+ * it will be replaced by @plain_text.
+ */
void
e_editor_selection_insert_text (EEditorSelection *selection,
const gchar *plain_text)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
g_return_if_fail (plain_text != NULL);
- document = webkit_web_view_get_dom_document (selection->priv->webview);
-
- webkit_dom_document_exec_command (
- document, "insertText", FALSE, plain_text);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, plain_text);
}
+/**
+ * e_editor_selection_insert_html:
+ * @selection: an #EEditorSelection
+ * @html_text: an HTML code to insert
+ *
+ * Insert @html_text into document at current cursor position. When a text range
+ * is selected, it will be replaced by @html_text.
+ */
void
e_editor_selection_insert_html (EEditorSelection *selection,
const gchar *html_text)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
g_return_if_fail (html_text != NULL);
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (
- document, "insertHTML", FALSE, html_text);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INSERT_HTML, html_text);
}
+/**
+ * e_editor_selection_insert_image:
+ * @selection: an #EEditorSelection
+ * @image_uri: an URI of the source image
+ *
+ * Inserts image at current cursor position using @image_uri as source. When a
+ * text range is selected, it will be replaced by the image.
+ */
void
e_editor_selection_insert_image (EEditorSelection *selection,
const gchar *image_uri)
{
- WebKitDOMDocument *document;
-
g_return_if_fail (E_IS_EDITOR_SELECTION (selection));
g_return_if_fail (image_uri != NULL);
- document = webkit_web_view_get_dom_document (selection->priv->webview);
- webkit_dom_document_exec_command (
- document, "insertImage", FALSE, image_uri);
+ e_editor_widget_exec_command (
+ E_EDITOR_WIDGET (selection->priv->webview),
+ E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE, image_uri);
}
static gint
@@ -1547,6 +1936,12 @@ find_where_to_break_line (WebKitDOMNode *node,
return max_len;
}
+/**
+ * e_editor_selection_wrap_lines:
+ * @selection: an #EEditorSelection
+ *
+ * Wraps all lines in current selection to be 71 characters long.
+ */
void
e_editor_selection_wrap_lines (EEditorSelection *selection)
{
@@ -1670,6 +2065,27 @@ e_editor_selection_wrap_lines (EEditorSelection *selection)
g_free (html);
}
+/**
+ * e_editor_selection_save:
+ * @selection: an #EEditorSelection
+ *
+ * Saves current cursor position or current selection range. The selection can
+ * be later restored by calling #e_editor_selection_restore().
+ *
+ * Note that calling #e_editor_selection_save() overwrites previously saved
+ * position.
+ *
+ * Note that this method inserts special markings into the HTML code that are
+ * used to later restore the selection. It can happen that by deleting some segments
+ * of the document some of the markings are deleted too. In that case restoring
+ * the selection by #e_editor_selection_restore() can fail. Also by moving text
+ * segments (Cut & Paste) can result in moving the markings elsewhere, thus
+ * #e_editor_selection_restore() will restore the selection incorrectly.
+ *
+ * It is recommended to use this method only when you are not planning to make
+ * bigger changes to content or structure of the document (formatting changes
+ * are usually OK).
+ */
void
e_editor_selection_save (EEditorSelection* selection)
{
@@ -1735,7 +2151,16 @@ e_editor_selection_save (EEditorSelection* selection)
WEBKIT_DOM_NODE (marker), split, NULL);
}
-
+/**
+ * e_editor_selection_restore:
+ * @selection: an #EEditorSelection
+ *
+ * Restores cursor position or selection range that was saved by
+ * #e_editor_selection_save().
+ *
+ * Note that calling this function without calling #e_editor_selection_save()
+ * before is a programming error and the behavior is undefined.
+ */
void
e_editor_selection_restore (EEditorSelection* selection)
{
diff --git a/e-util/e-editor-selection.h b/e-util/e-editor-selection.h
index b5e5cfa..1933282 100644
--- a/e-util/e-editor-selection.h
+++ b/e-util/e-editor-selection.h
@@ -1,6 +1,8 @@
/*
* e-editor-selection.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -23,8 +25,7 @@
#ifndef E_EDITOR_SELECTION_H
#define E_EDITOR_SELECTION_H
-#include <glib-object.h>
-#include <webkit/webkit.h>
+#include <gtk/gtk.h>
/* Standard GObject macros */
#define E_TYPE_EDITOR_SELECTION \
@@ -47,6 +48,7 @@
G_BEGIN_DECLS
+typedef struct _EEditorWidget EEditorWidget;
typedef struct _EEditorSelection EEditorSelection;
typedef struct _EEditorSelectionClass EEditorSelectionClass;
typedef struct _EEditorSelectionPrivate EEditorSelectionPrivate;
@@ -97,8 +99,6 @@ struct _EEditorSelectionClass {
GType e_editor_selection_get_type (void);
-EEditorSelection * e_editor_selection_new (WebKitWebView *parent_view);
-
gboolean e_editor_selection_has_text (EEditorSelection *selection);
gchar * e_editor_selection_get_caret_word
diff --git a/e-util/e-editor-spell-check-dialog.c b/e-util/e-editor-spell-check-dialog.c
index cf1dc22..fabb3c7 100644
--- a/e-util/e-editor-spell-check-dialog.c
+++ b/e-util/e-editor-spell-check-dialog.c
@@ -1,4 +1,7 @@
-/* e-editor-spell-dialog.c
+/*
+ * e-editor-spell-dialog.c
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
@@ -232,7 +235,7 @@ static gboolean
editor_spell_check_dialog_prev (EEditorSpellCheckDialog *dialog)
{
WebKitDOMNode *start = NULL, *end = NULL;
- gulong start_offset, end_offset;
+ gulong start_offset, end_offset;
if (dialog->priv->word == NULL) {
webkit_dom_dom_selection_modify (
diff --git a/e-util/e-editor-spell-check-dialog.h b/e-util/e-editor-spell-check-dialog.h
index 624ff72..a8202e2 100644
--- a/e-util/e-editor-spell-check-dialog.h
+++ b/e-util/e-editor-spell-check-dialog.h
@@ -1,4 +1,7 @@
-/* e-editor-spell-check-dialog.h
+/*
+ * e-editor-spell-check-dialog.h
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-editor-table-dialog.c b/e-util/e-editor-table-dialog.c
index 446f4e0..36b6c2d 100644
--- a/e-util/e-editor-table-dialog.c
+++ b/e-util/e-editor-table-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-table-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -828,6 +830,6 @@ e_editor_table_dialog_new (EEditor *editor)
E_TYPE_EDITOR_TABLE_DIALOG,
"editor", editor,
"title", N_("Table Properties"),
- NULL));
+ NULL));
}
diff --git a/e-util/e-editor-table-dialog.h b/e-util/e-editor-table-dialog.h
index 8bcca33..e3262f6 100644
--- a/e-util/e-editor-table-dialog.h
+++ b/e-util/e-editor-table-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-table-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-text-dialog.c b/e-util/e-editor-text-dialog.c
index efaca51..9668200 100644
--- a/e-util/e-editor-text-dialog.c
+++ b/e-util/e-editor-text-dialog.c
@@ -1,6 +1,8 @@
/*
* e-editor-text-dialog.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-text-dialog.h b/e-util/e-editor-text-dialog.h
index f660f4e..2eea996 100644
--- a/e-util/e-editor-text-dialog.h
+++ b/e-util/e-editor-text-dialog.h
@@ -1,6 +1,8 @@
/*
* e-editor-text-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-utils.c b/e-util/e-editor-utils.c
index 5daabff..ee872b5 100644
--- a/e-util/e-editor-utils.c
+++ b/e-util/e-editor-utils.c
@@ -1,6 +1,8 @@
/*
* e-editor-utils.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -23,6 +25,18 @@
#include "e-editor-utils.h"
#include <string.h>
+/**
+ * e_editor_dom_node_find_parent_element:
+ * @node: Start node
+ * @tagname: Tag name of element to search
+ *
+ * Recursively searches for first occurance of element with given @tagname
+ * that is parent of given @node.
+ *
+ * Returns: A #WebKitDOMElement with @tagname representing parent of @node or
+ * @NULL when @node has no parent with given @tagname. When @node matches @tagname,
+ * then the @node is returned.
+ */
WebKitDOMElement *
e_editor_dom_node_find_parent_element (WebKitDOMNode *node,
const gchar *tagname)
@@ -53,6 +67,18 @@ e_editor_dom_node_find_parent_element (WebKitDOMNode *node,
return NULL;
}
+/**
+ * e_editor_dom_node_find_child_element:
+ * @node: Start node
+ * @tagname: Tag name of element to search.
+ *
+ * Recursively searches for first occurence of element with given @tagname that
+ * is a child of @node.
+ *
+ * Returns: A #WebKitDOMElement with @tagname representing a child of @node or
+ * @NULL when @node has no child with given @tagname. When @node matches @tagname,
+ * then the @node is returned.
+ */
WebKitDOMElement *
e_editor_dom_node_find_child_element (WebKitDOMNode *node,
const gchar *tagname)
diff --git a/e-util/e-editor-utils.h b/e-util/e-editor-utils.h
index 5e370c7..fb4d313 100644
--- a/e-util/e-editor-utils.h
+++ b/e-util/e-editor-utils.h
@@ -1,6 +1,8 @@
/*
* e-editor-utils.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor-widget.c b/e-util/e-editor-widget.c
index c661003..5e065b1 100644
--- a/e-util/e-editor-widget.c
+++ b/e-util/e-editor-widget.c
@@ -1,6 +1,8 @@
/*
* e-editor-widget.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -29,6 +31,20 @@
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
+G_DEFINE_TYPE (
+ EEditorWidget,
+ e_editor_widget,
+ WEBKIT_TYPE_WEB_VIEW);
+
+/**
+ * EEditorWidget:
+ *
+ * The #EEditorWidget is a WebKit-based rich text editor. The widget itself
+ * only provides means to configure global behavior of the editor. To work
+ * with the actual content, current cursor position or current selection,
+ * use #EEditorSelection object.
+ */
+
struct _EEditorWidgetPrivate {
gint changed : 1;
gint inline_spelling : 1;
@@ -53,10 +69,6 @@ struct _EEditorWidgetPrivate {
GQueue *postreload_operations;
};
-G_DEFINE_TYPE (
- EEditorWidget,
- e_editor_widget,
- WEBKIT_TYPE_WEB_VIEW);
enum {
PROP_0,
@@ -475,9 +487,8 @@ editor_widget_key_press_event (GtkWidget *gtk_widget,
* command to do it. */
EEditorSelection *selection = e_editor_widget_get_selection (E_EDITOR_WIDGET (gtk_widget));
if (e_editor_selection_is_citation (selection)) {
- WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW
(editor));
- webkit_dom_document_exec_command (document, "InsertNewlineInQuotedContent", FALSE,
"");
- return TRUE;
+ return e_editor_widget_exec_command (
+ editor, E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT, NULL);
}
}
@@ -733,6 +744,11 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
klass->paste_clipboard_quoted = editor_widget_paste_clipboard_quoted;
+ /**
+ * EEditorWidget:html-mode
+ *
+ * Determines whether HTML or plain text mode is enabled.
+ **/
g_object_class_install_property (
object_class,
PROP_HTML_MODE,
@@ -744,6 +760,11 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ /**
+ * EEditorWidget::inline-spelling
+ *
+ * Determines whether automatic spellchecking is enabled.
+ */
g_object_class_install_property (
object_class,
PROP_INLINE_SPELLING,
@@ -755,6 +776,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ /**
+ * EEditorWidget:magic-links
+ *
+ * Determines whether automatic conversion of text links into
+ * HTML links is enabled.
+ */
g_object_class_install_property (
object_class,
PROP_MAGIC_LINKS,
@@ -766,6 +793,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ /**
+ * EEditorWidget:magic-smileys
+ *
+ * Determines whether automatic conversion of text smileys into
+ * images is enabled.
+ */
g_object_class_install_property (
object_class,
PROP_MAGIC_SMILEYS,
@@ -777,6 +810,11 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ /**
+ * EEditorWidget:changed
+ *
+ * Determines whether document has been modified
+ */
g_object_class_install_property (
object_class,
PROP_CHANGED,
@@ -787,6 +825,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READWRITE));
+ /**
+ * EEditorWidget:can-copy
+ *
+ * Determines whether it's possible to copy to clipboard. The action
+ * is usually disabled when there is no selection to copy.
+ */
g_object_class_install_property (
object_class,
PROP_CAN_COPY,
@@ -797,6 +841,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorWidget:can-cut
+ *
+ * Determines whether it's possible to cut to clipboard. The action
+ * is usually disabled when there is no selection to cut.
+ */
g_object_class_install_property (
object_class,
PROP_CAN_CUT,
@@ -807,6 +857,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorWidget:can-paste
+ *
+ * Determines whether it's possible to paste from clipboard. The action
+ * is usually disabled when there is no valid content in clipboard to paste.
+ */
g_object_class_install_property (
object_class,
PROP_CAN_PASTE,
@@ -817,6 +873,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorWidget:can-redu
+ *
+ * Determines whether it's possible to redo previous action. The action
+ * is usually disabled when there is no action to redo.
+ */
g_object_class_install_property (
object_class,
PROP_CAN_REDO,
@@ -827,6 +889,12 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorWidget:can-undo
+ *
+ * Determines whether it's possible to undo last action. The action
+ * is usually disabled when there is no previous action to undo.
+ */
g_object_class_install_property (
object_class,
PROP_CAN_UNDO,
@@ -837,6 +905,11 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
FALSE,
G_PARAM_READABLE));
+ /**
+ * EEditorWidget:spell-languages
+ *
+ * List of #ESpellDictionary objects used for spellchecking.
+ */
g_object_class_install_property (
object_class,
PROP_SPELL_LANGUAGES,
@@ -846,6 +919,11 @@ e_editor_widget_class_init (EEditorWidgetClass *klass)
NULL,
G_PARAM_READWRITE));
+ /**
+ * EEditorWidget:popup-event
+ *
+ * Emitted whenever a context menu is requested.
+ */
signals[POPUP_EVENT] = g_signal_new (
"popup-event",
G_TYPE_FROM_CLASS (klass),
@@ -862,7 +940,6 @@ e_editor_widget_init (EEditorWidget *editor)
{
WebKitWebSettings *settings;
WebKitWebInspector *inspector;
- WebKitDOMDocument *document;
GSettings *g_settings;
GSettingsSchema *settings_schema;
ESpellChecker *checker;
@@ -892,9 +969,8 @@ e_editor_widget_init (EEditorWidget *editor)
/* Don't use CSS when possible to preserve compatibility with older
* versions of Evolution or other MUAs */
- document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor));
- webkit_dom_document_exec_command (
- document, "styleWithCSS", FALSE, "false");
+ e_editor_widget_exec_command (
+ editor, E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS, "false");
g_signal_connect (editor, "user-changed-contents",
G_CALLBACK (editor_widget_user_changed_contents_cb), NULL);
@@ -909,8 +985,10 @@ e_editor_widget_init (EEditorWidget *editor)
g_signal_connect (inspector, "inspect-web-view",
G_CALLBACK (editor_widget_open_inspector), NULL);
- editor->priv->selection = e_editor_selection_new (
- WEBKIT_WEB_VIEW (editor));
+ editor->priv->selection = g_object_new (
+ E_TYPE_EDITOR_SELECTION,
+ "editor-widget", editor,
+ NULL);
g_settings = g_settings_new ("org.gnome.desktop.interface");
g_signal_connect_swapped (
@@ -944,12 +1022,30 @@ e_editor_widget_init (EEditorWidget *editor)
editor_widget_set_links_active (editor, FALSE);
}
+/**
+ * e_editor_widget_new:
+ *
+ * Returns a new instance of the editor.
+ *
+ * Returns: A newly created #EEditorWidget. [transfer-full]
+ */
EEditorWidget *
e_editor_widget_new (void)
{
return g_object_new (E_TYPE_EDITOR_WIDGET, NULL);
}
+/**
+ * e_editor_widget_get_selection:
+ * @widget: an #EEditorWidget
+ *
+ * Returns an #EEditorSelection object which represents current selection or
+ * cursor position within the editor document. The #EEditorSelection allows
+ * programmer to manipulate with formatting, selection, styles etc.
+ *
+ * Returns: An always valid #EEditorSelection object. The object is owned by
+ * the @widget and should never be free'd.
+ */
EEditorSelection *
e_editor_widget_get_selection (EEditorWidget *widget)
{
@@ -958,6 +1054,102 @@ e_editor_widget_get_selection (EEditorWidget *widget)
return widget->priv->selection;
}
+/**
+ * e_editor_widget_exec_command:
+ * @widget: an #EEditorWidget
+ * @command: an #EEditorWidgetCommand to execute
+ * @value: value of the command (or @NULL if the command does not require value)
+ *
+ * The function will fail when @value is @NULL or empty but the current @command
+ * requires a value to be passed. The @value is ignored when the @command does
+ * not expect any value.
+ *
+ * Returns: @TRUE when the command was succesfully executed, @FALSE otherwise.
+ */
+gboolean
+e_editor_widget_exec_command (EEditorWidget* widget,
+ EEditorWidgetCommand command,
+ const gchar* value)
+{
+ WebKitDOMDocument *document;
+ const gchar *cmd_str = 0;
+ gboolean has_value;
+
+ g_return_val_if_fail (E_IS_EDITOR_WIDGET (widget), FALSE);
+
+#define CHECK_COMMAND(cmd,str,val) case cmd:\
+ if (val) {\
+ g_return_val_if_fail (value && *value, FALSE);\
+ }\
+ has_value = val; \
+ cmd_str = str;\
+ break;
+
+ switch (command) {
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR, "BackColor", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_BOLD, "Bold", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_COPY, "Copy", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_CREATE_LINK, "CreateLink", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_CUT, "Cut", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR,
"DefaultParagraphSeparator", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_DELETE, "Delete", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FIND_STRING, "FindString", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_NAME, "FontName", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_SIZE, "FontSize", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA, "FontSizeDelta", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORE_COLOR, "ForeColor", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK, "FormatBlock", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE, "ForwardDelete", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_HILITE_COLOR, "HiliteColor", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INDENT, "Indent", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE, "InsertHorizontalRule", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_HTML, "InsertHTML", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE, "InsertImage", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK, "InsertLineBreak", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT,
"InsertNewlineInQuotedContent", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST, "InsertOrderedList", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH, "InsertParagraph", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, "InsertText", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST, "InsertUnorderedList", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_ITALIC, "Italic", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER, "JustifyCenter", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL, "JustifyFull", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT, "JustifyLeft", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE, "JustifyNone", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT, "JustifyRight", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_OUTDENT, "Outdent", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE, "Paste", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE, "PasteAndMatchStyle", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT, "PasteAsPlainText", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_PRINT, "Print", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_REDO, "Redo", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT, "RemoveFormat", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SELECT_ALL, "SelectAll", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH, "Strikethrough", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS, "StyleWithCSS", TRUE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SUBSCRIPT, "Subscript", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT, "Superscript", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_TRANSPOSE, "Transpose", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNDERLINE, "Underline", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNDO, "Undo", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNLINK, "Unlink", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_UNSELECT, "Unselect", FALSE)
+ CHECK_COMMAND(E_EDITOR_WIDGET_COMMAND_USE_CSS, "UseCSS", TRUE)
+ }
+
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
+ return webkit_dom_document_exec_command (
+ document, cmd_str, FALSE, has_value ? value : "" );
+}
+
+/**
+ * e_editor_widget_get_changed:
+ * @widget: an #EEditorWidget
+ *
+ * Whether content of the editor has been changed.
+ *
+ * Returns: @TRUE when document was changed, @FALSE otherwise.
+ */
gboolean
e_editor_widget_get_changed (EEditorWidget *widget)
{
@@ -966,6 +1158,15 @@ e_editor_widget_get_changed (EEditorWidget *widget)
return widget->priv->changed;
}
+/**
+ * e_editor_widget_set_changed:
+ * @widget: an #EEditorWidget
+ * @changed: whether document has been changed or not
+ *
+ * Sets whether document has been changed or not. The editor is tracking changes
+ * automatically, but sometimes it's necessary to change the dirty flag to force
+ * "Save changes" dialog for example.
+ */
void
e_editor_widget_set_changed (EEditorWidget *widget,
gboolean changed)
@@ -980,6 +1181,16 @@ e_editor_widget_set_changed (EEditorWidget *widget,
g_object_notify (G_OBJECT (widget), "changed");
}
+/**
+ * e_editor_widget_get_html_mode:
+ * @widget: an #EEditorWidget
+ *
+ * Whether the editor is in HTML mode or plain text mode. In HTML mode,
+ * more formatting options are avilable an the email is sent as
+ * multipart/alternative.
+ *
+ * Returns: @TRUE when HTML mode is enabled, @FALSE otherwise.
+ */
gboolean
e_editor_widget_get_html_mode (EEditorWidget *widget)
{
@@ -988,6 +1199,16 @@ e_editor_widget_get_html_mode (EEditorWidget *widget)
return widget->priv->html_mode;
}
+/**
+ * e_editor_widget_set_html_mode:
+ * @widget: an #EEditorWidget
+ * @html_mode: @TRUE to enable HTML mode, @FALSE to enable plain text mode
+ *
+ * When switching from HTML to plain text mode, user will be prompted whether
+ * he/she really wants to switch the mode and lose all formatting. When user
+ * declines, the property is not changed. When they accept, the all formatting
+ * is lost.
+ */
void
e_editor_widget_set_html_mode (EEditorWidget *widget,
gboolean html_mode)
@@ -1065,6 +1286,16 @@ e_editor_widget_set_html_mode (EEditorWidget *widget,
g_object_notify (G_OBJECT (widget), "html-mode");
}
+/**
+ * e_editor_widget_get_inline_spelling:
+ * @widget: an #EEditorWidget
+ *
+ * Returns whether automatic spellchecking is enabled or not. When enabled,
+ * editor will perform spellchecking as user is typing. Otherwise spellcheck
+ * has to be run manually from menu.
+ *
+ * Returns: @TRUE when automatic spellchecking is enabled, @FALSE otherwise.
+ */
gboolean
e_editor_widget_get_inline_spelling (EEditorWidget *widget)
{
@@ -1073,6 +1304,13 @@ e_editor_widget_get_inline_spelling (EEditorWidget *widget)
return widget->priv->inline_spelling;
}
+/**
+ * e_editor_widget_set_inline_spelling:
+ * @widget: an #EEditorWidget
+ * @inline_spelling: @TRUE to enable automatic spellchecking, @FALSE otherwise
+ *
+ * Enables or disables automatic spellchecking.
+ */
void
e_editor_widget_set_inline_spelling (EEditorWidget *widget,
gboolean inline_spelling)
@@ -1087,6 +1325,15 @@ e_editor_widget_set_inline_spelling (EEditorWidget *widget,
g_object_notify (G_OBJECT (widget), "inline-spelling");
}
+/**
+ * e_editor_widget_get_magic_links:
+ * @widget: an #EEditorWidget
+ *
+ * Returns whether automatic links conversion is enabled. When enabled, the editor
+ * will automatically convert any HTTP links into clickable HTML links.
+ *
+ * Returns: @TRUE when magic links are enabled, @FALSE otherwise.
+ */
gboolean
e_editor_widget_get_magic_links (EEditorWidget *widget)
{
@@ -1095,6 +1342,13 @@ e_editor_widget_get_magic_links (EEditorWidget *widget)
return widget->priv->magic_links;
}
+/**
+ * e_editor_widget_set_magic_links:
+ * @widget: an #EEditorWidget
+ * @magic_link: @TRUE to enable magic links, @FALSE to disable them
+ *
+ * Enables or disables automatic links conversion.
+ */
void
e_editor_widget_set_magic_links (EEditorWidget *widget,
gboolean magic_links)
@@ -1109,6 +1363,16 @@ e_editor_widget_set_magic_links (EEditorWidget *widget,
g_object_notify (G_OBJECT (widget), "magic-links");
}
+/**
+ * e_editor_widget_get_magic_smileys:
+ * @widget: an #EEditorWidget
+ *
+ * Returns whether automatic conversion of smileys is enabled or disabled. When
+ * enabled, the editor will automatically convert text smileys ( :-), ;-),...)
+ * into images.
+ *
+ * Returns: @TRUE when magic smileys are enabled, @FALSE otherwise.
+ */
gboolean
e_editor_widget_get_magic_smileys (EEditorWidget *widget)
{
@@ -1117,6 +1381,13 @@ e_editor_widget_get_magic_smileys (EEditorWidget *widget)
return widget->priv->magic_smileys;
}
+/**
+ * e_editor_widget_set_magic_smileys:
+ * @widget: an #EEditorWidget
+ * @magic_smileys: @TRUE to enable magic smileys, @FALSE to disable them
+ *
+ * Enables or disables magic smileys.
+ */
void
e_editor_widget_set_magic_smileys (EEditorWidget *widget,
gboolean magic_smileys)
@@ -1131,6 +1402,16 @@ e_editor_widget_set_magic_smileys (EEditorWidget *widget,
g_object_notify (G_OBJECT (widget), "magic-smileys");
}
+/**
+ * e_editor_widget_get_spell_languages:
+ * @widget: an #EEditorWidget
+ *
+ * Returns list of #ESpellDictionary objects that are used for spell checking.
+ *
+ * Returns: A newly allocated list of #ESpellDictionary objects. You should free
+ * the list by g_list_free() The objects are owned by #EEditorWidget.and should
+ * not be unref'ed or free'd. [element-type ESpellDictionary]
+ */
GList *
e_editor_widget_get_spell_languages (EEditorWidget *widget)
{
@@ -1139,27 +1420,50 @@ e_editor_widget_get_spell_languages (EEditorWidget *widget)
return g_list_copy (widget->priv->spelling_langs);
}
+/**
+ * e_editor_widget_set_spell_languages:
+ * @widget: an #EEditorWidget
+ * @spell_languages:[element-type ESpellDictionary][transfer-none] a list of
+ * #ESpellDictionary objects
+ *
+ * Sets list of #ESpellDictionary objects that will be used for spell checking.
+ */
void
e_editor_widget_set_spell_languages (EEditorWidget *widget,
- GList *spell_languages)
+ GList *spell_languages)
{
g_return_if_fail (E_IS_EDITOR_WIDGET (widget));
g_return_if_fail (spell_languages);
g_list_free_full (widget->priv->spelling_langs, g_object_unref);
- widget->priv->spelling_langs = g_list_copy (spell_languages);
+ widget->priv->spelling_langs = g_list_copy ((GList *) spell_languages);
g_list_foreach (widget->priv->spelling_langs, (GFunc) g_object_ref, NULL);
g_object_notify (G_OBJECT (widget), "spell-languages");
}
+/**
+ * e_editor_widget_get_spell_checker:
+ * @widget: an #EEditorWidget
+ *
+ * Returns an #ESpellChecker object that is used to perform spellchecking.
+ *
+ * Returns: An always-valid #ESpellChecker object
+ */
ESpellChecker *
e_editor_widget_get_spell_checker (EEditorWidget *widget)
{
return E_SPELL_CHECKER (webkit_get_text_checker ());
}
-
+/**
+ * e_editor_widget_get_text_html:
+ * @widget: an #EEditorWidget:
+ *
+ * Returns HTML content of the editor document.
+ *
+ * Returns: A newly allocated string
+ */
gchar *
e_editor_widget_get_text_html (EEditorWidget *widget)
{
@@ -1256,6 +1560,15 @@ process_elements (WebKitDOMNode *node,
g_regex_unref (regex);
}
+/**
+ * e_editor_widget_get_text_plain:
+ * @widget: an #EEditorWidget
+ *
+ * Returns plain text content of the @widget. The algorithm removes any formatting
+ * or styles from the document and keeps only the text and line breaks.
+ *
+ * Returns: A newly allocated string with plain text content of the document. [transfer-full]
+ */
gchar *
e_editor_widget_get_text_plain (EEditorWidget *widget)
{
@@ -1273,6 +1586,13 @@ e_editor_widget_get_text_plain (EEditorWidget *widget)
return g_string_free (plain_text, FALSE);
}
+/**
+ * e_editor_widget_set_text_html:
+ * @widget: an #EEditorWidget
+ * @text: HTML code to load into the editor
+ *
+ * Loads given @text into the editor, destroying any content already present.
+ */
void
e_editor_widget_set_text_html (EEditorWidget *widget,
const gchar *text)
@@ -1287,15 +1607,17 @@ static void
do_set_text_plain (EEditorWidget *widget,
gpointer data)
{
- WebKitDOMDocument *document;
-
- document =
- webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
-
- webkit_dom_document_exec_command (
- document, "insertText", FALSE, data);
+ e_editor_widget_exec_command (
+ widget, E_EDITOR_WIDGET_COMMAND_INSERT_TEXT, data);
}
+/**
+ * e_editor_widget_set_text_plain:
+ * @widget: an #EEditorWidget
+ * @text: A plain text to load into the editor
+ *
+ * Loads given @text into the editor, destryoing any content already present.
+ */
void
e_editor_widget_set_text_plain (EEditorWidget *widget,
const gchar *text)
@@ -1313,6 +1635,12 @@ e_editor_widget_set_text_plain (EEditorWidget *widget,
widget, do_set_text_plain, g_strdup (text), g_free);
}
+/**
+ * e_editor_widget_paste_clipboard_quoted:
+ * @widget: an #EEditorWidget
+ *
+ * Pastes current content of clipboard into the editor as quoted text
+ */
void
e_editor_widget_paste_clipboard_quoted (EEditorWidget *widget)
{
@@ -1326,6 +1654,13 @@ e_editor_widget_paste_clipboard_quoted (EEditorWidget *widget)
klass->paste_clipboard_quoted (widget);
}
+/**
+ * e_editor_widget_update_fonts:
+ * @widget: an #EEditorWidget
+ *
+ * Forces the editor to reload font settings from WebKitWebSettings and apply
+ * it on the content of the editor document.
+ */
void
e_editor_widget_update_fonts (EEditorWidget *widget)
{
@@ -1472,3 +1807,4 @@ e_editor_widget_update_fonts (EEditorWidget *widget)
pango_font_description_free (ms);
pango_font_description_free (vw);
}
+
diff --git a/e-util/e-editor-widget.h b/e-util/e-editor-widget.h
index 23d5149..1c07d5d 100644
--- a/e-util/e-editor-widget.h
+++ b/e-util/e-editor-widget.h
@@ -1,6 +1,8 @@
/*
* e-editor-widget.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -56,6 +58,116 @@ typedef enum {
E_EDITOR_WIDGET_REPLACE_ANSWER_NEXT
} EEditorWidgetReplaceAnswer;
+
+/**
+ * EEditorWidgetCommand:
+ * @E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR: Sets background color to given value.
+ * @E_EDITOR_WIDGET_COMMAND_BOLD: Toggles bold formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_COPY: Copies current selection to clipboard.
+ * @E_EDITOR_WIDGET_COMMAND_CREATE_LINK: Converts current selection to a link that points to URL in value
+ * @E_EDITOR_WIDGET_COMMAND_CUT: Cuts current selection to clipboard.
+ * @E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR:
+ * @E_EDITOR_WIDGET_COMMAND_DELETE: Deletes current selection.
+ * @E_EDITOR_WIDGET_COMMAND_FIND_STRING: Highlights given string.
+ * @E_EDITOR_WIDGET_COMMAND_FONT_NAME: Sets font name to given value.
+ * @E_EDITOR_WIDGET_COMMAND_FONT_SIZE: Sets font point size to given value (no units, just number)
+ * @E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA: Changes font size by given delta value (no units, just number)
+ * @E_EDITOR_WIDGET_COMMAND_FORE_COLOR: Sets font color to given value
+ * @E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK: Sets block type of current paragraph to given format. Allowed
formats
+ * are "BLOCKQUOTE", "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE" and "ADDRESS".
+ * @E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE:
+ * @E_EDITOR_WIDGET_COMMAND_HILITE_COLOR: Sets color in which results of "FindString" command should be
highlighted to given value.
+ * @E_EDITOR_WIDGET_COMMAND_INDENT: Indents current paragraph by one level.
+ * @E_EDITOR_WIDGET_COMMAND_INSERTS_HTML: Inserts give HTML code into document.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE: Inserts a horizontal rule (<HR>) on current line.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE: Inserts an image with given source file.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK: Breaks line at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT: Breaks citation at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_ORDERERED_LIST: Creates an ordered list environment at current cursor
position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH: Inserts a new paragraph at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_TEXT: Inserts given text at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST: Creates an undordered list environment at current cursor
position.
+ * @E_EDITOR_WIDGET_COMMAND_ITALIC: Toggles italic formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER: Aligns current paragraph to center.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL: Justifies current paragraph to block.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE: Removes any justification or alignment of current paragraph.
+ * @E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT: Aligns current paragraph to right.
+ * @E_EDITOR_WIDGET_COMMAND_OUTDENT: Outdents current paragraph by one level.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE: Pastes clipboard content at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE: Pastes clipboard content and matches it's style to style
at current cursor position.
+ * @E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT: Pastes clipboard content at current cursor position
removing any HTML formatting.
+ * @E_EDITOR_WIDGET_COMMAND_PRINT: Print current document.
+ * @E_EDITOR_WIDGET_COMMAND_REDO: Redos last action.
+ * @E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT: Removes any formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_SELECT_ALL: Extends selects to the entire document.
+ * @E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH: Toggles strikethrough formatting.
+ * @E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS: Toggles whether style should be defined in CSS "style" attribute
of elements or
+ * whether to use deprecated <FONT> tags. Depends on whether given value is "true" or "false".
+ * @E_EDITOR_WIDGET_COMMAND_SUBSCRIPT: Toggles subscript of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT: Toggles superscript of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_TRANSPOSE:
+ * @E_EDITOR_WIDGET_COMMAND_UNDERLINE: Toggles underline formatting of current selection.
+ * @E_EDITOR_WIDGET_COMMAND_UNDO: Undos last action.
+ * @E_EDITOR_WIDGET_COMMAND_UNLINK: Removes active links (<A>) from current selection (if there's
any).
+ * @E_EDITOR_WIDGET_COMMAND_UNSELECT: Cancels current selection.
+ * @E_EDITOR_WIDGET_COMMAND_USE_CSS: Whether to allow use of CSS or not depending on whether given value is
"true" or "false".
+ *
+ * Used to identify DOM command to execute using #e_editor_widget_exec_command().
+ * Some commands require value to be passed in, which is always stated in the documentation.
+ */
+
+typedef enum {
+ E_EDITOR_WIDGET_COMMAND_BACKGROUND_COLOR,
+ E_EDITOR_WIDGET_COMMAND_BOLD,
+ E_EDITOR_WIDGET_COMMAND_COPY,
+ E_EDITOR_WIDGET_COMMAND_CREATE_LINK,
+ E_EDITOR_WIDGET_COMMAND_CUT,
+ E_EDITOR_WIDGET_COMMAND_DEFAULT_PARAGRAPH_SEPARATOR,
+ E_EDITOR_WIDGET_COMMAND_DELETE,
+ E_EDITOR_WIDGET_COMMAND_FIND_STRING,
+ E_EDITOR_WIDGET_COMMAND_FONT_NAME,
+ E_EDITOR_WIDGET_COMMAND_FONT_SIZE,
+ E_EDITOR_WIDGET_COMMAND_FONT_SIZE_DELTA,
+ E_EDITOR_WIDGET_COMMAND_FORE_COLOR,
+ E_EDITOR_WIDGET_COMMAND_FORMAT_BLOCK,
+ E_EDITOR_WIDGET_COMMAND_FORWARD_DELETE,
+ E_EDITOR_WIDGET_COMMAND_HILITE_COLOR,
+ E_EDITOR_WIDGET_COMMAND_INDENT,
+ E_EDITOR_WIDGET_COMMAND_INSERT_HTML,
+ E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE,
+ E_EDITOR_WIDGET_COMMAND_INSERT_IMAGE,
+ E_EDITOR_WIDGET_COMMAND_INSERT_LINE_BREAK,
+ E_EDITOR_WIDGET_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT,
+ E_EDITOR_WIDGET_COMMAND_INSERT_ORDERED_LIST,
+ E_EDITOR_WIDGET_COMMAND_INSERT_PARAGRAPH,
+ E_EDITOR_WIDGET_COMMAND_INSERT_TEXT,
+ E_EDITOR_WIDGET_COMMAND_INSERT_UNORDERED_LIST,
+ E_EDITOR_WIDGET_COMMAND_ITALIC,
+ E_EDITOR_WIDGET_COMMAND_JUSTIFY_CENTER,
+ E_EDITOR_WIDGET_COMMAND_JUSTIFY_FULL,
+ E_EDITOR_WIDGET_COMMAND_JUSTIFY_LEFT,
+ E_EDITOR_WIDGET_COMMAND_JUSTIFY_NONE,
+ E_EDITOR_WIDGET_COMMAND_JUSTIFY_RIGHT,
+ E_EDITOR_WIDGET_COMMAND_OUTDENT,
+ E_EDITOR_WIDGET_COMMAND_PASTE,
+ E_EDITOR_WIDGET_COMMAND_PASTE_AND_MATCH_STYLE,
+ E_EDITOR_WIDGET_COMMAND_PASTE_AS_PLAIN_TEXT,
+ E_EDITOR_WIDGET_COMMAND_PRINT,
+ E_EDITOR_WIDGET_COMMAND_REDO,
+ E_EDITOR_WIDGET_COMMAND_REMOVE_FORMAT,
+ E_EDITOR_WIDGET_COMMAND_SELECT_ALL,
+ E_EDITOR_WIDGET_COMMAND_STRIKETHROUGH,
+ E_EDITOR_WIDGET_COMMAND_STYLE_WITH_CSS,
+ E_EDITOR_WIDGET_COMMAND_SUBSCRIPT,
+ E_EDITOR_WIDGET_COMMAND_SUPERSCRIPT,
+ E_EDITOR_WIDGET_COMMAND_TRANSPOSE,
+ E_EDITOR_WIDGET_COMMAND_UNDERLINE,
+ E_EDITOR_WIDGET_COMMAND_UNDO,
+ E_EDITOR_WIDGET_COMMAND_UNLINK,
+ E_EDITOR_WIDGET_COMMAND_UNSELECT,
+ E_EDITOR_WIDGET_COMMAND_USE_CSS
+} EEditorWidgetCommand;
+
typedef struct _EEditorWidget EEditorWidget;
typedef struct _EEditorWidgetClass EEditorWidgetClass;
typedef struct _EEditorWidgetPrivate EEditorWidgetPrivate;
@@ -82,6 +194,9 @@ EEditorWidget * e_editor_widget_new (void);
EEditorSelection *
e_editor_widget_get_selection (EEditorWidget *widget);
+gboolean e_editor_widget_exec_command (EEditorWidget *widget,
+ EEditorWidgetCommand command,
+ const gchar *value);
gboolean e_editor_widget_get_changed (EEditorWidget *widget);
void e_editor_widget_set_changed (EEditorWidget *widget,
diff --git a/e-util/e-editor-window.c b/e-util/e-editor-window.c
index 30a4286..9b77aaf 100644
--- a/e-util/e-editor-window.c
+++ b/e-util/e-editor-window.c
@@ -1,6 +1,8 @@
/*
* e-editor-window.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -27,6 +29,15 @@ G_DEFINE_TYPE (
e_editor_window,
GTK_TYPE_WINDOW)
+/**
+ * EEditorWindow:
+ *
+ * A #GtkWindow that contains main toolbars and an #EEditor. To create a
+ * custom editor window, one can subclass this class and pack additional widgets
+ * above and below the editor using #e_editor_window_pack_above() and
+ * #e_editor_window_pack_below().
+ */
+
struct _EEditorWindowPrivate {
EEditor *editor;
GtkGrid *main_layout;
@@ -123,6 +134,14 @@ e_editor_window_init (EEditorWindow *window)
priv->editor_row = 2;
}
+/**
+ * e_editor_window_new:
+ * @type: #GtkWindowType
+ *
+ * Creates a new editor window.
+ *
+ * Returns: A newly created editor window. [transfer-full]
+ */
GtkWidget *
e_editor_window_new (GtkWindowType type)
{
@@ -132,6 +151,12 @@ e_editor_window_new (GtkWindowType type)
NULL);
}
+/**
+ * e_editor_window_get_editor:
+ * @window: an #EEditorWindow
+ *
+ * Returns the #EEditor widget used in this @window.
+ */
EEditor *
e_editor_window_get_editor (EEditorWindow *window)
{
@@ -140,6 +165,15 @@ e_editor_window_get_editor (EEditorWindow *window)
return window->priv->editor;
}
+/**
+ * e_editor_window_pack_above:
+ * @window: an #EEditorWindow
+ * @child: a #GtkWidget
+ *
+ * Inserts @child in between the mail toolbars and the editor widget. If there
+ * are multiple children, the new @child is placed at the end (immediatelly
+ * adjacent to the editor widget)
+ */
void
e_editor_window_pack_above (EEditorWindow *window,
GtkWidget *child)
@@ -157,9 +191,17 @@ e_editor_window_pack_above (EEditorWindow *window,
GTK_POS_TOP, 1, 1);
}
+/**
+ * e_editor_window_pack_below:
+ * @window: an #EEditorWindow
+ * @child: a #GtkWidget
+ *
+ * Inserts @child below the editor widget. If there are multiple children, the
+ * new @child is placed at the end.
+ */
void
e_editor_window_pack_below (EEditorWindow *window,
- GtkWidget *child)
+ GtkWidget *child)
{
g_return_if_fail (E_IS_EDITOR_WINDOW (window));
g_return_if_fail (GTK_IS_WIDGET (child));
diff --git a/e-util/e-editor-window.h b/e-util/e-editor-window.h
index adb9bbc..bcd9e7a 100644
--- a/e-util/e-editor-window.h
+++ b/e-util/e-editor-window.h
@@ -1,6 +1,8 @@
/*
* e-editor-window.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index 3e25ec9..f7aa0b4 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -1,4 +1,7 @@
-/* e-editor.c
+/*
+ * e-editor.c
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
@@ -32,6 +35,13 @@ G_DEFINE_TYPE (
e_editor,
GTK_TYPE_BOX);
+/**
+ * EEditor:
+ *
+ * #EEditor provides GUI for manipulating with properties of #EEditorWidget and
+ * it's #EEditorSelection - i.e. toolbars and actions.
+ */
+
enum {
PROP_0,
PROP_FILENAME
@@ -792,6 +802,13 @@ e_editor_init (EEditor *editor)
editor_actions_init (editor);
}
+/**
+ * e_editor_new:
+ *
+ * Constructs a new #EEditor.
+ *
+ * Returns: A newly created widget. [transfer-full]
+ */
GtkWidget *
e_editor_new (void)
{
@@ -800,6 +817,12 @@ e_editor_new (void)
NULL);
}
+/**
+ * e_editor_get_editor_widget:
+ * @editor: an #EEditor
+ *
+ * Returns instance of #EEditorWidget used in the @editor.
+ */
EEditorWidget *
e_editor_get_editor_widget (EEditor *editor)
{
@@ -808,6 +831,12 @@ e_editor_get_editor_widget (EEditor *editor)
return editor->priv->editor_widget;
}
+/**
+ * e_editor_get_ui_manager:
+ * @editor: an #EEditor
+ *
+ * Returns #GtkUIManager that manages all the actions in the @editor.
+ */
GtkUIManager *
e_editor_get_ui_manager (EEditor *editor)
{
@@ -816,6 +845,13 @@ e_editor_get_ui_manager (EEditor *editor)
return editor->priv->manager;
}
+/**
+ * e_editor_get_action:
+ * @editor: an #EEditor
+ * @action_name: name of action to lookup and return
+ *
+ * Returns: A #GtkAction matching @action_name or @NULL if no such action exists.
+ */
GtkAction *
e_editor_get_action (EEditor *editor,
const gchar *action_name)
@@ -843,6 +879,14 @@ e_editor_get_action (EEditor *editor,
return action;
}
+/**
+ * e_editor_get_action_group:
+ * @editor: an #EEditor
+ * @group_name: name of action group to lookup and return
+ *
+ * Returns: A #GtkActionGroup matching @group_name or @NULL if not such action
+ * group exists.
+ */
GtkActionGroup *
e_editor_get_action_group (EEditor *editor,
const gchar *group_name)
@@ -888,6 +932,12 @@ e_editor_get_managed_widget (EEditor *editor,
return widget;
}
+/**
+ * e_editor_get_filename:
+ * @editor: an #EEditor
+ *
+ * Returns path and name of file to which content of the editor should be saved.
+ */
const gchar *
e_editor_get_filename (EEditor *editor)
{
@@ -896,6 +946,13 @@ e_editor_get_filename (EEditor *editor)
return editor->priv->filename;
}
+/**
+ * e_editor_set_filename:
+ * @editor: an #EEditor
+ * @filename: Target file
+ *
+ * Sets file to which content of the editor should be saved (see #e_editor_save())
+ */
void
e_editor_set_filename (EEditor *editor,
const gchar *filename)
@@ -911,6 +968,18 @@ e_editor_set_filename (EEditor *editor,
g_object_notify (G_OBJECT (editor), "filename");
}
+/**
+ * e_editor_save:
+ * @editor: an #EEditor
+ * @filename: file into which to save the content
+ * @as_html: whether the content should be saved as HTML or plain text
+ * @error:[out] a #GError
+ *
+ * Saves current content of the #EEditorWidget into given file. When @as_html
+ * is @FALSE, the content is first converted into plain text.
+ *
+ * Returns: @TRUE when content is succesfully saved, @FALSE otherwise.
+ */
gboolean
e_editor_save (EEditor *editor,
const gchar *filename,
@@ -953,6 +1022,15 @@ e_editor_save (EEditor *editor,
return TRUE;
}
+/**
+ * e_editor_emit_spell_languages_changed:
+ * @editor: an #EEditor
+ *
+ * Emits "spell-languages-checked" signal on the @editor.
+ *
+ * This function is for internal use by the editor components and should not
+ * be called from outside the editor.
+ */
void
e_editor_emit_spell_languages_changed (EEditor *editor)
{
diff --git a/e-util/e-editor.h b/e-util/e-editor.h
index 1dcfdd0..ab4b352 100644
--- a/e-util/e-editor.h
+++ b/e-util/e-editor.h
@@ -1,4 +1,7 @@
-/* e-editor.h
+/*
+ * e-editor.h
+ *
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-action.c b/e-util/e-emoticon-action.c
index 7ff674c..cc9a640 100644
--- a/e-util/e-emoticon-action.c
+++ b/e-util/e-emoticon-action.c
@@ -1,4 +1,8 @@
-/* e-emoticon-action.c
+/*
+ * e-emoticon-action.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-action.h b/e-util/e-emoticon-action.h
index 388b851..3e62881 100644
--- a/e-util/e-emoticon-action.h
+++ b/e-util/e-emoticon-action.h
@@ -1,4 +1,8 @@
-/* e-emoticon-action.h
+/*
+ * e-emoticon-action.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-chooser-menu.c b/e-util/e-emoticon-chooser-menu.c
index 91cc756..c70c034 100644
--- a/e-util/e-emoticon-chooser-menu.c
+++ b/e-util/e-emoticon-chooser-menu.c
@@ -1,4 +1,8 @@
-/* e-emoticon-chooser-menu.c
+/*
+ * e-emoticon-chooser-menu.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-chooser-menu.h b/e-util/e-emoticon-chooser-menu.h
index bbed9aa..4c17e9d 100644
--- a/e-util/e-emoticon-chooser-menu.h
+++ b/e-util/e-emoticon-chooser-menu.h
@@ -1,4 +1,8 @@
-/* e-emoticon-chooser-menu.h
+/*
+ * e-emoticon-chooser-menu.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-chooser.c b/e-util/e-emoticon-chooser.c
index 4c894a4..550ffc8 100644
--- a/e-util/e-emoticon-chooser.c
+++ b/e-util/e-emoticon-chooser.c
@@ -1,4 +1,8 @@
-/* e-emoticon-chooser.c
+/*
+ * e-emoticon-chooser.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-chooser.h b/e-util/e-emoticon-chooser.h
index f0e3c15..1a82d9b 100644
--- a/e-util/e-emoticon-chooser.h
+++ b/e-util/e-emoticon-chooser.h
@@ -1,4 +1,8 @@
-/* e-emoticon-chooser.h
+/*
+ * e-emoticon-chooser.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-tool-button.c b/e-util/e-emoticon-tool-button.c
index eaf2105..7f28a1e 100644
--- a/e-util/e-emoticon-tool-button.c
+++ b/e-util/e-emoticon-tool-button.c
@@ -1,4 +1,8 @@
-/* e-emoticon-tool-button.c
+/*
+ * e-emoticon-tool-button.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon-tool-button.h b/e-util/e-emoticon-tool-button.h
index 6c1273e..77e0ccf 100644
--- a/e-util/e-emoticon-tool-button.h
+++ b/e-util/e-emoticon-tool-button.h
@@ -1,4 +1,8 @@
-/* e-emoticon-tool-button.h
+/*
+ * e-emoticon-tool-button.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon.c b/e-util/e-emoticon.c
index d5b69c6..76dd512 100644
--- a/e-util/e-emoticon.c
+++ b/e-util/e-emoticon.c
@@ -1,4 +1,8 @@
-/* e-emoticon.c
+/*
+ * e-emoticon.c
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-emoticon.h b/e-util/e-emoticon.h
index 17995d5..d7416de 100644
--- a/e-util/e-emoticon.h
+++ b/e-util/e-emoticon.h
@@ -1,4 +1,8 @@
-/* e-emoticon.h
+/*
+ * e-emoticon.h
+ *
+ * Copyright (C) 2008 Novell, Inc.
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
diff --git a/e-util/e-image-chooser-dialog.c b/e-util/e-image-chooser-dialog.c
index 17daca3..49fcd66 100644
--- a/e-util/e-image-chooser-dialog.c
+++ b/e-util/e-image-chooser-dialog.c
@@ -1,6 +1,8 @@
/*
* e-image-chooser-dialog.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/e-image-chooser-dialog.h b/e-util/e-image-chooser-dialog.h
index 82f8cec..967fddf 100644
--- a/e-util/e-image-chooser-dialog.h
+++ b/e-util/e-image-chooser-dialog.h
@@ -1,6 +1,8 @@
/*
* e-image-chooser-dialog.h
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Lesser General Public
* License as published by the Free Software Foundation.
diff --git a/e-util/test-editor.c b/e-util/test-editor.c
index dc92037..ea96790 100644
--- a/e-util/test-editor.c
+++ b/e-util/test-editor.c
@@ -1,6 +1,8 @@
/*
* e-editor-test.c
*
+ * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]