Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

devhelp: Remove support for Google Code Search, service is shutdown

  • Loading branch information...
commit 68e3f64ead2ee0778257238def70da24fef5bc3d 1 parent 23df993
@codebrainz authored
View
1  devhelp/src/Makefile.am
@@ -10,7 +10,6 @@ EXTRA_LTLIBRARIES = devhelp.la
endif
devhelp_la_SOURCES = \
- dhp-codesearch.c \
dhp-manpages.c \
dhp-object.c \
dhp-plugin.c
View
101 devhelp/src/dhp-codesearch.c
@@ -1,101 +0,0 @@
-#include <glib.h>
-#include <webkit/webkitwebview.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <geanyplugin.h>
-
-#include "dhp.h"
-
-
-struct LangMapEnt
-{
- const gchar *geany_name;
- const gchar *google_name;
-};
-
-
-#define GOOGLE_CODE_SEARCH_URI "http://www.google.com/codesearch"
-
-#define LANG_MAP_MAX 33 /* update this with lang_map[] size below */
-
-/* maps Geany language names to Google Code language names */
-static const struct LangMapEnt lang_map[LANG_MAP_MAX] = {
- { "ActionScript", "actionscript" },
- { "Ada", "ada" },
- { "ASM", "assembly" },
- { "FreeBasic", "basic" },
- { "C", "c" },
- { "C++", "c++" },
- { "C#", "c#" },
- { "COBOL", "cobol" },
- { "CSS", "css" },
- { "D", "d" },
- { "Erlang", "erlang" },
- { "Fortran", "fortran" },
- { "Haskell", "haskell" },
- { "Java", "java" },
- { "Javascript", "javascript" },
- { "Lisp", "lisp" },
- { "Lua", "lua" },
- { "Make", "makefile" },
- { "Matlab/Octave", "matlab" },
- { "CAML", "ocaml" },
- { "Pascal", "pascal" },
- { "Perl", "perl" },
- { "PHP", "php" },
- { "Python", "python" },
- { "R", "r" },
- { "Ruby", "ruby" },
- { "Sh", "shell" },
- { "SQL", "sql" },
- { "Tcl", "tcl" },
- { "LaTeX", "tex" },
- { "Verilog", "verilog" },
- { "VHDL", "vhdl" },
- { "None", NULL }
-};
-
-
-void devhelp_plugin_search_code(DevhelpPlugin *self, const gchar *term, const gchar *lang)
-{
- gint i;
- gchar *uri, *term_enc, *lang_enc;
- const gchar *google_lang = NULL;
-
- g_return_if_fail(self != NULL);
- g_return_if_fail(term != NULL);
-
- if (lang != NULL)
- {
- for (i = 0; i < LANG_MAP_MAX; i++)
- {
- if (g_strcmp0(lang, lang_map[i].geany_name) == 0)
- {
- google_lang = lang_map[i].google_name;
- break;
- }
- }
- }
-
- if (google_lang != NULL)
- {
- lang_enc = g_uri_escape_string(google_lang, NULL, TRUE);
- term_enc = g_uri_escape_string(term, NULL, TRUE);
- uri = g_strdup_printf("%s?as_q=%s&as_lang=%s", GOOGLE_CODE_SEARCH_URI, term_enc, lang_enc);
- g_free(lang_enc);
- g_free(term_enc);
- }
- else
- {
- term_enc = g_uri_escape_string(term, NULL, TRUE);
- uri = g_strdup_printf("%s?as_q=%s", GOOGLE_CODE_SEARCH_URI, term_enc);
- g_free(term_enc);
- }
-
- webkit_web_view_open(devhelp_plugin_get_webview(self), uri);
- g_free(uri);
-
- devhelp_plugin_activate_webview_tab(self);
-}
View
29 devhelp/src/dhp-object.c
@@ -119,7 +119,6 @@ static DhBase *dhbase = NULL;
/* Internal callbacks */
static void on_search_help_activate(GtkMenuItem * menuitem, DevhelpPlugin *self);
static void on_search_help_man_activate(GtkMenuItem * menuitem, DevhelpPlugin *self);
-static void on_search_help_code_activate(GtkMenuItem *menuitem, DevhelpPlugin *self);
static void on_editor_menu_popup(GtkWidget * widget, DevhelpPlugin *self);
static void on_link_clicked(GObject * ignored, DhLink * dhlink, DevhelpPlugin *self);
static void on_back_button_clicked(GtkToolButton * btn, DevhelpPlugin *self);
@@ -377,7 +376,7 @@ static void devhelp_plugin_init_dh(DevhelpPlugin *self)
/* Initialize the stuff in the editor's context menu */
static void devhelp_plugin_init_edit_menu(DevhelpPlugin *self)
{
- GtkWidget *doc_menu, *devhelp_item, *code_item, *man_item;
+ GtkWidget *doc_menu, *devhelp_item, *man_item;
DevhelpPluginPrivate *p;
g_return_if_fail(self != NULL);
@@ -401,11 +400,6 @@ static void devhelp_plugin_init_edit_menu(DevhelpPlugin *self)
gtk_widget_show(man_item);
}
- code_item = gtk_menu_item_new_with_label(_("Google Code"));
- gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), code_item);
- g_signal_connect(code_item, "activate", G_CALLBACK(on_search_help_code_activate), self);
- gtk_widget_show(code_item);
-
g_signal_connect(geany->main_widgets->editor_menu, "show", G_CALLBACK(on_editor_menu_popup), self);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(p->editor_menu_item), doc_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(geany->main_widgets->editor_menu), p->editor_menu_sep);
@@ -1277,27 +1271,6 @@ static void on_search_help_man_activate(GtkMenuItem * menuitem, DevhelpPlugin *s
}
-static void on_search_help_code_activate(GtkMenuItem *menuitem, DevhelpPlugin *self)
-{
- gchar *current_tag;
- const gchar *lang = NULL;
- GeanyDocument *doc;
-
- g_return_if_fail(self != NULL);
-
- if ((current_tag = devhelp_plugin_get_current_word(self)) == 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(self, current_tag, lang);
-
- g_free(current_tag);
-}
-
-
/*
* Called when the editor context menu is shown so that the devhelp
* search item can be disabled if there isn't a selected tag.
View
20 devhelp/src/dhp-plugin.c
@@ -60,7 +60,6 @@ enum
KB_DEVHELP_ACTIVATE_DEVHELP,
KB_DEVHELP_SEARCH_SYMBOL,
KB_DEVHELP_SEARCH_MANPAGES,
- KB_DEVHELP_SEARCH_CODESEARCH,
KB_COUNT
};
@@ -101,23 +100,6 @@ static void kb_activate(guint key_id)
g_free(current_tag);
break;
}
- case KB_DEVHELP_SEARCH_CODESEARCH:
- {
- const gchar *lang = NULL;
- GeanyDocument *doc;
-
- if ((current_tag = devhelp_plugin_get_current_word(plugin.devhelp)) == 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;
- }
}
}
@@ -201,8 +183,6 @@ void plugin_init(GeanyData *data)
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);
}
View
4 devhelp/src/dhp.h
@@ -125,10 +125,6 @@ void devhelp_plugin_add_temp_file (DevhelpPlugin *self, const gchar *filena
void devhelp_plugin_remove_manpages_temp_files (DevhelpPlugin *self);
-/* Google Code Search (see codesearch.c) */
-void devhelp_plugin_search_code(DevhelpPlugin *self, const gchar *term, const gchar *lang);
-
-
/* TODO: make properties for these */
gboolean devhelp_plugin_get_devhelp_sidebar_visible(DevhelpPlugin *self);
void devhelp_plugin_set_devhelp_sidebar_visible(DevhelpPlugin *self, gboolean visible);
Please sign in to comment.
Something went wrong with that request. Please try again.