Revision: 2075 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2075&view=re... Author: codebrainz Date: 2011-05-23 08:28:15 +0000 (Mon, 23 May 2011)
Log Message: ----------- Add new keybindings and cleanup some code.
Modified Paths: -------------- trunk/geany-plugins/devhelp/src/manpages.c trunk/geany-plugins/devhelp/src/plugin.c
Modified: trunk/geany-plugins/devhelp/src/manpages.c =================================================================== --- trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 07:18:58 UTC (rev 2074) +++ trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 08:28:15 UTC (rev 2075) @@ -111,7 +111,7 @@ }
pclose(fp); - return g_strstrip(text); + return text; }
@@ -148,7 +148,7 @@ return NULL; } html_text = g_strdup_printf("<html><head><title>%s</title></head>" - "<body><pre>%s</pre></body></html>", term, text+6 /* wtf? */); + "<body><pre>%s</pre></body></html>", term, text); g_free(text);
len = strlen(html_text);
Modified: trunk/geany-plugins/devhelp/src/plugin.c =================================================================== --- trunk/geany-plugins/devhelp/src/plugin.c 2011-05-23 07:18:58 UTC (rev 2074) +++ trunk/geany-plugins/devhelp/src/plugin.c 2011-05-23 08:28:15 UTC (rev 2075) @@ -34,7 +34,8 @@
PLUGIN_SET_INFO( _("Devhelp Plugin"), - _("Adds built-in Devhelp support."), + _("Adds support for looking up documentation in Devhelp, manual pages, and " + "Google Code Search in the integrated viewer."), "1.0", "Matthew Brush mbrush@leftclick.ca")
@@ -52,6 +53,8 @@ KB_DEVHELP_TOGGLE_WEBVIEW, KB_DEVHELP_ACTIVATE_DEVHELP, KB_DEVHELP_SEARCH_SYMBOL, + KB_DEVHELP_SEARCH_MANPAGES, + KB_DEVHELP_SEARCH_CODESEARCH, KB_COUNT };
@@ -63,6 +66,8 @@ /* Called when a keybinding is activated */ static void kb_activate(guint key_id) { + gchar *current_tag; + switch (key_id) { case KB_DEVHELP_TOGGLE_CONTENTS: @@ -79,13 +84,39 @@ break; case KB_DEVHELP_SEARCH_SYMBOL: { - gchar *current_tag = devhelp_plugin_get_current_tag(); + current_tag = devhelp_plugin_get_current_tag(); if (current_tag == NULL) return; - devhelp_plugin_search(plugin.devhelp, current_tag); + devhelp_plugin_search_books(plugin.devhelp, current_tag); g_free(current_tag); break; } + case KB_DEVHELP_SEARCH_MANPAGES: + { + current_tag = devhelp_plugin_get_current_tag(); + if (current_tag == NULL) + return; + devhelp_plugin_search_manpages(plugin.devhelp, current_tag); + g_free(current_tag); + break; + } + case KB_DEVHELP_SEARCH_CODESEARCH: + { + const gchar *lang = NULL; + GeanyDocument *doc; + + if ((current_tag = devhelp_plugin_get_current_tag()) == NULL) + return; + + doc = document_get_current(); + if (doc == NULL || doc->file_type == NULL || doc->file_type->name == NULL) + lang = doc->file_type->name; + + devhelp_plugin_search_code(plugin.devhelp, current_tag, lang); + + g_free(current_tag); + break; + } } }
@@ -293,15 +324,19 @@ key_group = plugin_set_key_group(geany_plugin, "devhelp", KB_COUNT, NULL);
keybindings_set_item(key_group, KB_DEVHELP_TOGGLE_CONTENTS, kb_activate, - 0, 0, "devhelp_toggle_contents", _("Toggle Devhelp (Contents Tab)"), NULL); + 0, 0, "devhelp_toggle_contents", _("Toggle sidebar contents tab"), NULL); keybindings_set_item(key_group, KB_DEVHELP_TOGGLE_SEARCH, kb_activate, - 0, 0, "devhelp_toggle_search", _("Toggle Devhelp (Search Tab)"), NULL); + 0, 0, "devhelp_toggle_search", _("Toggle sidebar search tab"), NULL); keybindings_set_item(key_group, KB_DEVHELP_TOGGLE_WEBVIEW, kb_activate, - 0, 0, "devhelp_toggle_webview", _("Toggle Devhelp (Documents Tab)"), NULL); + 0, 0, "devhelp_toggle_webview", _("Toggle documentation tab"), NULL); keybindings_set_item(key_group, KB_DEVHELP_ACTIVATE_DEVHELP, kb_activate, - 0, 0, "devhelp_activate_all", _("Activate all Devhelp tabs"), NULL); + 0, 0, "devhelp_activate_all", _("Activate all tabs"), NULL); keybindings_set_item(key_group, KB_DEVHELP_SEARCH_SYMBOL, kb_activate, - 0, 0, "devhelp_search_symbol", _("Search for Current Symbol/Tag"), NULL); + 0, 0, "devhelp_search_symbol", _("Search for current tag in Devhelp"), NULL); + keybindings_set_item(key_group, KB_DEVHELP_SEARCH_MANPAGES, kb_activate, + 0, 0, "devhelp_search_manpages", _("Search for current tag in Manual Pages"), NULL); + keybindings_set_item(key_group, KB_DEVHELP_SEARCH_CODESEARCH, kb_activate, + 0, 0, "devhelp_search_codesearch", _("Search for current tag in Google Code Search"), NULL); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.