[gtksourceview/gtksourcecompletion] Make devhelp optional
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtksourceview/gtksourcecompletion] Make devhelp optional
- Date: Thu, 16 Apr 2009 18:53:41 -0400 (EDT)
commit 500a6baea474bab639c9eb17d979bb65e917e3c2
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Apr 17 00:53:26 2009 +0200
Make devhelp optional
---
configure.ac | 21 ++++++++++++++++++++-
docs/reference/tmpl/view.sgml | 14 +++++++++++++-
tests/Makefile.am | 9 +++++++--
tests/completion-simple.c | 17 ++++++++++++-----
tests/gsc-provider-devhelp.c | 19 ++++++++++---------
5 files changed, 62 insertions(+), 18 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6eabf1e..e59dc83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,10 +64,29 @@ PKG_CHECK_MODULES(DEP, [
gio-2.0
gtk+-2.0 >= $GTK_REQUIRED_VERSION
libxml-2.0 >= $LIBXML_REQUIRED_VERSION
- libdevhelp-1.0
gconf-2.0
])
+have_devhelp=no
+AC_ARG_WITH(devhelp,
+ AC_HELP_STRING([--with-devhelp],
+ [Build with devhelp test case]),,
+ with_devhelp=auto)
+if test "x$with_devhelp" != "xno"
+then
+ PKG_CHECK_MODULES(DEVHELP, [
+ libdevhelp-1.0 >= 0.22
+ webkit-1.0
+ ], have_devhelp=yes, have_devhelp=no)
+
+ if test "x$have_devhelp" = "xyes"
+ then
+ AC_DEFINE([HAVE_DEVHELP], 1, [Have devhelp])
+ fi
+fi
+
+AM_CONDITIONAL(USE_DEVHELP, test "x$have_devhelp" = "xyes")
+
# i18N stuff
GETTEXT_PACKAGE=gtksourceview-2.0
AC_SUBST(GETTEXT_PACKAGE)
diff --git a/docs/reference/tmpl/view.sgml b/docs/reference/tmpl/view.sgml
index 64fa772..6e987b3 100644
--- a/docs/reference/tmpl/view.sgml
+++ b/docs/reference/tmpl/view.sgml
@@ -32,6 +32,13 @@ a text view which syntax highlighting, undo/redo and text marks. Use a
@sourceview: the object which received the signal.
+<!-- ##### SIGNAL GtkSourceView::show-completion ##### -->
+<para>
+
+</para>
+
+ sourceview: the object which received the signal.
+
<!-- ##### SIGNAL GtkSourceView::undo ##### -->
<para>
@@ -44,6 +51,11 @@ a text view which syntax highlighting, undo/redo and text marks. Use a
</para>
+<!-- ##### ARG GtkSourceView:completion ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG GtkSourceView:draw-spaces ##### -->
<para>
@@ -107,10 +119,10 @@ a text view which syntax highlighting, undo/redo and text marks. Use a
@parent_class:
@undo:
@redo:
+ show_completion:
@_gtk_source_reserved1:
@_gtk_source_reserved2:
@_gtk_source_reserved3:
- _gtk_source_reserved4:
<!-- ##### ENUM GtkSourceSmartHomeEndType ##### -->
<para>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index db7783a..8912188 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,8 +25,6 @@ test_completion_SOURCES = \
completion-simple.c \
gsc-provider-test.h \
gsc-provider-test.c \
- gsc-provider-devhelp.h \
- gsc-provider-devhelp.c \
gsc-utils-test.c \
gsc-utils-test.h
@@ -35,6 +33,13 @@ test_completion_LDADD = \
$(DEP_LIBS) \
$(TESTS_LIBS)
+if USE_DEVHELP
+test_completion_SOURCES += gsc-provider-devhelp.h gsc-provider-devhelp.c
+test_completion_LDADD += $(DEVHELP_LIBS)
+INCLUDES += $(DEVHELP_CFLAGS)
+endif
+
+
testregion_SOURCES = testregion.c
testregion_LDADD = \
diff --git a/tests/completion-simple.c b/tests/completion-simple.c
index 1c744da..5ad78bb 100644
--- a/tests/completion-simple.c
+++ b/tests/completion-simple.c
@@ -21,17 +21,21 @@
* Boston, MA 02110-1301, USA.
*/
+#include <config.h>
+
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcecompletion.h>
#include <gtksourceview/gtksourcecompletioninfo.h>
-#include <devhelp/dh-base.h>
-
#include "gsc-utils-test.h"
#include "gsc-provider-test.h"
+
+#ifdef HAVE_DEVHELP
+#include <devhelp/dh-base.h>
#include "gsc-provider-devhelp.h"
+#endif
static GtkWidget *view;
static GtkSourceCompletion *comp;
@@ -176,7 +180,6 @@ static void
create_completion(void)
{
GscProviderTest *prov_test1;
- GscProviderDevhelp *prov_devhelp;
GdkPixbuf *icon;
comp = gtk_source_view_get_completion (GTK_SOURCE_VIEW (view));
@@ -189,8 +192,6 @@ create_completion(void)
{
g_object_unref (icon);
}
-
- prov_devhelp = gsc_provider_devhelp_new ();
gtk_source_completion_add_provider (comp, GTK_SOURCE_COMPLETION_PROVIDER (prov_test1));
@@ -204,7 +205,13 @@ create_completion(void)
gtk_source_completion_add_provider (comp, GTK_SOURCE_COMPLETION_PROVIDER (prov_test1));
+#ifdef HAVE_DEVHELP
+ GscProviderDevhelp *prov_devhelp;
+
+ prov_devhelp = gsc_provider_devhelp_new ();
+
gtk_source_completion_add_provider (comp, GTK_SOURCE_COMPLETION_PROVIDER (prov_devhelp));
+#endif
}
int
diff --git a/tests/gsc-provider-devhelp.c b/tests/gsc-provider-devhelp.c
index 6e142c8..ef14f89 100644
--- a/tests/gsc-provider-devhelp.c
+++ b/tests/gsc-provider-devhelp.c
@@ -1,7 +1,7 @@
#include "gsc-provider-devhelp.h"
#include <devhelp/dh-base.h>
#include <devhelp/dh-link.h>
-#include <devhelp/dh-html.h>
+#include <devhelp/dh-assistant-view.h>
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourcecompletionitem.h>
@@ -10,7 +10,7 @@
struct _GscProviderDevhelpPrivate
{
DhBase *dhbase;
- DhHtml *dhhtml;
+ GtkWidget *view;
GList *proposals;
};
@@ -60,7 +60,7 @@ static GtkWidget *
gsc_provider_devhelp_get_info_widget (GtkSourceCompletionProvider *provider,
GtkSourceCompletionProposal *proposal)
{
- return dh_html_get_widget (GSC_PROVIDER_DEVHELP (provider)->priv->dhhtml);
+ return GSC_PROVIDER_DEVHELP (provider)->priv->view;
}
static void
@@ -71,10 +71,9 @@ gsc_provider_devhelp_update_info (GtkSourceCompletionProvider *provider,
GscProviderDevhelp *self = GSC_PROVIDER_DEVHELP (provider);
const gchar *uri;
- uri = gtk_source_completion_proposal_get_info (proposal);
+ uri = gtk_source_completion_proposal_get_label (proposal);
- dh_html_open_uri (GSC_PROVIDER_DEVHELP (provider)->priv->dhhtml, uri);
- dh_html_set_zoom (self->priv->dhhtml, 0.5);
+ dh_assistant_view_search (DH_ASSISTANT_VIEW (self->priv->view), uri);
}
static void
@@ -95,7 +94,6 @@ gsc_provider_devhelp_finalize (GObject *object)
GscProviderDevhelp *provider = GSC_PROVIDER_DEVHELP (object);
g_object_unref (provider->priv->dhbase);
- g_object_unref (provider->priv->dhhtml);
g_list_foreach (provider->priv->proposals, (GFunc)g_object_unref, NULL);
G_OBJECT_CLASS (gsc_provider_devhelp_parent_class)->finalize (object);
@@ -127,11 +125,14 @@ gsc_provider_devhelp_init (GscProviderDevhelp *self)
{
DhLink *link = (DhLink *)item->data;
- ret = g_list_prepend (ret, gtk_source_completion_item_new (link->name, NULL, link->uri));
+ ret = g_list_prepend (ret, gtk_source_completion_item_new (dh_link_get_name (link),
+ NULL,
+ dh_link_get_uri (link)));
}
- self->priv->dhhtml = dh_html_new ();
+ self->priv->view = dh_assistant_view_new ();
+ dh_assistant_view_set_base (DH_ASSISTANT_VIEW (self->priv->view), self->priv->dhbase);
self->priv->proposals = g_list_reverse (ret);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]