SF.net SVN: geany-plugins:[1838] trunk/geany-plugins/webhelper/src
colombanw at users.sourceforge.net
colombanw at xxxxx
Thu Jan 13 19:40:55 UTC 2011
Revision: 1838
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1838&view=rev
Author: colombanw
Date: 2011-01-13 19:40:55 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
WebHelper: Add a keybinding to toggle the inspector (defaults to F12)
Modified Paths:
--------------
trunk/geany-plugins/webhelper/src/gwh-browser.c
trunk/geany-plugins/webhelper/src/gwh-browser.h
trunk/geany-plugins/webhelper/src/gwh-keybindings.h
trunk/geany-plugins/webhelper/src/gwh-plugin.c
Modified: trunk/geany-plugins/webhelper/src/gwh-browser.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:40:26 UTC (rev 1837)
+++ trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:40:55 UTC (rev 1838)
@@ -188,6 +188,19 @@
(gtk_widget_get_visible ((self)->priv->inspector_view))
static void
+inspector_set_visible (GwhBrowser *self,
+ gboolean visible)
+{
+ if (visible != INSPECTOR_VISIBLE (self)) {
+ if (visible) {
+ webkit_web_inspector_show (self->priv->inspector);
+ } else {
+ webkit_web_inspector_close (self->priv->inspector);
+ }
+ }
+}
+
+static void
inspector_hide_window (GwhBrowser *self)
{
if (gtk_widget_get_visible (self->priv->inspector_window)) {
@@ -281,11 +294,7 @@
on_item_inspector_toggled (GtkToggleToolButton *button,
GwhBrowser *self)
{
- if (gtk_toggle_tool_button_get_active (button)) {
- webkit_web_inspector_show (self->priv->inspector);
- } else {
- webkit_web_inspector_close (self->priv->inspector);
- }
+ inspector_set_visible (self, gtk_toggle_tool_button_get_active (button));
}
static void
@@ -941,3 +950,11 @@
return gtk_window_get_transient_for (GTK_WINDOW (self->priv->inspector_window));
}
+
+void
+gwh_browser_toggle_inspector (GwhBrowser *self)
+{
+ g_return_if_fail (GWH_IS_BROWSER (self));
+
+ inspector_set_visible (self, ! INSPECTOR_VISIBLE (self));
+}
Modified: trunk/geany-plugins/webhelper/src/gwh-browser.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-browser.h 2011-01-13 19:40:26 UTC (rev 1837)
+++ trunk/geany-plugins/webhelper/src/gwh-browser.h 2011-01-13 19:40:55 UTC (rev 1838)
@@ -81,6 +81,8 @@
GtkWindow *window);
G_GNUC_INTERNAL
GtkWindow *gwh_browser_get_inspector_transient_for (GwhBrowser *self);
+G_GNUC_INTERNAL
+void gwh_browser_toggle_inspector (GwhBrowser *self);
G_END_DECLS
Modified: trunk/geany-plugins/webhelper/src/gwh-keybindings.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-keybindings.h 2011-01-13 19:40:26 UTC (rev 1837)
+++ trunk/geany-plugins/webhelper/src/gwh-keybindings.h 2011-01-13 19:40:55 UTC (rev 1838)
@@ -30,6 +30,7 @@
enum {
+ GWH_KB_TOGGLE_INSPECTOR,
GWH_KB_COUNT
};
Modified: trunk/geany-plugins/webhelper/src/gwh-plugin.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:40:26 UTC (rev 1837)
+++ trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:40:55 UTC (rev 1838)
@@ -24,6 +24,7 @@
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
#include <geanyplugin.h>
#include <geany.h>
@@ -245,7 +246,13 @@
NULL);
}
+static void
+on_kb_toggle_inspector (guint key_id)
+{
+ gwh_browser_toggle_inspector (GWH_BROWSER (G_browser));
+}
+
static gchar *
get_config_filename (void)
{
@@ -312,6 +319,11 @@
plugin_signal_connect (geany_plugin, NULL, "document-save", TRUE,
G_CALLBACK (on_document_save), NULL);
+
+ /* add keybindings */
+ keybindings_set_item (gwh_keybindings_get_group (), GWH_KB_TOGGLE_INSPECTOR,
+ on_kb_toggle_inspector, GDK_F12, 0, "toggle_inspector",
+ _("Toggle Web Inspector"), NULL);
}
void
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