Revision: 2080 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2080&view=re... Author: codebrainz Date: 2011-05-23 11:21:57 +0000 (Mon, 23 May 2011)
Log Message: ----------- Make 'man' program a runtime dependency rather than a compile-time one.
Modified Paths: -------------- trunk/geany-plugins/build/devhelp.m4 trunk/geany-plugins/devhelp/src/Makefile.am trunk/geany-plugins/devhelp/src/devhelpplugin.c trunk/geany-plugins/devhelp/src/devhelpplugin.h trunk/geany-plugins/devhelp/src/manpages.c
Modified: trunk/geany-plugins/build/devhelp.m4 =================================================================== --- trunk/geany-plugins/build/devhelp.m4 2011-05-23 10:03:13 UTC (rev 2079) +++ trunk/geany-plugins/build/devhelp.m4 2011-05-23 11:21:57 UTC (rev 2080) @@ -7,13 +7,6 @@ WEBKIT_VERSION=1.1.18 DEVHELP_VERSION=2.30.1
- AC_CHECK_PROG([MAN], [man], [yes], [no]) - if [[ x"$MAN" = "xyes" ]]; then - AC_SUBST([HAVE_MAN_PROG], 1) - else - AC_SUBST([HAVE_MAN_PROG], 0) - fi - GP_CHECK_PLUGIN_DEPS([devhelp], [DEVHELP], [gtk+-2.0 >= ${GTK_VERSION} glib-2.0 >= ${GLIB_VERSION}
Modified: trunk/geany-plugins/devhelp/src/Makefile.am =================================================================== --- trunk/geany-plugins/devhelp/src/Makefile.am 2011-05-23 10:03:13 UTC (rev 2079) +++ trunk/geany-plugins/devhelp/src/Makefile.am 2011-05-23 11:21:57 UTC (rev 2080) @@ -24,8 +24,7 @@ devhelp_la_CFLAGS = \ $(AM_CFLAGS) \ $(DEVHELP_CFLAGS) \ - -DDHPLUG_DATA_DIR="$(plugindatadir)" \ - -DHAVE_MAN_PROG=$(HAVE_MAN_PROG) + -DDHPLUG_DATA_DIR="$(plugindatadir)"
devhelp_la_LIBADD = $(DEVHELP_LIBS)
Modified: trunk/geany-plugins/devhelp/src/devhelpplugin.c =================================================================== --- trunk/geany-plugins/devhelp/src/devhelpplugin.c 2011-05-23 10:03:13 UTC (rev 2079) +++ trunk/geany-plugins/devhelp/src/devhelpplugin.c 2011-05-23 11:21:57 UTC (rev 2080) @@ -19,6 +19,7 @@ * MA 02110-1301, USA. */
+#include <stdlib.h> #include <gtk/gtk.h> #include <geanyplugin.h>
@@ -69,6 +70,8 @@ GtkToolItem* btn_back; /* the webkit browser back button in the toolbar */ GtkToolItem* btn_forward; /* the webkit browser forward button in the toolbar */
+ gboolean have_man; /* whether or not the 'man' program is available on load */ + };
@@ -80,9 +83,7 @@
/* Internal callbacks */ static void on_search_help_activate(GtkMenuItem * menuitem, DevhelpPlugin *self); -#ifdef HAVE_MAN static void on_search_help_man_activate(GtkMenuItem * menuitem, DevhelpPlugin *self); -#endif 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); @@ -126,9 +127,7 @@ if (self->priv->last_uri != NULL) g_free(self->priv->last_uri);
-#ifdef HAVE_MAN devhelp_plugin_remove_manpages_temp_files(); -#endif
G_OBJECT_CLASS(devhelp_plugin_parent_class)->finalize(object); } @@ -182,10 +181,7 @@ /* 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; -#ifdef HAVE_MAN - GtkWidget *man_item; -#endif + GtkWidget *doc_menu, *devhelp_item, *code_item, *man_item; DevhelpPluginPrivate *p;
g_return_if_fail(self != NULL); @@ -201,12 +197,13 @@ g_signal_connect(devhelp_item, "activate", G_CALLBACK(on_search_help_activate), self); gtk_widget_show(devhelp_item);
-#ifdef HAVE_MAN - man_item = gtk_menu_item_new_with_label(_("Manual Pages")); - gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), man_item); - g_signal_connect(man_item, "activate", G_CALLBACK(on_search_help_man_activate), self); - gtk_widget_show(man_item); -#endif + if (p->have_man) + { + man_item = gtk_menu_item_new_with_label(_("Manual Pages")); + gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), man_item); + g_signal_connect(man_item, "activate", G_CALLBACK(on_search_help_man_activate), 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); @@ -339,6 +336,7 @@
p->doc_notebook = geany->main_widgets->notebook; p->main_notebook = main_notebook_get(); /* see main-notebook.c */ + p->have_man = system("man --version") == 0;
devhelp_plugin_init_edit_menu(self); devhelp_plugin_init_sidebar(self); @@ -386,7 +384,6 @@ * @param dhplug Devhelp plugin * @param term The string to search for */ -#ifdef HAVE_MAN void devhelp_plugin_search_manpages(DevhelpPlugin *self, const gchar *term) { gchar *man_fn; @@ -405,7 +402,6 @@
devhelp_plugin_activate_webview_tab(self); } -#endif
/** @@ -858,7 +854,6 @@
/* Called when the editor menu item is selected */ -#ifdef HAVE_MAN static void on_search_help_man_activate(GtkMenuItem * menuitem, DevhelpPlugin *self) { gchar *current_tag; @@ -872,7 +867,6 @@
g_free(current_tag); } -#endif
static void on_search_help_code_activate(GtkMenuItem *menuitem, DevhelpPlugin *self)
Modified: trunk/geany-plugins/devhelp/src/devhelpplugin.h =================================================================== --- trunk/geany-plugins/devhelp/src/devhelpplugin.h 2011-05-23 10:03:13 UTC (rev 2079) +++ trunk/geany-plugins/devhelp/src/devhelpplugin.h 2011-05-23 11:21:57 UTC (rev 2080) @@ -28,11 +28,6 @@ G_BEGIN_DECLS
-#if HAVE_MAN_PROG == 1 -#define HAVE_MAN -#endif - - #ifndef DHPLUG_DATA_DIR #define DHPLUG_DATA_DIR "/usr/local/share/geany-devhelp" #endif @@ -87,9 +82,7 @@ void devhelp_plugin_activate_ui (DevhelpPlugin *self, gboolean show_search_tab); void devhelp_plugin_search (DevhelpPlugin *self, const gchar *term); void devhelp_plugin_search_books (DevhelpPlugin *self, const gchar *term); -#ifdef HAVE_MAN void devhelp_plugin_search_manpages (DevhelpPlugin *self, const gchar *term); -#endif void devhelp_plugin_search_code (DevhelpPlugin *self, const gchar *term, const gchar *lang);
const gchar* devhelp_plugin_get_last_uri (DevhelpPlugin *self); @@ -110,10 +103,8 @@ WebKitWebView* devhelp_plugin_get_webview (DevhelpPlugin *self);
-#ifdef HAVE_MAN gchar *devhelp_plugin_manpages_search(const gchar *term, const gchar *section); void devhelp_plugin_remove_manpages_temp_files(void); -#endif
void devhelp_plugin_search_code(DevhelpPlugin *self, const gchar *term, const gchar *lang);
Modified: trunk/geany-plugins/devhelp/src/manpages.c =================================================================== --- trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 10:03:13 UTC (rev 2079) +++ trunk/geany-plugins/devhelp/src/manpages.c 2011-05-23 11:21:57 UTC (rev 2080) @@ -6,9 +6,7 @@
#include "devhelpplugin.h"
-#ifdef HAVE_MAN
- #define DEVHELP_PLUGIN_MANPAGE_SECTIONS "3:2:1:8:5:4:7:6" #define DEVHELP_PLUGIN_MANPAGE_PAGER "col -b"
@@ -165,5 +163,3 @@
temp_files = NULL; } - -#endif /* HAVE_MAN */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.