[evolution/webkit-composer: 93/185] Add documentation to basic classes and update copyright
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit-composer: 93/185] Add documentation to basic classes and update copyright
- Date: Sat, 13 Apr 2013 15:36:08 +0000 (UTC)
commit 87424d8470c1e7fd69e0acf992760e3a47fb21ec
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 | 2 +
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 | 4 +-
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 | 504 ++++++++++++++++++++++++++++++++---
e-util/e-editor-selection.h | 6 +-
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 | 344 +++++++++++++++++++++++-
e-util/e-editor-widget.h | 7 +-
e-util/e-editor-window.c | 44 ++-
e-util/e-editor-window.h | 2 +
e-util/e-editor.c | 81 +++++-
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, 1116 insertions(+), 70 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..d217481 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
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..f067053 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
@@ -334,7 +336,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..967c255 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,10 +225,10 @@ 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",
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,20 @@ 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,
+ 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 +458,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 +474,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 +490,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 +505,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 +522,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 +537,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 +556,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 +572,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 +588,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 +604,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 +620,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 +636,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 +652,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 +667,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 +691,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 +740,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 +765,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 +795,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 +819,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 +844,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,6 +902,13 @@ 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)
@@ -799,9 +942,17 @@ e_editor_selection_set_alignment (EEditorSelection *selection,
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,6 +972,14 @@ 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)
@@ -837,6 +996,14 @@ e_editor_selection_set_background_color (EEditorSelection *selection,
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,6 +1068,13 @@ 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)
@@ -1018,7 +1192,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,6 +1217,14 @@ 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)
@@ -1059,6 +1248,15 @@ e_editor_selection_set_font_color (EEditorSelection *selection,
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,6 +1277,14 @@ 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)
@@ -1093,7 +1299,13 @@ e_editor_selection_set_font_name (EEditorSelection *selection,
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,6 +1330,14 @@ 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)
@@ -1135,7 +1355,14 @@ e_editor_selection_set_font_size (EEditorSelection *selection,
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 +1372,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,6 +1389,12 @@ 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)
{
@@ -1166,6 +1408,12 @@ e_editor_selection_indent (EEditorSelection *selection)
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)
{
@@ -1179,6 +1427,15 @@ e_editor_selection_unindent (EEditorSelection *selection)
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,6 +1444,14 @@ 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)
@@ -1206,6 +1471,15 @@ e_editor_selection_set_bold (EEditorSelection *selection,
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,6 +1488,14 @@ 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)
@@ -1233,6 +1515,15 @@ e_editor_selection_set_italic (EEditorSelection *selection,
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 +1532,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)
@@ -1287,6 +1586,15 @@ e_editor_selection_set_monospaced (EEditorSelection *selection,
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,6 +1603,14 @@ 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)
@@ -1314,6 +1630,15 @@ e_editor_selection_set_strike_through (EEditorSelection *selection,
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,6 +1667,14 @@ 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)
@@ -1361,6 +1694,15 @@ e_editor_selection_set_subscript (EEditorSelection *selection,
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,6 +1731,14 @@ 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)
@@ -1408,6 +1758,15 @@ e_editor_selection_set_superscript (EEditorSelection *selection,
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,6 +1775,14 @@ 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)
@@ -1435,6 +1802,13 @@ e_editor_selection_set_underline (EEditorSelection *selection,
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)
{
@@ -1446,6 +1820,13 @@ e_editor_selection_unlink (EEditorSelection *selection)
webkit_dom_document_exec_command (document, "unlink", FALSE, "");
}
+/**
+ * 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)
@@ -1459,7 +1840,14 @@ e_editor_selection_create_link (EEditorSelection *selection,
webkit_dom_document_exec_command (document, "createLink", FALSE, 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)
@@ -1475,6 +1863,14 @@ e_editor_selection_insert_text (EEditorSelection *selection,
document, "insertText", FALSE, 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)
@@ -1489,6 +1885,14 @@ e_editor_selection_insert_html (EEditorSelection *selection,
document, "insertHTML", FALSE, 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)
@@ -1547,6 +1951,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 +2080,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 +2166,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..4d62cca 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
@@ -24,7 +26,6 @@
#define E_EDITOR_SELECTION_H
#include <glib-object.h>
-#include <webkit/webkit.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 d91c6cb..01a1a17 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..8730edc 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,
@@ -733,6 +745,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 +761,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 +777,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 +794,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 +811,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 +826,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 +842,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 +858,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 +874,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 +890,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 +906,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 +920,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),
@@ -909,8 +988,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 +1025,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 +1057,87 @@ e_editor_widget_get_selection (EEditorWidget *widget)
return widget->priv->selection;
}
+/**
+ * e_editor_widget_exec_command:
+ * @widget: an #EEditorWidget
+ * @command: a command to execute
+ * @value: value of the command (or @NULL)
+ *
+ * Supported @command keywords are:
+ * "BackColor" - sets background color to @value
+ * "Bold" - toggles bold text, depending whether @value is "true" or "false"
+ * "Copy" - copies current selection to clipboard
+ * "CreateLink" - converts current selection to a link that points to URL in @value
+ * "Cut" - cuts current selection to clipboard
+ * "DefaultParagraphSeparator"
+ * "Delete" - deletes current selection
+ * "FindString" - highlights string passed in @value
+ * "FontName" - sets font name to @value
+ * "FontSize" - sets font point size to @value (no units, just number)
+ * "FontSizeDelta" - changes font size by delta passed in @value (no units, just number)
+ * "FontColor" - sets font color to @value
+ * "FormatBlock" - formats block to given formatting. Allowed formatting keywords are "BLOCKQUOTE",
+ * "H1", "H2", "H3", "H4", "H5", "H6", "P", "PRE" and "ADDRESS"
+ * "ForwardDelete"
+ * "HiliteColor" - sets color in which results of "FindString" command should be highlighted to @value
+ * "Indent" - indents current paragraph
+ * "InsertHTML" - inserts content of @value into document as an HTML code
+ * "InsertHorizontalRule" - inserts <HR> on current line
+ * "InsertImage" - inserts an image with URL contained in @value into document
+ * "InsertLineBreak" - breaks line at current cursor position
+ * "InsertNewlineInQuotedContent - breaks citation at current cursor position
+ * "InsertOrderedList - inserts <OL> environment
+ * "InsertParagraph - inserts <P> environment
+ * "InsertText - inserts content of @value as text
+ * "InsertUnorderedList" - inserts <UL> environment
+ * "Italic" - toggles italic format depending on whether @value is "true" or "false"
+ * "JustifyCenter" - aligns current paragraph to center
+ * "JustifyFull" - justifies current paragraph to block
+ * "JustifyLeft" - aligns current paragraph to left
+ * "JustifyNone" - cancels any justification or alignment of current paragraph
+ * "JustifyRight" - aligns current paragraph to right
+ * "Outdent" - outdents current paragraph
+ * "Paste" - pastes clipboard content at current cursor position
+ * "PasteAndMatchStyle" - pastes clipboard content and matches it's style to style at current cursor
position
+ * "PasteAsPlainText" - pastes clipboard content at current cursor position removing any HTML formatting
+ * "Print" - initiates printing of current document
+ * "Redo"
+ * "RemoveFormat" - removes any formatting of current selection
+ * "SelectAll" - selects the entire document
+ * "Strikethrough" - toggles strikethrough formatting depending on whether @value is "true" or "false"
+ * "StyleWithCSS" - toggles whether style should be defined in CSS "style" attribute of elements or
+ * whether to use deprecated <FONT> tags. Depends on whether @value is "true" or "false"
+ * "Subscript" - toggles subscript of current selection depending on whether @value is "true" or "false"
+ * "Superscript" - toggles superscript of current selection depending on whether @value is "true" or
"false"
+ * "Transpose"
+ * "Underline" - toggles underline formatting of current selection depending on whether @value is "true"
or "false"
+ * "Undo"
+ * "Unlink" - removes links (<A>) from current selection (if there's any)
+ * "Unselect" - cancels current selection
+ * "UseCSS" - whether to allow use of CSS or not depending on whether @value is "true" or "false"
+ */
+gboolean
+e_editor_widget_exec_command (EEditorWidget* widget,
+ const gchar* command,
+ const gchar* value)
+{
+ WebKitDOMDocument *document;
+
+ g_return_if_fail (E_IS_EDITOR_WIDGET (widget));
+ g_return_if_fail (command && *command);
+
+ document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (widget));
+ return webkit_dom_document_exec_command (document, command, FALSE, 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 +1146,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 +1169,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 +1187,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 +1274,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 +1292,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 +1313,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 +1330,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 +1351,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 +1369,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 +1390,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,9 +1408,17 @@ 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)
+ const GList *spell_languages)
{
g_return_if_fail (E_IS_EDITOR_WIDGET (widget));
g_return_if_fail (spell_languages);
@@ -1153,13 +1430,28 @@ e_editor_widget_set_spell_languages (EEditorWidget *widget,
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 +1548,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 +1574,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)
@@ -1296,6 +1604,13 @@ do_set_text_plain (EEditorWidget *widget,
document, "insertText", FALSE, 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 +1628,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 +1647,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)
{
diff --git a/e-util/e-editor-widget.h b/e-util/e-editor-widget.h
index 23d5149..6b94d19 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
@@ -82,6 +84,9 @@ EEditorWidget * e_editor_widget_new (void);
EEditorSelection *
e_editor_widget_get_selection (EEditorWidget *widget);
+gboolean e_editor_widget_exec_command (EEditorWidget *widget,
+ const gchar *command,
+ const gchar *value);
gboolean e_editor_widget_get_changed (EEditorWidget *widget);
void e_editor_widget_set_changed (EEditorWidget *widget,
@@ -109,7 +114,7 @@ GList * e_editor_widget_get_spell_languages
(EEditorWidget *widget);
void e_editor_widget_set_spell_languages
(EEditorWidget *widget,
- GList *spell_languages);
+ const GList *spell_languages);
ESpellChecker * e_editor_widget_get_spell_checker
(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..2d127c6 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,19 @@ 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 +1023,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]