SF.net SVN: geany-plugins:[2073] trunk/geany-plugins

codebrainz at users.sourceforge.net codebrainz at xxxxx
Mon May 23 02:15:56 UTC 2011


Revision: 2073
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2073&view=rev
Author:   codebrainz
Date:     2011-05-23 02:15:56 +0000 (Mon, 23 May 2011)

Log Message:
-----------
Disable manpage code when no 'man' program is available at compile time.

Modified Paths:
--------------
    trunk/geany-plugins/build/devhelp.m4
    trunk/geany-plugins/devhelp/src/Makefile.am
    trunk/geany-plugins/devhelp/src/codesearch.c
    trunk/geany-plugins/devhelp/src/devhelpplugin.c
    trunk/geany-plugins/devhelp/src/devhelpplugin.h
    trunk/geany-plugins/devhelp/src/manpages.c

Removed Paths:
-------------
    trunk/geany-plugins/devhelp/src/codesearch.h
    trunk/geany-plugins/devhelp/src/manpages.h

Modified: trunk/geany-plugins/build/devhelp.m4
===================================================================
--- trunk/geany-plugins/build/devhelp.m4	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/build/devhelp.m4	2011-05-23 02:15:56 UTC (rev 2073)
@@ -1,9 +1,28 @@
 AC_DEFUN([GP_CHECK_DEVHELP],
 [
     GP_ARG_DISABLE([devhelp], [auto])
-    GP_CHECK_PLUGIN_DEPS([devhelp], [DEVHELP], 
-		[libdevhelp-1.0 webkit-1.0 gthread-2.0])
+
+    GTK_VERSION=2.16
+    GLIB_VERSION=2.16
+    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}
+						  webkit-1.0 >= ${WEBKIT_VERSION}
+						  libdevhelp-1.0 >= ${DEVHELP_VERSION}
+						  gthread-2.0])
+
     GP_STATUS_PLUGIN_ADD([DevHelp], [$enable_devhelp])
+
     AC_CONFIG_FILES([
         devhelp/Makefile
         devhelp/src/Makefile

Modified: trunk/geany-plugins/devhelp/src/Makefile.am
===================================================================
--- trunk/geany-plugins/devhelp/src/Makefile.am	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/Makefile.am	2011-05-23 02:15:56 UTC (rev 2073)
@@ -24,7 +24,8 @@
 devhelp_la_CFLAGS = \
 	$(AM_CFLAGS) \
 	$(DEVHELP_CFLAGS) \
-	-DDHPLUG_DATA_DIR=\"$(plugindatadir)\"
+	-DDHPLUG_DATA_DIR=\"$(plugindatadir)\" \
+	-DHAVE_MAN_PROG=$(HAVE_MAN_PROG)
 
 devhelp_la_LIBADD = $(DEVHELP_LIBS)
 

Modified: trunk/geany-plugins/devhelp/src/codesearch.c
===================================================================
--- trunk/geany-plugins/devhelp/src/codesearch.c	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/codesearch.c	2011-05-23 02:15:56 UTC (rev 2073)
@@ -2,7 +2,6 @@
 #include <webkit/webkitwebview.h>
 
 #include "devhelpplugin.h"
-#include "codesearch.h"
 
 
 struct LangMapEnt

Deleted: trunk/geany-plugins/devhelp/src/codesearch.h
===================================================================
--- trunk/geany-plugins/devhelp/src/codesearch.h	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/codesearch.h	2011-05-23 02:15:56 UTC (rev 2073)
@@ -1,39 +0,0 @@
-/*
- * codesearch.h
- *
- * Copyright 2011 Matthew Brush <mbrush at desktop>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301  USA.
- *
- */
-
-#ifndef CODESEARCH_H
-#define CODESEARCH_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <glib.h>
-#include "devhelpplugin.h"
-
-
-void devhelp_plugin_search_code(DevhelpPlugin *self, const gchar *term, const gchar *lang);
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-#endif /* CODESEARCH_H */

Modified: trunk/geany-plugins/devhelp/src/devhelpplugin.c
===================================================================
--- trunk/geany-plugins/devhelp/src/devhelpplugin.c	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/devhelpplugin.c	2011-05-23 02:15:56 UTC (rev 2073)
@@ -36,8 +36,6 @@
 #include "main-notebook.h"
 #include "devhelpplugin.h"
 #include "plugin.h"
-#include "manpages.h"
-#include "codesearch.h"
 
 
 struct _DevhelpPluginPrivate
@@ -82,7 +80,9 @@
 
 /* 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,7 +126,9 @@
 	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);
 }
@@ -180,7 +182,10 @@
 /* Initialize the stuff in the editor's context menu */
 static void devhelp_plugin_init_edit_menu(DevhelpPlugin *self)
 {
-	GtkWidget *doc_menu, *devhelp_item, *man_item, *code_item;
+	GtkWidget *doc_menu, *devhelp_item, *code_item;
+#ifdef HAVE_MAN
+	GtkWidget *man_item;
+#endif
 	DevhelpPluginPrivate *p;
 
 	g_return_if_fail(self != NULL);
@@ -192,29 +197,28 @@
 	doc_menu = gtk_menu_new();
 
 	devhelp_item = gtk_menu_item_new_with_label(_("Devhelp"));
+	gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), devhelp_item);
+	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
+
 	code_item = gtk_menu_item_new_with_label(_("Google Code"));
-
-	gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), devhelp_item);
-	gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), man_item);
 	gtk_menu_shell_append(GTK_MENU_SHELL(doc_menu), code_item);
