[geany/geany-plugins] cc8a8b: pohelper: Add keybindings to go to any previous/next message
Colomban Wendling
git-noreply at xxxxx
Wed Mar 13 00:45:34 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Wed, 13 Mar 2013 00:45:34 UTC
Commit: cc8a8ba90591fcefc1700377fd33ea18975dc783
https://github.com/geany/geany-plugins/commit/cc8a8ba90591fcefc1700377fd33ea18975dc783
Log Message:
-----------
pohelper: Add keybindings to go to any previous/next message
Add keybindings for previous and next message, no matter whether they
are translated or not.
Modified Paths:
--------------
pohelper/README
pohelper/src/gph-plugin.c
Modified: pohelper/README
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -16,7 +16,7 @@ format and to translators.
Features
--------
-* Navigation between untranslated or fuzzy messages;
+* Navigation between all, untranslated or fuzzy messages;
* Reformatting of the translation (reflow);
* Toggling the fuzziness of a translation;
* Pasting of the untranslated string to the translation;
Modified: pohelper/src/gph-plugin.c
53 files changed, 53 insertions(+), 0 deletions(-)
===================================================================
@@ -52,6 +52,8 @@
enum {
+ GPH_KB_GOTO_PREV,
+ GPH_KB_GOTO_NEXT,
GPH_KB_GOTO_PREV_UNTRANSLATED,
GPH_KB_GOTO_NEXT_UNTRANSLATED,
GPH_KB_GOTO_PREV_FUZZY,
@@ -283,6 +285,35 @@ enum {
/* goto */
static void
+goto_prev (GeanyDocument *doc)
+{
+ if (doc_is_po (doc)) {
+ gint pos = sci_get_current_position (doc->editor->sci);
+
+ pos = find_style (doc->editor->sci, SCE_PO_MSGID, pos, 0);
+ if (pos >= 0) {
+ pos = find_message (doc, pos, 0);
+ if (pos >= 0) {
+ editor_goto_pos (doc->editor, pos, FALSE);
+ }
+ }
+ }
+}
+
+static void
+goto_next (GeanyDocument *doc)
+{
+ if (doc_is_po (doc)) {
+ gint pos = find_message (doc, sci_get_current_position (doc->editor->sci),
+ sci_get_length (doc->editor->sci));
+
+ if (pos >= 0) {
+ editor_goto_pos (doc->editor, pos, FALSE);
+ }
+ }
+}
+
+static void
goto_prev_untranslated (GeanyDocument *doc)
{
if (doc_is_po (doc)) {
@@ -409,6 +440,18 @@ enum {
}
static void
+on_kb_goto_prev (guint key_id)
+{
+ goto_prev (document_get_current ());
+}
+
+static void
+on_kb_goto_next (guint key_id)
+{
+ goto_next (document_get_current ());
+}
+
+static void
on_kb_goto_prev_untranslated (guint key_id)
{
goto_prev_untranslated (document_get_current ());
@@ -896,6 +939,16 @@ enum {
/* add keybindings */
group = plugin_set_key_group (geany_plugin, "pohelper", GPH_KB_COUNT, NULL);
+ keybindings_set_item (group, GPH_KB_GOTO_PREV,
+ on_kb_goto_prev, 0, 0,
+ "goto-prev",
+ _("Go to previous string"),
+ NULL);
+ keybindings_set_item (group, GPH_KB_GOTO_NEXT,
+ on_kb_goto_next, 0, 0,
+ "goto-next",
+ _("Go to next string"),
+ NULL);
keybindings_set_item (group, GPH_KB_GOTO_PREV_UNTRANSLATED,
on_kb_goto_prev_untranslated, 0, 0,
"goto-prev-untranslated",
--------------
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