Revision: 1979 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1979&view=re... Author: codebrainz Date: 2011-03-11 02:58:34 +0000 (Fri, 11 Mar 2011)
Log Message: ----------- Update history buttons when inter-document links are clicked.
Modified Paths: -------------- trunk/geany-plugins/devhelp/src/devhelpplugin.c
Modified: trunk/geany-plugins/devhelp/src/devhelpplugin.c =================================================================== --- trunk/geany-plugins/devhelp/src/devhelpplugin.c 2011-03-11 02:33:01 UTC (rev 1978) +++ trunk/geany-plugins/devhelp/src/devhelpplugin.c 2011-03-11 02:58:34 UTC (rev 1979) @@ -203,21 +203,36 @@ plug->zoom_level = webkit_web_view_get_zoom_level(view); }
+static void update_history_buttons(DevhelpPlugin *dhplug) +{ + WebKitWebView *view = WEBKIT_WEB_VIEW(dhplug->webview); + + gtk_widget_set_sensitive(GTK_WIDGET(dhplug->btn_back), + webkit_web_view_can_go_back(view)); + + gtk_widget_set_sensitive(GTK_WIDGET(dhplug->btn_forward), + webkit_web_view_can_go_forward(view)); +} + static void on_document_load_finished(WebKitWebView * view, WebKitWebFrame * frame, - gpointer user_data) + DevhelpPlugin *dhplug) { - DevhelpPlugin *plug = user_data; + update_history_buttons(dhplug); +}
- if (webkit_web_view_can_go_back(view)) - gtk_widget_set_sensitive(GTK_WIDGET(plug->btn_back), TRUE); - else - gtk_widget_set_sensitive(GTK_WIDGET(plug->btn_back), FALSE); +static void on_uri_changed_notify(GObject *object, + GParamSpec *pspec, + DevhelpPlugin *dhplug) +{ + update_history_buttons(dhplug); +}
- if (webkit_web_view_can_go_forward(view)) - gtk_widget_set_sensitive(GTK_WIDGET(plug->btn_forward), TRUE); - else - gtk_widget_set_sensitive(GTK_WIDGET(plug->btn_forward), FALSE); +static void on_load_status_changed_notify(GObject *object, + GParamSpec *pspec, + DevhelpPlugin *dhplug) +{ + update_history_buttons(dhplug); }
@@ -395,6 +410,14 @@ g_signal_connect(WEBKIT_WEB_VIEW(dhplug->webview), "document-load-finished", G_CALLBACK(on_document_load_finished), dhplug); + g_signal_connect(WEBKIT_WEB_VIEW(dhplug->webview), + "notify::uri", + G_CALLBACK(on_uri_changed_notify), + dhplug); + g_signal_connect(WEBKIT_WEB_VIEW(dhplug->webview), + "notify::load-status", + G_CALLBACK(on_load_status_changed_notify), + dhplug);
/* toggle state tracking */ dhplug->last_main_tab_id =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org