Revision: 1841
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1841&view=rev
Author: colombanw
Date: 2011-01-13 21:54:37 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
WebHelper: Fix handling of keybindings using Shift and a letter
key-press-event signal seems to give an uppercase keyval when shift
is pressed, but Geany doesn't store this. So, lowercase the keyval when
shift modifier is on.
Modified Paths:
--------------
trunk/geany-plugins/webhelper/src/gwh-keybindings.c
Modified: trunk/geany-plugins/webhelper/src/gwh-keybindings.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-keybindings.c 2011-01-13 19:41:55 UTC (rev 1840)
+++ trunk/geany-plugins/webhelper/src/gwh-keybindings.c 2011-01-13 21:54:37 UTC (rev 1841)
@@ -69,13 +69,17 @@
{
guint mods = event->state & gtk_accelerator_get_default_mod_mask ();
gboolean handled = FALSE;
+ guint keyval = event->keyval;
guint i;
+ if (mods & GDK_SHIFT_MASK) {
+ keyval = gdk_keyval_to_lower (keyval);
+ }
for (i = 0; ! handled && i < GWH_KB_COUNT; i++) {
GeanyKeyBinding *kb;
kb = keybindings_get_item (G_key_group, i);
- if (kb->key == event->keyval && kb->mods == mods) {
+ if (kb->key == keyval && kb->mods == mods) {
if (kb->callback) {
kb->callback (i);
/* We can't handle key group callback since we can't acces key group
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1839
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1839&view=rev
Author: colombanw
Date: 2011-01-13 19:41:30 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
WebHelper: Update copyright information for 2011
Modified Paths:
--------------
trunk/geany-plugins/webhelper/src/gwh-browser.c
trunk/geany-plugins/webhelper/src/gwh-browser.h
trunk/geany-plugins/webhelper/src/gwh-plugin.c
trunk/geany-plugins/webhelper/src/gwh-settings.c
trunk/geany-plugins/webhelper/src/gwh-settings.h
trunk/geany-plugins/webhelper/src/gwh-utils.c
trunk/geany-plugins/webhelper/src/gwh-utils.h
Modified: trunk/geany-plugins/webhelper/src/gwh-browser.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-browser.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-browser.h 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-browser.h 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-plugin.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-settings.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-settings.c 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-settings.c 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-settings.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-settings.h 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-settings.h 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-utils.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-utils.c 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-utils.c 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
Modified: trunk/geany-plugins/webhelper/src/gwh-utils.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-utils.h 2011-01-13 19:40:55 UTC (rev 1838)
+++ trunk/geany-plugins/webhelper/src/gwh-utils.h 2011-01-13 19:41:30 UTC (rev 1839)
@@ -1,6 +1,6 @@
/*
*
- * Copyright (C) 2010 Colomban Wendling <ban(a)herbesfolles.org>
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
*
* 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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1837
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1837&view=rev
Author: colombanw
Date: 2011-01-13 19:40:26 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
WebHelper: Add support for keybindings (to come)
This uses Geany's keybinding mechanism, but also supports the
keybindings in the other windows (actually, in the web view and
inspector).
Modified Paths:
--------------
trunk/geany-plugins/webhelper/src/Makefile.am
trunk/geany-plugins/webhelper/src/gwh-browser.c
trunk/geany-plugins/webhelper/src/gwh-plugin.c
trunk/geany-plugins/webhelper/wscript_build
Added Paths:
-----------
trunk/geany-plugins/webhelper/src/gwh-keybindings.c
trunk/geany-plugins/webhelper/src/gwh-keybindings.h
Modified: trunk/geany-plugins/webhelper/src/Makefile.am
===================================================================
--- trunk/geany-plugins/webhelper/src/Makefile.am 2011-01-13 19:39:51 UTC (rev 1836)
+++ trunk/geany-plugins/webhelper/src/Makefile.am 2011-01-13 19:40:26 UTC (rev 1837)
@@ -12,10 +12,12 @@
sources = gwh-browser.c \
+ gwh-keybindings.c \
gwh-plugin.c \
gwh-settings.c \
gwh-utils.c
headers = gwh-browser.h \
+ gwh-keybindings.h \
gwh-plugin.h \
gwh-settings.h \
gwh-utils.h
Modified: trunk/geany-plugins/webhelper/src/gwh-browser.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:39:51 UTC (rev 1836)
+++ trunk/geany-plugins/webhelper/src/gwh-browser.c 2011-01-13 19:40:26 UTC (rev 1837)
@@ -29,6 +29,7 @@
#include "gwh-utils.h"
#include "gwh-settings.h"
+#include "gwh-keybindings.h"
#if ! GTK_CHECK_VERSION (2, 18, 0)
@@ -238,6 +239,7 @@
inspector_hide_window (self);
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (self->priv->item_inspector),
FALSE);
+ gtk_widget_grab_focus (self->priv->web_view);
return TRUE;
}
@@ -838,6 +840,11 @@
g_signal_connect (G_OBJECT (self->priv->web_view), "scroll-event",
G_CALLBACK (on_web_view_scroll_event), self);
+ g_signal_connect (self->priv->web_view, "key-press-event",
+ G_CALLBACK (gwh_keybindings_handle_event), self);
+ g_signal_connect (self->priv->inspector_view, "key-press-event",
+ G_CALLBACK (gwh_keybindings_handle_event), self);
+
gtk_widget_grab_focus (self->priv->url_entry);
g_signal_connect (self->priv->settings, "notify::browser-last-uri",
Added: trunk/geany-plugins/webhelper/src/gwh-keybindings.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-keybindings.c (rev 0)
+++ trunk/geany-plugins/webhelper/src/gwh-keybindings.c 2011-01-13 19:40:26 UTC (rev 1837)
@@ -0,0 +1,91 @@
+/*
+ *
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
+ *
+ * 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 3 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "gwh-keybindings.h"
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <geanyplugin.h>
+#include <geany.h>
+
+#include "gwh-plugin.h"
+
+
+static GeanyKeyGroup *G_key_group;
+
+
+void
+gwh_keybindings_init (void)
+{
+ G_key_group = plugin_set_key_group (geany_plugin, "webhelper", GWH_KB_COUNT,
+ NULL);
+}
+
+void
+gwh_keybindings_cleanup (void)
+{
+ G_key_group = NULL;
+}
+
+GeanyKeyGroup *
+gwh_keybindings_get_group (void)
+{
+ return G_key_group;
+}
+
+/**
+ * ghw_keybindings_handle_event:
+ * @widget: Unused, may be %NULL
+ * @event: A GdkEventKey to handle
+ * @data: Unused, may be %NULL
+ *
+ * Handles a GDK key event and calls corresponding keybindings callbacks.
+ * This function is meant to be used as the callback for a
+ * GtkWidget:key-press-event signal.
+ *
+ * Returns: Whether the event was handled or not
+ */
+gboolean
+gwh_keybindings_handle_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ guint mods = event->state & gtk_accelerator_get_default_mod_mask ();
+ gboolean handled = FALSE;
+ guint i;
+
+ for (i = 0; ! handled && i < GWH_KB_COUNT; i++) {
+ GeanyKeyBinding *kb;
+
+ kb = keybindings_get_item (G_key_group, i);
+ if (kb->key == event->keyval && kb->mods == mods) {
+ if (kb->callback) {
+ kb->callback (i);
+ /* We can't handle key group callback since we can't acces key group
+ * fields. However, we don't use it so it's not a real problem. */
+ /*} else if (G_key_group->callback) {
+ G_key_group->callback (i);*/
+ }
+ handled = TRUE;
+ }
+ }
+
+ return handled;
+}
Added: trunk/geany-plugins/webhelper/src/gwh-keybindings.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-keybindings.h (rev 0)
+++ trunk/geany-plugins/webhelper/src/gwh-keybindings.h 2011-01-13 19:40:26 UTC (rev 1837)
@@ -0,0 +1,51 @@
+/*
+ *
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
+ *
+ * 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 3 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef H_GWH_KEYBINDINGS
+#define H_GWH_KEYBINDINGS
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <geanyplugin.h>
+#include <geany.h>
+
+G_BEGIN_DECLS
+
+
+enum {
+ GWH_KB_COUNT
+};
+
+
+G_GNUC_INTERNAL
+void gwh_keybindings_init (void);
+G_GNUC_INTERNAL
+void gwh_keybindings_cleanup (void);
+G_GNUC_INTERNAL
+GeanyKeyGroup *gwh_keybindings_get_group (void);
+G_GNUC_INTERNAL
+gboolean gwh_keybindings_handle_event (GtkWidget *widget G_GNUC_UNUSED,
+ GdkEventKey *event,
+ gpointer data G_GNUC_UNUSED);
+
+
+G_END_DECLS
+
+#endif /* guard */
Modified: trunk/geany-plugins/webhelper/src/gwh-plugin.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:39:51 UTC (rev 1836)
+++ trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:40:26 UTC (rev 1837)
@@ -33,6 +33,7 @@
#include "gwh-browser.h"
#include "gwh-settings.h"
#include "gwh-plugin.h"
+#include "gwh-keybindings.h"
GeanyPlugin *geany_plugin;
@@ -296,6 +297,7 @@
plugin_module_make_resident (geany_plugin);
load_config ();
+ gwh_keybindings_init ();
G_browser = gwh_browser_new ();
g_signal_connect (G_browser, "populate-popup",
@@ -317,6 +319,7 @@
{
detach_browser ();
+ gwh_keybindings_cleanup ();
save_config ();
}
Modified: trunk/geany-plugins/webhelper/wscript_build
===================================================================
--- trunk/geany-plugins/webhelper/wscript_build 2011-01-13 19:39:51 UTC (rev 1836)
+++ trunk/geany-plugins/webhelper/wscript_build 2011-01-13 19:40:26 UTC (rev 1837)
@@ -27,11 +27,13 @@
name = 'WebHelper'
sources = [
'src/gwh-browser.c',
+ 'src/gwh-keybindings.c',
'src/gwh-plugin.c',
'src/gwh-settings.c',
'src/gwh-utils.c']
header = [
'src/gwh-browser.h',
+ 'src/gwh-keybindings.h',
'src/gwh-plugin.h',
'src/gwh-settings.h',
'src/gwh-utils.h']
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1836
http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1836&view=rev
Author: colombanw
Date: 2011-01-13 19:39:51 +0000 (Thu, 13 Jan 2011)
Log Message:
-----------
WebHelper: Add global plugin data in a header to make it accessible
This will allow use of Geany functions from other files than
gwh-plugin.c, by including gwh-plugin.h.
Modified Paths:
--------------
trunk/geany-plugins/webhelper/src/Makefile.am
trunk/geany-plugins/webhelper/src/gwh-plugin.c
trunk/geany-plugins/webhelper/wscript_build
Added Paths:
-----------
trunk/geany-plugins/webhelper/src/gwh-plugin.h
Modified: trunk/geany-plugins/webhelper/src/Makefile.am
===================================================================
--- trunk/geany-plugins/webhelper/src/Makefile.am 2011-01-13 19:39:19 UTC (rev 1835)
+++ trunk/geany-plugins/webhelper/src/Makefile.am 2011-01-13 19:39:51 UTC (rev 1836)
@@ -16,6 +16,7 @@
gwh-settings.c \
gwh-utils.c
headers = gwh-browser.h \
+ gwh-plugin.h \
gwh-settings.h \
gwh-utils.h
autogen_sources = gwh-enum-types.c
Modified: trunk/geany-plugins/webhelper/src/gwh-plugin.c
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:39:19 UTC (rev 1835)
+++ trunk/geany-plugins/webhelper/src/gwh-plugin.c 2011-01-13 19:39:51 UTC (rev 1836)
@@ -32,12 +32,9 @@
#include "gwh-utils.h"
#include "gwh-browser.h"
#include "gwh-settings.h"
+#include "gwh-plugin.h"
-#define PLUGIN_NAME "Web Helper"
-#define PLUGIN_TARNAME "web-helper"
-
-
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
GeanyFunctions *geany_functions;
@@ -51,7 +48,7 @@
_("Display a preview web page that gets updated upon document saving and "
"provide web analysis and debugging tools (aka Web Inspector), all using "
"WebKit."),
- "0.1",
+ GWH_PLUGIN_VERSION,
"Colomban Wendling <ban(a)herbesfolles.org>"
)
@@ -61,7 +58,6 @@
CONTAINER_WINDOW
};
-
static GtkWidget *G_browser = NULL;
static struct {
guint type;
@@ -253,7 +249,7 @@
get_config_filename (void)
{
return g_build_filename (geany_data->app->configdir, "plugins",
- PLUGIN_TARNAME, PLUGIN_TARNAME".conf", NULL);
+ GWH_PLUGIN_TARNAME, GWH_PLUGIN_TARNAME".conf", NULL);
}
static void
Added: trunk/geany-plugins/webhelper/src/gwh-plugin.h
===================================================================
--- trunk/geany-plugins/webhelper/src/gwh-plugin.h (rev 0)
+++ trunk/geany-plugins/webhelper/src/gwh-plugin.h 2011-01-13 19:39:51 UTC (rev 1836)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (C) 2010-2011 Colomban Wendling <ban(a)herbesfolles.org>
+ *
+ * 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 3 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef H_GWH_PLUGIN
+#define H_GWH_PLUGIN
+
+#include <glib.h>
+
+#include <geanyplugin.h>
+#include <geany.h>
+
+G_BEGIN_DECLS
+
+
+#define GWH_PLUGIN_NAME "Web Helper"
+#define GWH_PLUGIN_TARNAME "web-helper"
+#define GWH_PLUGIN_VERSION "0.1"
+
+
+extern GeanyPlugin *geany_plugin;
+extern GeanyData *geany_data;
+extern GeanyFunctions *geany_functions;
+
+
+G_END_DECLS
+
+#endif /* guard */
Modified: trunk/geany-plugins/webhelper/wscript_build
===================================================================
--- trunk/geany-plugins/webhelper/wscript_build 2011-01-13 19:39:19 UTC (rev 1835)
+++ trunk/geany-plugins/webhelper/wscript_build 2011-01-13 19:39:51 UTC (rev 1836)
@@ -32,6 +32,7 @@
'src/gwh-utils.c']
header = [
'src/gwh-browser.h',
+ 'src/gwh-plugin.h',
'src/gwh-settings.h',
'src/gwh-utils.h']
generated_sources = [
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.