[geany/geany-plugins] 06678d: Enable Mark Word also for newly opened documents

Enrico Tröger git-noreply at xxxxx
Mon Apr 17 21:49:54 UTC 2017


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Mon, 17 Apr 2017 21:49:54 UTC
Commit:      06678d16c0d373f5f1418ec0d485e86e614642d0
             https://github.com/geany/geany-plugins/commit/06678d16c0d373f5f1418ec0d485e86e614642d0

Log Message:
-----------
Enable Mark Word also for newly opened documents

This broke in 26e6906ed5eeab0adf5c7ad0ea177f99a3e49ea5, before the
Addons' feature "Mark Word" was enabled for all documents but after
changing the trigger to button-press-event, we connected the signal only
on "document-open" not on "document-new".

Fixes #562.


Modified Paths:
--------------
    addons/src/addons.c
    addons/src/ao_markword.c
    addons/src/ao_markword.h

Modified: addons/src/addons.c
10 lines changed, 10 insertions(+), 0 deletions(-)
===================================================================
@@ -104,6 +104,7 @@ static AddonsInfo *ao_info = NULL;
 static void ao_update_editor_menu_cb(GObject *obj, const gchar *word, gint pos,
 									 GeanyDocument *doc, gpointer data);
 static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer data);
+static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data);
 static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data);
 static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data);
 static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointer data);
@@ -120,6 +121,7 @@ PluginCallback plugin_callbacks[] =
 	{ "update-editor-menu", (GCallback) &ao_update_editor_menu_cb, FALSE, NULL },
 	{ "editor-notify", (GCallback) &ao_editor_notify_cb, TRUE, NULL },
 
+	{ "document-new", (GCallback) &ao_document_new_cb, TRUE, NULL },
 	{ "document-open", (GCallback) &ao_document_open_cb, TRUE, NULL },
 	{ "document-save", (GCallback) &ao_document_save_cb, TRUE, NULL },
 	{ "document-close", (GCallback) &ao_document_close_cb, TRUE, NULL },
@@ -199,6 +201,14 @@ static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer d
 }
 
 
+static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data)
+{
+	g_return_if_fail(doc != NULL && doc->is_valid);
+
+	ao_mark_document_new(ao_info->markword, doc);
+}
+
+
 static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data)
 {
 	g_return_if_fail(doc != NULL && doc->is_valid);


Modified: addons/src/ao_markword.c
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -172,6 +172,13 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton *
 }
 
 
+void ao_mark_document_new(AoMarkWord *mw, GeanyDocument *document)
+{
+	/* there is nothing different to handling open documents, so do the same */
+	ao_mark_document_open(mw, document);
+}
+
+
 void ao_mark_document_open(AoMarkWord *mw, GeanyDocument *document)
 {
 	g_return_if_fail(DOC_VALID(document));


Modified: addons/src/ao_markword.h
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -41,6 +41,7 @@ typedef struct _AoMarkWordClass			AoMarkWordClass;
 
 GType			ao_mark_word_get_type		(void);
 AoMarkWord*		ao_mark_word_new			(gboolean enable, gboolean single_click_deselect);
+void			ao_mark_document_new		(AoMarkWord *mw, GeanyDocument *document);
 void			ao_mark_document_open		(AoMarkWord *mw, GeanyDocument *document);
 void			ao_mark_document_close		(AoMarkWord *mw, GeanyDocument *document);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list