[evolution] EHTMLEditor - Refactor the core editor actions (indent, unindent, ..) to their own group
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EHTMLEditor - Refactor the core editor actions (indent, unindent, ..) to their own group
- Date: Wed, 5 Nov 2014 10:54:35 +0000 (UTC)
commit 1aac2f650e1ba249ae192ca8764f183cd87a0a30
Author: Tomas Popela <tpopela redhat com>
Date: Wed Nov 5 11:48:06 2014 +0100
EHTMLEditor - Refactor the core editor actions (indent, unindent, ..) to their own group
e-util/e-html-editor-actions.c | 168 +++++++++++++++++++++-------------------
e-util/e-html-editor-private.h | 1 +
e-util/e-html-editor.c | 2 +
3 files changed, 92 insertions(+), 79 deletions(-)
---
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index 7bb7e23..3e9ea95 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -631,7 +631,7 @@ update_mode_combobox (gpointer data)
is_html = e_html_editor_view_get_html_mode (view);
action = gtk_action_group_get_action (
- editor->priv->core_actions, "mode-html");
+ editor->priv->core_editor_actions, "mode-html");
gtk_radio_action_set_current_value (
GTK_RADIO_ACTION (action), (is_html ? 1 : 0));
@@ -945,27 +945,6 @@ static GtkActionEntry core_entries[] = {
N_("Cut selected text to the clipboard"),
G_CALLBACK (action_cut_cb) },
- { "indent",
- "format-indent-more",
- N_("_Increase Indent"),
- "<Control>bracketright",
- N_("Increase Indent"),
- G_CALLBACK (action_indent_cb) },
-
- { "insert-html-file",
- NULL,
- N_("_HTML File..."),
- NULL,
- NULL,
- G_CALLBACK (action_insert_html_file_cb) },
-
- { "insert-text-file",
- NULL,
- N_("Te_xt File..."),
- NULL,
- NULL,
- G_CALLBACK (action_insert_text_file_cb) },
-
{ "paste",
"edit-paste",
N_("_Paste"),
@@ -973,13 +952,6 @@ static GtkActionEntry core_entries[] = {
N_("Paste text from the clipboard"),
G_CALLBACK (action_paste_cb) },
- { "paste-quote",
- NULL,
- N_("Paste _Quotation"),
- "<Shift><Control>v",
- NULL,
- G_CALLBACK (action_paste_quote_cb) },
-
{ "redo",
"edit-redo",
N_("_Redo"),
@@ -994,34 +966,6 @@ static GtkActionEntry core_entries[] = {
NULL,
G_CALLBACK (action_select_all_cb) },
- { "show-find",
- "edit-find",
- N_("_Find..."),
- "<Control>f",
- N_("Search for text"),
- G_CALLBACK (action_show_find_cb) },
-
- { "find-again",
- NULL,
- N_("Find A_gain"),
- "<Control>g",
- NULL,
- G_CALLBACK (action_find_again_cb) },
-
- { "show-replace",
- "edit-find-replace",
- N_("Re_place..."),
- "<Control>h",
- N_("Search for and replace text"),
- G_CALLBACK (action_show_replace_cb) },
-
- { "spell-check",
- "tools-check-spelling",
- N_("Check _Spelling..."),
- "F7",
- NULL,
- G_CALLBACK (action_spell_check_cb) },
-
{ "undo",
"edit-undo",
N_("_Undo"),
@@ -1029,27 +973,6 @@ static GtkActionEntry core_entries[] = {
N_("Undo the last action"),
G_CALLBACK (action_undo_cb) },
- { "unindent",
- "format-indent-less",
- N_("_Decrease Indent"),
- "<Control>bracketleft",
- N_("Decrease Indent"),
- G_CALLBACK (action_unindent_cb) },
-
- { "wrap-lines",
- NULL,
- N_("_Wrap Lines"),
- "<Control>k",
- NULL,
- G_CALLBACK (action_wrap_lines_cb) },
-
- { "webkit-inspector",
- NULL,
- N_("Open Inspector"),
- NULL,
- NULL,
- G_CALLBACK (action_show_webkit_inspector_cb) },
-
/* Menus */
{ "edit-menu",
@@ -1109,6 +1032,86 @@ static GtkActionEntry core_entries[] = {
NULL }
};
+static GtkActionEntry core_editor_entries[] = {
+
+ { "indent",
+ "format-indent-more",
+ N_("_Increase Indent"),
+ "<Control>bracketright",
+ N_("Increase Indent"),
+ G_CALLBACK (action_indent_cb) },
+
+ { "insert-html-file",
+ NULL,
+ N_("_HTML File..."),
+ NULL,
+ NULL,
+ G_CALLBACK (action_insert_html_file_cb) },
+
+ { "insert-text-file",
+ NULL,
+ N_("Te_xt File..."),
+ NULL,
+ NULL,
+ G_CALLBACK (action_insert_text_file_cb) },
+
+ { "paste-quote",
+ NULL,
+ N_("Paste _Quotation"),
+ "<Shift><Control>v",
+ NULL,
+ G_CALLBACK (action_paste_quote_cb) },
+
+ { "show-find",
+ "edit-find",
+ N_("_Find..."),
+ "<Control>f",
+ N_("Search for text"),
+ G_CALLBACK (action_show_find_cb) },
+
+ { "find-again",
+ NULL,
+ N_("Find A_gain"),
+ "<Control>g",
+ NULL,
+ G_CALLBACK (action_find_again_cb) },
+
+ { "show-replace",
+ "edit-find-replace",
+ N_("Re_place..."),
+ "<Control>h",
+ N_("Search for and replace text"),
+ G_CALLBACK (action_show_replace_cb) },
+
+ { "spell-check",
+ "tools-check-spelling",
+ N_("Check _Spelling..."),
+ "F7",
+ NULL,
+ G_CALLBACK (action_spell_check_cb) },
+
+ { "unindent",
+ "format-indent-less",
+ N_("_Decrease Indent"),
+ "<Control>bracketleft",
+ N_("Decrease Indent"),
+ G_CALLBACK (action_unindent_cb) },
+
+ { "wrap-lines",
+ NULL,
+ N_("_Wrap Lines"),
+ "<Control>k",
+ NULL,
+ G_CALLBACK (action_wrap_lines_cb) },
+
+ { "webkit-inspector",
+ NULL,
+ N_("Open Inspector"),
+ NULL,
+ NULL,
+ G_CALLBACK (action_show_webkit_inspector_cb) },
+};
+
static GtkRadioActionEntry core_justify_entries[] = {
{ "justify-center",
@@ -1842,6 +1845,13 @@ editor_actions_init (EHTMLEditor *editor)
gtk_action_group_add_actions (
action_group, core_entries,
G_N_ELEMENTS (core_entries), editor);
+ gtk_ui_manager_insert_action_group (manager, action_group, 0);
+
+ action_group = editor->priv->core_editor_actions;
+ gtk_action_group_set_translation_domain (action_group, domain);
+ gtk_action_group_add_actions (
+ action_group, core_editor_entries,
+ G_N_ELEMENTS (core_editor_entries), editor);
gtk_action_group_add_radio_actions (
action_group, core_justify_entries,
G_N_ELEMENTS (core_justify_entries),
@@ -2020,7 +2030,7 @@ editor_actions_init (EHTMLEditor *editor)
/* Disable all actions and toolbars when editor is not editable */
g_object_bind_property (
view, "editable",
- editor->priv->core_actions, "sensitive",
+ editor->priv->core_editor_actions, "sensitive",
G_BINDING_SYNC_CREATE);
g_object_bind_property (
view, "editable",
diff --git a/e-util/e-html-editor-private.h b/e-util/e-html-editor-private.h
index dc4658b..98823e6 100644
--- a/e-util/e-html-editor-private.h
+++ b/e-util/e-html-editor-private.h
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
struct _EHTMLEditorPrivate {
GtkUIManager *manager;
GtkActionGroup *core_actions;
+ GtkActionGroup *core_editor_actions;
GtkActionGroup *html_actions;
GtkActionGroup *context_actions;
GtkActionGroup *html_context_actions;
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index 8d276e8..750e005 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -735,6 +735,7 @@ html_editor_dispose (GObject *object)
g_clear_object (&priv->manager);
g_clear_object (&priv->core_actions);
+ g_clear_object (&priv->core_editor_actions);
g_clear_object (&priv->html_actions);
g_clear_object (&priv->context_actions);
g_clear_object (&priv->html_context_actions);
@@ -866,6 +867,7 @@ e_html_editor_init (EHTMLEditor *editor)
priv->manager = gtk_ui_manager_new ();
priv->core_actions = gtk_action_group_new ("core");
+ priv->core_editor_actions = gtk_action_group_new ("core-editor");
priv->html_actions = gtk_action_group_new ("html");
priv->context_actions = gtk_action_group_new ("core-context");
priv->html_context_actions = gtk_action_group_new ("html-context");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]