-
-	g_signal_connect(geany->main_widgets->editor_menu, "show", G_CALLBACK(on_editor_menu_popup), self);
-	g_signal_connect(devhelp_item, "activate", G_CALLBACK(on_search_help_activate), self);
-	g_signal_connect(man_item, "activate", G_CALLBACK(on_search_help_man_activate), self);
 	g_signal_connect(code_item, "activate", G_CALLBACK(on_search_help_code_activate), self);
-
-	gtk_widget_show(p->editor_menu_sep);
-	gtk_widget_show(devhelp_item);
-	gtk_widget_show(man_item);
 	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_widget_show_all(p->editor_menu_item);
-
 	gtk_menu_shell_append(GTK_MENU_SHELL(geany->main_widgets->editor_menu), p->editor_menu_sep);
 	gtk_menu_shell_append(GTK_MENU_SHELL(geany->main_widgets->editor_menu), p->editor_menu_item);
-
+	gtk_widget_show(p->editor_menu_sep);
+	gtk_widget_show_all(p->editor_menu_item);
 }
 
 
@@ -382,6 +386,7 @@
  * @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;
@@ -400,6 +405,7 @@
 
 	devhelp_plugin_activate_webview_tab(self);
 }
+#endif
 
 
 /**
@@ -852,6 +858,7 @@
 
 
 /* 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;
@@ -865,6 +872,7 @@
 
 	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 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/devhelpplugin.h	2011-05-23 02:15:56 UTC (rev 2073)
@@ -28,6 +28,11 @@
 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
@@ -102,5 +107,14 @@
 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);
+
+
 G_END_DECLS
 #endif /* DEVHELP_PLUGIN_H */

Modified: trunk/geany-plugins/devhelp/src/manpages.c
===================================================================
--- trunk/geany-plugins/devhelp/src/manpages.c	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/manpages.c	2011-05-23 02:15:56 UTC (rev 2073)
@@ -1,3 +1,5 @@
+#ifdef HAVE_MAN
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -4,8 +6,6 @@
 #include <errno.h>
 #include <glib.h>
 
-#include "manpages.h"
-
 #define DEVHELP_MANPAGE_NUM_SECTIONS 8
 /* In order of most likely sections */
 static gint sections[DEVHELP_MANPAGE_NUM_SECTIONS] = { 3, 2, 1, 8, 5, 4, 7, 6 };
@@ -185,3 +185,5 @@
 
 	temp_files = NULL;
 }
+
+#endif /* HAVE_MAN */

Deleted: trunk/geany-plugins/devhelp/src/manpages.h
===================================================================
--- trunk/geany-plugins/devhelp/src/manpages.h	2011-05-23 00:28:42 UTC (rev 2072)
+++ trunk/geany-plugins/devhelp/src/manpages.h	2011-05-23 02:15:56 UTC (rev 2073)
@@ -1,36 +0,0 @@
-/*
- * manpages.h
- *
- * Copyright 2011 Matthew Brush <mbrush at desktop>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301  USA.
- *
- */
-
-#ifndef MANPAGES_H
-#define MANPAGES_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-gchar *devhelp_plugin_manpages_search(const gchar *term, const gchar *section);
-void devhelp_plugin_remove_manpages_temp_files(void);
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-#endif /* MANPAGES_H */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list