diff -urN anjuta-2.24.2/configure.in trunk/configure.in
--- anjuta-2.24.2/configure.in 2008-11-24 15:10:28.000000000 +0100
+++ trunk/configure.in 2008-12-07 23:31:30.579285390 +0100
@@ -22,7 +22,7 @@
VTE_NEW_REQUIRED=0.13.1
LIBXML_REQUIRED=2.4.23
PANGO_REQUIRED=1.1.1
-LIBDEVHELP_REQUIRED=0.13
+LIBDEVHELP_REQUIRED=0.22
GDL_REQUIRED=0.7.3
GNOMEBUILD_REQUIRED=0.3.0
GLADEUI_REQUIRED=3.2.0
@@ -235,33 +195,15 @@
devhelp_enabled="no"
else
AC_MSG_RESULT(no)
- devhelp_old=yes
PKG_CHECK_MODULES(PLUGIN_DEVHELP,
- [libdevhelp-1.0 >= $LIBDEVHELP_REQUIRED],
- [
- devhelp_old=no
- devhelp_enabled=yes
- ], [
- AC_MSG_RESULT([version >= 0.11 not found])
- devhelp_old=yes
- devhelp_enabled=no
- ])
- if test x$devhelp_old = xyes; then
- PKG_CHECK_MODULES(PLUGIN_DEVHELP, [libdevhelp-1.0 >= 0.9], [devhelp_enabled=yes], [devhelp_enabled=no])
- if test x$devhelp_enabled = xyes; then
- AC_DEFINE(HAVE_OLD_DEVHELP, 1, [If old devhelp (>= 0.9 < 0.11) is installed])
- fi
- fi
+ [libdevhelp-1.0 >= $LIBDEVHELP_REQUIRED webkit-1.0],
+ [
+ devhelp_enabled=yes
+ ], [
+ devhelp_enabled=no
+ ])
fi
-if test x$devhelp_enabled = xyes; then
- GECKO_HOME=`$PKGCONFIG_CONFIG --variable=gecko_home libdevhelp-1.0`
- if test x$GECKO_HOME != x; then
- ANJUTA_LDFLAGS="$ANJUTA_LDFLAGS -R$GECKO_HOME"
- fi
-fi
-AC_SUBST(ANJUTA_LDFLAGS)
-
AM_CONDITIONAL(HAVE_PLUGIN_DEVHELP, [test x$devhelp_enabled = xyes])
dnl Check for Gnome Build
@@ -1133,7 +1075,7 @@
echo "Building devhelp plugin: ...............................YES"
else
echo "Building devhelp plugin: ...............................NO"
- echo " Requires devhelp"
+ echo " Requires devhelp >= 0.22"
fi
if [ test x$libgraphviz_found = xyes ]; then
diff -urN anjuta-2.24.2/plugins/devhelp/anjuta-devhelp.plugin trunk/plugins/devhelp/anjuta-devhelp.plugin
--- anjuta-2.24.2/plugins/devhelp/anjuta-devhelp.plugin 2008-11-24 14:49:19.000000000 +0100
+++ trunk/plugins/devhelp/anjuta-devhelp.plugin 1970-01-01 01:00:00.000000000 +0100
@@ -1,77 +0,0 @@
-[Anjuta Plugin]
-Name=API Help
-Name[ar]=مساعدة واجهة برمجة التطبيقات
-Name[be@latin]=Daviednik API
-Name[ca]=Ajuda de l'API
-Name[cs]=Nápověda k API
-Name[da]=API-hjælp
-Name[de]=API-Hilfe
-Name[dz]=ཨེ་པི་ཨའི་གྲོགས་རམ།
-Name[el]=Βοήθεια API
-Name[en_GB]=API Help
-Name[es]=Ayuda
-Name[fi]=API-ohje
-Name[fr]=Aide API
-Name[gl]=Axuda de API
-Name[hi]=API मद
-Name[hu]=API súgó
-Name[it]=Aiuto API
-Name[ja]=APIヘルプ
-Name[kn]=API ಸಹಾಯ
-Name[ko]=API 도움말
-Name[mk]=API помош
-Name[ml]=എപിഐ സഹായം
-Name[mr]=API मदत
-Name[nb]=API-hjelp
-Name[ne]=API मद्दत
-Name[nl]=API-hulp
-Name[pl]=Pomoc API
-Name[pt]=Ajuda de API
-Name[pt_BR]=Ajuda da API
-Name[ru]=Справка по API
-Name[sl]=API Pomoč
-Name[sv]=API-hjälp
-Name[th]=วิธีใช้ API
-Name[tr]=API Yardımı
-Name[vi]=Trợ giúp API
-Name[zh_HK]=API求助
-Name[zh_TW]=API求助
-Description=Devhelp Plugin for Anjuta.
-Description[ar]=ملحق Devhelp لأنجوتا.
-Description[be@latin]=Plugin Devhelp dla Anjuty.
-Description[ca]=Connector del DevHelp per a l'Anjuta.
-Description[cs]=Zásuvný modul Devhelp pro Anjutu.
-Description[da]=Devhelp-modul til Anjuta.
-Description[de]=Devhelp-Komponente für Anjuta
-Description[dz]=ཨན་ཇུ་ཊ་གི་དོན་ལུ་ཌེབ་གྲོགས་རམ་པ་ལག་ཨིན།
-Description[el]=Πρόσθετη λειτουργία του devhelp για το Anjuta.
-Description[en_GB]=Devhelp Plugin for Anjuta.
-Description[es]=Complemento Devhelp para Anjuta.
-Description[fi]=Anjutan devhelp-liitännäinen.
-Description[fr]=Greffon Devhelp pour Anjuta
-Description[gl]=Complemento Devhelp para Anjuta.
-Description[he]=תוסף Devhelp ל-Anjuta
-Description[hi]=अंजुटा के लिए डेव वहेल्प प्लगिन
-Description[hu]=Devhelp bővítmény az Anjuta-hoz
-Description[it]=Plugin Devhelp per Anjuta.
-Description[ja]=Devhelp を利用するためのプラグインです
-Description[kn]=Anjuta ಗಾಗಿನ ಪ್ಲಗ್ಇನ್ Devhelp.
-Description[ko]=Anjuta 개발자 도움말(Devhelp) 플러그인.
-Description[mk]=Devhelp приклучок за Anjuta.
-Description[ml]=അഞ്ചുതയ്ക്കുള്ള Devhelp പ്ലഗ്ഗിന്
-Description[mr]=Anjuta करीता डेव्हमदत प्लगइन.
-Description[ne]=अन्जुताका लागि Devhelp प्लगइन ।
-Description[pl]=Wtyczka Devhelp dla Anjuty.
-Description[pt]=Plugin Devhelp para o Anjuta.
-Description[pt_BR]=Plug-in Devhelp para Anjuta.
-Description[ru]=Справка разработчика для Anjuta.
-Description[sl]=Vstavek Anjute za Devhelp
-Description[sv]=Devhelp-instick för Anjuta.
-Description[th]=ปลั๊กอิน Devhelp สำหรับแอนจูตา
-Description[tr]=Anjuta için Devhelp Eklentisi.
-Description[vi]=Phần bổ sung Trợ giúp Phát triển cho Anjuta
-Description[zh_HK]=給 Anjuta 的 Devhelp 外掛程式。
-Description[zh_TW]=給 Anjuta 的 Devhelp 外掛程式。
-Location=anjuta-devhelp:AnjutaDevhelp
-Icon=anjuta-devhelp-plugin-48.png
-Interfaces=IAnjutaHelp
diff -urN anjuta-2.24.2/plugins/devhelp/anjuta-devhelp.ui trunk/plugins/devhelp/anjuta-devhelp.ui
--- anjuta-2.24.2/plugins/devhelp/anjuta-devhelp.ui 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/anjuta-devhelp.ui 2008-12-07 23:31:25.922619748 +0100
@@ -1,14 +1,6 @@
-
@@ -24,7 +16,5 @@
-
-
diff -urN anjuta-2.24.2/plugins/devhelp/htmlview.c trunk/plugins/devhelp/htmlview.c
--- anjuta-2.24.2/plugins/devhelp/htmlview.c 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/htmlview.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,182 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "htmlview.h"
-
-#include
-#include
-#include
-#include
-#include
-
-static void html_view_class_init(HtmlViewClass *klass);
-static void html_view_init(HtmlView *sp);
-static void html_view_finalize(GObject *object);
-
-struct _HtmlViewPrivate {
- DhHtml* html;
- AnjutaDevhelp* devhelp;
- gchar* uri;
- guint idle_realize;
-};
-
-G_DEFINE_TYPE(HtmlView, html_view, GTK_TYPE_HBOX)
-
-static gboolean
-devhelp_html_open_uri_cb (DhHtml *html,
- const gchar *uri,
- AnjutaDevhelp *widget)
-{
-#ifdef HAVE_OLD_DEVHELP
- dh_book_tree_show_uri (DH_BOOK_TREE (widget->book_tree), uri);
-#else
- dh_book_tree_select_uri (DH_BOOK_TREE (widget->book_tree), uri);
-#endif
- return FALSE;
-}
-
-static void
-devhelp_html_location_changed_cb (DhHtml *html,
- const gchar *location,
- AnjutaDevhelp *widget)
-{
- anjuta_devhelp_check_history (widget);
-}
-
-static gboolean
-html_view_create_html(HtmlView* html_view)
-{
- GtkWidget* view;
- HtmlViewPrivate* priv = html_view->priv;
-
- priv->html = dh_html_new();
-
- if (!priv->html || !DH_IS_HTML(priv->html))
- return TRUE; /* I think the idea is to wait until we get a widget? */
-
- view = dh_html_get_widget(priv->html);
- gtk_box_pack_start(GTK_BOX(html_view), dh_html_get_widget(priv->html), TRUE, TRUE, 1);
-
- g_signal_connect (priv->html, "open-uri",
- G_CALLBACK (devhelp_html_open_uri_cb),
- priv->devhelp);
- g_signal_connect (priv->html, "location-changed",
- G_CALLBACK (devhelp_html_location_changed_cb),
- priv->devhelp);
-
- /* Hack to get GtkMozEmbed to work properly. */
- gtk_widget_realize (view);
-
- if (priv->uri)
- dh_html_open_uri(priv->html, priv->uri);
- else
- dh_html_clear(priv->html);
-
- gtk_widget_show (view);
-
- return FALSE;
-}
-
-static void
-html_view_realize(GtkWidget* widget)
-{
- HtmlView* html_view = HTML_VIEW(widget);
-
- if (html_view->priv->idle_realize == 0)
- {
- html_view->priv->idle_realize =
- g_idle_add((GSourceFunc) html_view_create_html, html_view);
- }
- (* GTK_WIDGET_CLASS (html_view_parent_class)->realize)(widget);
-}
-
-static void
-html_view_unrealize(GtkWidget* widget)
-{
- HtmlView* html_view = HTML_VIEW(widget);
-
- if (html_view->priv->idle_realize > 0)
- {
- g_source_remove (html_view->priv->idle_realize);
- html_view->priv->idle_realize = 0;
- }
-
- if (html_view->priv->html != NULL)
- {
- g_free(html_view->priv->uri);
- html_view->priv->uri = dh_html_get_location(html_view->priv->html);
- }
- else
- html_view->priv->uri = NULL;
-
- if (gtk_container_get_children(GTK_CONTAINER(html_view)))
- {
- gtk_container_remove(GTK_CONTAINER(widget), dh_html_get_widget(html_view->priv->html));
- html_view->priv->html = NULL;
- }
-
- (* GTK_WIDGET_CLASS (html_view_parent_class)->unrealize)(widget);
-}
-
-static void
-html_view_class_init(HtmlViewClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- GtkWidgetClass* widget_class = GTK_WIDGET_CLASS(klass);
-
- object_class->finalize = html_view_finalize;
-
- widget_class->realize = html_view_realize;
- widget_class->unrealize = html_view_unrealize;
-}
-
-static void
-html_view_init(HtmlView *obj)
-{
- obj->priv = g_new0(HtmlViewPrivate, 1);
- gtk_widget_show(GTK_WIDGET(obj));
-}
-
-static void
-html_view_finalize(GObject *object)
-{
- HtmlView *cobj;
- cobj = HTML_VIEW(object);
-
- /* Free private members, etc. */
- if (cobj->priv->html)
- gtk_widget_destroy(dh_html_get_widget(cobj->priv->html));
- g_free (cobj->priv->uri);
- g_free(cobj->priv);
- G_OBJECT_CLASS(html_view_parent_class)->finalize(object);
-}
-
-GtkWidget*
-html_view_new(AnjutaDevhelp* devhelp)
-{
- HtmlView *obj;
-
- obj = HTML_VIEW(g_object_new(HTML_TYPE_VIEW, NULL));
-
- obj->priv->devhelp = devhelp;
-
- return GTK_WIDGET(obj);
-}
-
-DhHtml* html_view_get_dh_html(HtmlView* view)
-{
- return view->priv->html;
-}
diff -urN anjuta-2.24.2/plugins/devhelp/htmlview.h trunk/plugins/devhelp/htmlview.h
--- anjuta-2.24.2/plugins/devhelp/htmlview.h 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/htmlview.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,57 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef HTMLVIEW_H
-#define HTMLVIEW_H
-
-#include
-#include
-#include
-
-#include
-
-#include "plugin.h"
-
-G_BEGIN_DECLS
-
-#define HTML_TYPE_VIEW (html_view_get_type ())
-#define HTML_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), HTML_TYPE_VIEW, HtmlView))
-#define HTML_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), HTML_TYPE_VIEW, HtmlViewClass))
-#define HTML_IS_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), HTML_TYPE_VIEW))
-#define HTML_IS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), HTML_TYPE_VIEW))
-#define HTML_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), HTML_TYPE_VIEW, HtmlViewClass))
-
-typedef struct _HtmlView HtmlView;
-typedef struct _HtmlViewPrivate HtmlViewPrivate;
-typedef struct _HtmlViewClass HtmlViewClass;
-
-struct _HtmlView {
- GtkHBox parent;
- HtmlViewPrivate *priv;
-};
-
-struct _HtmlViewClass {
- GtkHBoxClass parent_class;
-};
-
-GType html_view_get_type(void);
-GtkWidget *html_view_new(AnjutaDevhelp* devhelp);
-
-DhHtml* html_view_get_dh_html(HtmlView* html_view);
-
-G_END_DECLS
-
-#endif /* HTMLVIEW_H */
diff -urN anjuta-2.24.2/plugins/devhelp/Makefile.am trunk/plugins/devhelp/Makefile.am
--- anjuta-2.24.2/plugins/devhelp/Makefile.am 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/Makefile.am 2008-12-07 23:31:25.935952354 +0100
@@ -8,11 +8,7 @@
devhelp_pixmapsdir = $(anjuta_image_dir)
devhelp_pixmaps_DATA = \
anjuta-devhelp-plugin.svg \
- anjuta-devhelp-plugin-48.png \
- anjuta-go-help-next-24.png \
- anjuta-go-help-next-16.png \
- anjuta-go-help-prev-24.png \
- anjuta-go-help-prev-16.png
+ anjuta-devhelp-plugin-48.png
# Plugin description file
plugin_in_files = anjuta-devhelp.plugin.in
@@ -46,20 +42,11 @@
plugin.c \
plugin.h
-if HAVE_PLUGIN_DEVHELP
-libanjuta_devhelp_la_SOURCES += \
- htmlview.c \
- htmlview.h
-endif
-
# Plugin dependencies
libanjuta_devhelp_la_LIBADD = \
$(GTK_LIBS) \
- $(LIBANJUTA_LIBS)
-
-if HAVE_PLUGIN_DEVHELP
-libanjuta_devhelp_la_LIBADD += $(PLUGIN_DEVHELP_LIBS)
-endif
+ $(LIBANJUTA_LIBS) \
+ $(PLUGIN_DEVHELP_LIBS)
EXTRA_DIST = \
$(plugin_in_files) \
diff -urN anjuta-2.24.2/plugins/devhelp/plugin.c trunk/plugins/devhelp/plugin.c
--- anjuta-2.24.2/plugins/devhelp/plugin.c 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/plugin.c 2008-12-07 23:31:25.922619748 +0100
@@ -34,11 +34,12 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
#include
-#include
-#include
#include
#include
-#include "htmlview.h"
+#include
+
+#define ONLINE_API_DOCS "http://library.gnome.org/devel"
+
#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-devhelp.ui"
#else /* DISABLE_EMBEDDED_DEVHELP */
@@ -51,12 +52,8 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
-#define ANJUTA_PIXMAP_HELP_NEXT "anjuta-go-help-next-24.png"
-#define ANJUTA_PIXMAP_HELP_PREV "anjuta-go-help-prev-24.png"
#define ANJUTA_PIXMAP_DEVHELP "anjuta-devhelp-plugin-48.png"
-#define ANJUTA_STOCK_HELP_NEXT "anjuta-help-next"
-#define ANJUTA_STOCK_HELP_PREV "anjuta-help-prev"
#define ANJUTA_STOCK_DEVHELP "anjuta-devhelp"
static void
@@ -74,76 +71,71 @@
/* Register stock icons */
ui = anjuta_shell_get_ui (plugin->shell, NULL);
icon_factory = anjuta_ui_get_icon_factory (ui);
- REGISTER_ICON (ANJUTA_PIXMAP_HELP_NEXT, ANJUTA_STOCK_HELP_NEXT);
- REGISTER_ICON (ANJUTA_PIXMAP_HELP_PREV, ANJUTA_STOCK_HELP_PREV);
REGISTER_ICON (ANJUTA_PIXMAP_DEVHELP, ANJUTA_STOCK_DEVHELP);
}
static void
-devhelp_tree_link_selected_cb (GObject *ignored,
- DhLink *link,
- AnjutaDevhelp *widget)
+devhelp_tree_link_selected_cb (GObject *ignored, DhLink *link,
+ AnjutaDevhelp *widget)
{
+ gchar *uri;
- DhHtml *html;
-
anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
- widget->htmlview, NULL);
+ widget->view_sw, NULL);
- html = html_view_get_dh_html(HTML_VIEW(widget->htmlview));
-
- if (!DH_IS_HTML(html))
- return;
+ uri = dh_link_get_uri (link);
+ webkit_web_view_open (WEBKIT_WEB_VIEW (widget->view), uri);
+ g_free (uri);
- dh_html_open_uri (html, link->uri);
-
anjuta_devhelp_check_history (widget);
}
static void
-devhelp_search_link_selected_cb (GObject *ignored,
- DhLink *link,
- AnjutaDevhelp *widget)
+devhelp_search_link_selected_cb (GObject *ignored, DhLink *link,
+ AnjutaDevhelp *widget)
{
- DhHtml *html;
-
+ gchar *uri;
+
anjuta_shell_present_widget (ANJUTA_PLUGIN (widget)->shell,
- widget->htmlview, NULL);
-
- html = html_view_get_dh_html(HTML_VIEW(widget->htmlview));
-
- if (!DH_IS_HTML(html))
- return;
-
- dh_html_open_uri (html, link->uri);
+ widget->view_sw, NULL);
+ uri = dh_link_get_uri (link);
+ webkit_web_view_open (WEBKIT_WEB_VIEW (widget->view), uri);
+ g_free (uri);
+
anjuta_devhelp_check_history (widget);
}
static void
-on_go_back_activate (GtkAction *action, AnjutaDevhelp *plugin)
+on_go_back_clicked (GtkWidget *widget, AnjutaDevhelp *plugin)
{
- DhHtml* html;
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->view_sw, NULL);
- html = html_view_get_dh_html(HTML_VIEW(plugin->htmlview));
+ webkit_web_view_go_back (WEBKIT_WEB_VIEW (plugin->view));
- if (!DH_IS_HTML(html))
- return;
-
- dh_html_go_back(html);
+ anjuta_devhelp_check_history (plugin);
}
static void
-on_go_forward_activate (GtkAction *action, AnjutaDevhelp *plugin)
+on_go_forward_clicked (GtkWidget *widget, AnjutaDevhelp *plugin)
{
- DhHtml* html;
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->view_sw, NULL);
- html = html_view_get_dh_html(HTML_VIEW(plugin->htmlview));
-
- if (!DH_IS_HTML(html))
- return;
+ webkit_web_view_go_forward (WEBKIT_WEB_VIEW (plugin->view));
- dh_html_go_forward(html);
+ anjuta_devhelp_check_history (plugin);
+}
+
+static void
+on_online_clicked (GtkWidget* widget, AnjutaDevhelp* plugin)
+{
+ anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
+ plugin->view_sw, NULL);
+ webkit_web_view_open (WEBKIT_WEB_VIEW(plugin->view),
+ ONLINE_API_DOCS);
+ anjuta_devhelp_check_history (plugin);
}
static gboolean
@@ -151,7 +143,7 @@
{
gtk_notebook_set_current_page (GTK_NOTEBOOK (plugin->control_notebook), 0);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
- plugin->control_notebook, NULL);
+ plugin->main_vbox, NULL);
return FALSE;
}
@@ -173,7 +165,7 @@
}
static gboolean
-context_idle(AnjutaDevhelp* plugin)
+context_idle (AnjutaDevhelp* plugin)
{
IAnjutaEditor *editor;
gchar *current_word;
@@ -232,22 +224,6 @@
NULL,
NULL
},
- {
- "ActionDevhelpBack",
- ANJUTA_STOCK_HELP_PREV,
- N_("Previous Help"),
- NULL,
- N_("Go to previous help page"),
- G_CALLBACK (on_go_back_activate)
- },
- {
- "ActionDevhelpForward",
- ANJUTA_STOCK_HELP_NEXT,
- N_("Next Help"),
- NULL,
- N_("Go to next help page"),
- G_CALLBACK (on_go_forward_activate)
- },
#endif /* DISABLE_EMBEDDED_DEVHELP */
{
"ActionHelpApi",
@@ -282,7 +258,7 @@
/* Watches callbacks */
static void
-value_added_current_editor (AnjutaPlugin *plugin, const char *name,
+value_added_current_editor (AnjutaPlugin *plugin, const gchar *name,
const GValue *value, gpointer data)
{
GtkAction *action;
@@ -300,7 +276,7 @@
static void
value_removed_current_editor (AnjutaPlugin *plugin,
- const char *name, gpointer data)
+ const gchar *name, gpointer data)
{
GtkAction *action;
AnjutaDevhelp* devhelp = ANJUTA_PLUGIN_DEVHELP (data);
@@ -311,10 +287,17 @@
g_object_set (action, "sensitive", FALSE, NULL);
}
+#ifndef DISABLE_EMBEDDED_DEVHELP
+static void on_load_finished (GObject* view, GObject* frame, gpointer user_data)
+{
+ AnjutaDevhelp* devhelp = ANJUTA_PLUGIN_DEVHELP(user_data);
+ anjuta_devhelp_check_history(devhelp);
+}
+#endif
+
static gboolean
devhelp_activate (AnjutaPlugin *plugin)
{
-
AnjutaUI *ui;
AnjutaDevhelp *devhelp;
@@ -323,15 +306,16 @@
GNode *books;
GList *keywords;
GtkWidget* books_sw;
+ GtkWidget *button_hbox;
if (!init)
{
register_stock_icons (plugin);
init = TRUE;
- }
+ }
#endif
- DEBUG_PRINT ("AnjutaDevhelp: Activating AnjutaDevhelp plugin ...");
+ DEBUG_PRINT ("%s", "AnjutaDevhelp: Activating AnjutaDevhelp plugin ...");
devhelp = ANJUTA_PLUGIN_DEVHELP (plugin);
/* Add all UI actions and merge UI */
@@ -346,47 +330,100 @@
devhelp->uiid = anjuta_ui_merge (ui, UI_FILE);
#ifndef DISABLE_EMBEDDED_DEVHELP
-
+ /*
+ * Forward/back buttons
+ */
+ devhelp->main_vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (devhelp->main_vbox);
+ button_hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (button_hbox);
+
+ devhelp->go_back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
+ gtk_widget_show (devhelp->go_back);
+ gtk_box_pack_start (GTK_BOX (button_hbox), devhelp->go_back, FALSE, FALSE, 0);
+ gtk_widget_set_sensitive (devhelp->go_back, FALSE);
+ g_signal_connect (devhelp->go_back, "clicked",
+ G_CALLBACK (on_go_back_clicked), devhelp);
+
+ devhelp->go_forward = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
+ gtk_widget_show (devhelp->go_forward);
+ gtk_box_pack_start (GTK_BOX (button_hbox), devhelp->go_forward, FALSE, FALSE, 0);
+ gtk_widget_set_sensitive (devhelp->go_forward, FALSE);
+ g_signal_connect (devhelp->go_forward, "clicked",
+ G_CALLBACK (on_go_forward_clicked), devhelp);
+
+ devhelp->online = gtk_button_new_from_stock (_("Online"));
+ gtk_widget_show (devhelp->online);
+ gtk_box_pack_start (GTK_BOX (button_hbox), devhelp->online, FALSE, FALSE, 0);
+ g_signal_connect (devhelp->online, "clicked",
+ G_CALLBACK (on_online_clicked), devhelp);
+
+ gtk_box_pack_start (GTK_BOX (devhelp->main_vbox), button_hbox, FALSE, FALSE, 0);
+
+ /*
+ * Notebook
+ */
books = dh_base_get_book_tree (devhelp->base);
keywords = dh_base_get_keywords (devhelp->base);
- books_sw = gtk_scrolled_window_new(NULL, NULL);
+ books_sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (books_sw),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (books_sw),
- GTK_SHADOW_IN);
+ GTK_SHADOW_IN);
gtk_container_set_border_width (GTK_CONTAINER (books_sw), 2);
- devhelp->control_notebook = gtk_notebook_new();
- devhelp->book_tree = dh_book_tree_new(books);
- devhelp->search = dh_search_new(keywords);
+ devhelp->control_notebook = gtk_notebook_new ();
+ gtk_box_pack_start (GTK_BOX (devhelp->main_vbox), devhelp->control_notebook,
+ TRUE, TRUE, 0);
+ devhelp->book_tree = dh_book_tree_new (books);
+
+ devhelp->search = dh_search_new (keywords);
+ gtk_widget_set_size_request (devhelp->search, 0, 0);
g_signal_connect (devhelp->book_tree,
- "link-selected",
- G_CALLBACK (devhelp_tree_link_selected_cb),
- devhelp);
+ "link-selected",
+ G_CALLBACK (devhelp_tree_link_selected_cb),
+ devhelp);
g_signal_connect (devhelp->search,
- "link-selected",
- G_CALLBACK (devhelp_search_link_selected_cb),
- devhelp);
-
- gtk_container_add(GTK_CONTAINER(books_sw), devhelp->book_tree);
- gtk_notebook_append_page(GTK_NOTEBOOK(devhelp->control_notebook), books_sw,
- gtk_label_new(_("Books")));
- gtk_notebook_append_page(GTK_NOTEBOOK(devhelp->control_notebook), devhelp->search,
- gtk_label_new(_("Search")));
-
- devhelp->htmlview = html_view_new(devhelp);
-
- anjuta_shell_add_widget (plugin->shell, devhelp->control_notebook,
- "AnjutaDevhelpIndex", _("Help"), ANJUTA_STOCK_DEVHELP,
- ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
+ "link-selected",
+ G_CALLBACK (devhelp_search_link_selected_cb),
+ devhelp);
+
+ gtk_container_add (GTK_CONTAINER (books_sw), devhelp->book_tree);
+ gtk_notebook_append_page (GTK_NOTEBOOK (devhelp->control_notebook), books_sw,
+ gtk_label_new (_("Contents")));
+ gtk_notebook_append_page (GTK_NOTEBOOK (devhelp->control_notebook), devhelp->search,
+ gtk_label_new (_("Search")));
+
+ gtk_widget_show_all (devhelp->control_notebook);
+
+ /* View */
+ devhelp->view = webkit_web_view_new ();
+ gtk_widget_show (devhelp->view);
+
+ // TODO: Show some good start page
+ webkit_web_view_open (WEBKIT_WEB_VIEW (devhelp->view), "about:blank");
+ g_signal_connect(G_OBJECT (devhelp->view), "load-finished",
+ G_CALLBACK (on_load_finished), devhelp);
+
+ devhelp->view_sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (devhelp->view_sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_container_set_border_width (GTK_CONTAINER (devhelp->view_sw), 5);
+ gtk_widget_show (devhelp->view_sw);
+ gtk_container_add (GTK_CONTAINER (devhelp->view_sw), devhelp->view);
+
+ anjuta_shell_add_widget (plugin->shell, devhelp->main_vbox,
+ "AnjutaDevhelpIndex", _("Help"), ANJUTA_STOCK_DEVHELP,
+ ANJUTA_SHELL_PLACEMENT_LEFT, NULL);
/* This is the window that show the html help text */
- anjuta_shell_add_widget (plugin->shell, devhelp->htmlview,
- "AnjutaDevhelpDisplay", _("Help display"),
- ANJUTA_STOCK_DEVHELP,
- ANJUTA_SHELL_PLACEMENT_CENTER, NULL);
+ anjuta_shell_add_widget (plugin->shell, devhelp->view_sw,
+ "AnjutaDevhelpDisplay", _("Help display"),
+ ANJUTA_STOCK_DEVHELP,
+ ANJUTA_SHELL_PLACEMENT_CENTER, NULL);
#endif /* DISABLE_EMBEDDED_DEVHELP */
@@ -406,7 +443,7 @@
AnjutaUI *ui;
AnjutaDevhelp* devhelp = ANJUTA_PLUGIN_DEVHELP (plugin);
- DEBUG_PRINT ("AnjutaDevhelp: Dectivating AnjutaDevhelp plugin ...");
+ DEBUG_PRINT ("%s", "AnjutaDevhelp: Dectivating AnjutaDevhelp plugin ...");
ui = anjuta_shell_get_ui (plugin->shell, NULL);
@@ -415,8 +452,8 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
/* Remove widgets */
- anjuta_shell_remove_widget(plugin->shell, devhelp->htmlview, NULL);
- anjuta_shell_remove_widget(plugin->shell, devhelp->control_notebook, NULL);
+ anjuta_shell_remove_widget(plugin->shell, devhelp->view_sw, NULL);
+ anjuta_shell_remove_widget(plugin->shell, devhelp->main_vbox, NULL);
#endif /* DISABLE_EMBEDDED_DEVHELP */
@@ -431,47 +468,43 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
-void anjuta_devhelp_check_history(AnjutaDevhelp* devhelp)
+void
+anjuta_devhelp_check_history (AnjutaDevhelp* devhelp)
{
- GtkAction* action_forward;
- GtkAction* action_back;
- DhHtml* html = html_view_get_dh_html(HTML_VIEW(devhelp->htmlview));
-
- action_forward = gtk_action_group_get_action (devhelp->action_group,
- "ActionDevhelpForward");
- action_back = gtk_action_group_get_action (devhelp->action_group,
- "ActionDevhelpBack");
- if (html != NULL)
- {
- g_object_set (action_forward, "sensitive", dh_html_can_go_forward (html) , NULL);
- g_object_set (action_back, "sensitive", dh_html_can_go_back (html) , NULL);
- }
+ gtk_widget_set_sensitive (devhelp->go_forward, webkit_web_view_can_go_forward (WEBKIT_WEB_VIEW (devhelp->view)));
+
+ gtk_widget_set_sensitive (devhelp->go_back, webkit_web_view_can_go_back (WEBKIT_WEB_VIEW (devhelp->view)));
}
#endif /* DISABLE_EMBEDDED_DEVHELP */
-#if 0
static void
devhelp_finalize (GObject *obj)
{
+ DEBUG_PRINT ("%s", "Finalising Devhelp plugin");
+
/* Finalization codes here */
- AnjutaDevhelp *plugin = ANJUTA_PLUGIN_DEVHELP (obj);
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
devhelp_dispose (GObject *obj)
{
+ DEBUG_PRINT ("%s", "Disposing Devhelp plugin");
+
+#ifndef DISABLE_EMBEDDED_DEVHELP
AnjutaDevhelp* devhelp = ANJUTA_PLUGIN_DEVHELP (obj);
- /* Destroy devhelp - seems not to work... */
- // g_object_unref(G_OBJECT(devhelp->base));
+ if (devhelp->base)
+ {
+ g_object_unref(G_OBJECT(devhelp->base));
+ devhelp->base = NULL;
+ }
+#endif /* DISABLE_EMBEDDED_DEVHELP */
/* Disposition codes */
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
-#endif
static void
devhelp_instance_init (GObject *obj)
@@ -497,10 +530,9 @@
plugin_class->activate = devhelp_activate;
plugin_class->deactivate = devhelp_deactivate;
-#if 0
+
klass->finalize = devhelp_finalize;
klass->dispose = devhelp_dispose;
-#endif
}
#ifndef DISABLE_EMBEDDED_DEVHELP
@@ -513,9 +545,9 @@
plugin = ANJUTA_PLUGIN_DEVHELP (help);
anjuta_shell_present_widget (ANJUTA_PLUGIN (plugin)->shell,
- plugin->control_notebook, NULL);
+ plugin->main_vbox, NULL);
- dh_search_set_search_string (DH_SEARCH (plugin->search), query);
+ dh_search_set_search_string (DH_SEARCH (plugin->search), query, NULL);
gtk_notebook_set_current_page (GTK_NOTEBOOK (plugin->control_notebook), 1);
}
@@ -524,34 +556,33 @@
static void
ihelp_search (IAnjutaHelp *help, const gchar *query, GError **err)
{
- AnjutaDevhelp *plugin;
-
- plugin = ANJUTA_PLUGIN_DEVHELP (help);
+ gchar *cmd[4];
if (!anjuta_util_prog_is_installed ("devhelp", TRUE))
{
return;
}
- if(query && strlen (query) > 0)
+ cmd[0] = "devhelp";
+
+ if (query && strlen (query) > 0)
{
- fprintf(stderr, "Word is %s\n", query);
- if(fork()==0)
- {
- execlp("devhelp", "devhelp", "-s", query, NULL);
- g_warning (_("Cannot execute command: \"%s\""), "devhelp");
- _exit(1);
- }
+ cmd[1] = "-s";
+ cmd[2] = (gchar *)query;
+ cmd[3] = NULL;
}
else
{
- if(fork()==0)
- {
- execlp("devhelp", "devhelp", NULL);
- g_warning (_("Cannot execute command: \"%s\""), "devhelp");
- _exit(1);
- }
+ cmd[1] = NULL;
}
+
+ gdk_spawn_on_screen (gdk_screen_get_default (),
+ NULL,
+ cmd,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL, NULL, NULL);
}
#endif /* DISABLE_EMBEDDED_DEVHELP */
diff -urN anjuta-2.24.2/plugins/devhelp/plugin.h trunk/plugins/devhelp/plugin.h
--- anjuta-2.24.2/plugins/devhelp/plugin.h 2008-10-19 17:35:29.000000000 +0200
+++ trunk/plugins/devhelp/plugin.h 2008-12-07 23:31:25.927410883 +0100
@@ -49,10 +49,15 @@
#ifndef DISABLE_EMBEDDED_DEVHELP
DhBase *base;
#endif /* DISABLE_EMBEDDED_DEVHELP */
- GtkWidget *htmlview;
+ GtkWidget *view;
+ GtkWidget *view_sw;
GtkWidget *control_notebook;
+ GtkWidget *main_vbox;
GtkWidget *book_tree;
GtkWidget *search;
+ GtkWidget *go_back;
+ GtkWidget *go_forward;
+ GtkWidget *online;
IAnjutaEditor *editor;
guint editor_watch_id;