Removed callback.c this could also be done in main.c.
authorDaniel Carl <danielcarl@gmx.de>
Mon, 1 Oct 2012 18:07:49 +0000 (20:07 +0200)
committerDaniel Carl <danielcarl@gmx.de>
Mon, 1 Oct 2012 18:07:49 +0000 (20:07 +0200)
src/callback.c [deleted file]
src/callback.h [deleted file]
src/keybind.c
src/main.c

diff --git a/src/callback.c b/src/callback.c
deleted file mode 100644 (file)
index 9f2b099..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "main.h"
-#include "callback.h"
-#include "config.h"
-
-void webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec)
-{
-    Gui* gui        = &vp.gui;
-    const char* uri = webkit_web_view_get_uri(gui->webview);
-
-    switch (webkit_web_view_get_load_status(gui->webview)) {
-        case WEBKIT_LOAD_COMMITTED:
-            vp_update_urlbar(uri);
-            break;
-
-        case WEBKIT_LOAD_FINISHED:
-            break;
-
-        default:
-            break;
-    }
-}
-
-void destroy_window_cb(GtkWidget* widget, GtkWidget* window)
-{
-    vp_close_browser(0);
-}
-
-gboolean dummy_cb(void)
-{
-    return TRUE;
-}
diff --git a/src/callback.h b/src/callback.h
deleted file mode 100644 (file)
index d2839ae..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef CALLBACKS_H
-#define CALLBACKS_H
-
-/* callbacks */
-void webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec);
-void destroy_window_cb(GtkWidget* widget, GtkWidget* window);
-gboolean dummy_cb(void);
-
-#endif /* end of include guard: CALLBACKS_H */
index a79cb5f..c31e446 100644 (file)
@@ -76,6 +76,7 @@ static gboolean keybind_keypress_callback(WebKitWebView* webview, GdkEventKey* e
     for (tmp = keys; tmp != NULL; tmp = tmp->next) {
         struct _keybind_key* keybind = (struct _keybind_key*)tmp->data;
 
+        /* handle key presses */
         if (gdk_keyval_to_lower(event->keyval) == keybind->keyval
             && (event->state & keybind->modmask) == keybind->modmask
             && keybind->modkey == vp.state.modkey
index 1f27c48..9ca09c5 100644 (file)
@@ -1,12 +1,16 @@
 #include "config.h"
 #include "main.h"
 #include "command.h"
-#include "callback.h"
 #include "keybind.h"
 
 /* variables */
 VpCore vp;
 
+/* callbacks */
+void vp_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec);
+void vp_destroy_window_cb(GtkWidget* widget, GtkWidget* window);
+gboolean vp_frame_scrollbar_policy_changed_cb(void);
+
 /* functions */
 static void vp_print_version(void);
 static void vp_init(void);
@@ -14,6 +18,34 @@ static void vp_init_gui(void);
 static void vp_setup_signals(void);
 
 
+void vp_webview_load_status_cb(WebKitWebView* view, GParamSpec* pspec)
+{
+    Gui* gui        = &vp.gui;
+    const char* uri = webkit_web_view_get_uri(gui->webview);
+
+    switch (webkit_web_view_get_load_status(gui->webview)) {
+        case WEBKIT_LOAD_COMMITTED:
+            vp_update_urlbar(uri);
+            break;
+
+        case WEBKIT_LOAD_FINISHED:
+            break;
+
+        default:
+            break;
+    }
+}
+
+void vp_destroy_window_cb(GtkWidget* widget, GtkWidget* window)
+{
+    vp_close_browser(0);
+}
+
+gboolean vp_frame_scrollbar_policy_changed_cb(void)
+{
+    return TRUE;
+}
+
 gboolean vp_load_uri(const Arg* arg)
 {
     char* u;
@@ -104,7 +136,7 @@ static void vp_init(void)
     keybind_init();
 
     /*command_parse_line("quit", NULL);*/
-    keybind_add(VP_MODE_NORMAL, GDK_g, 0, GDK_f, "source");
+    keybind_add(VP_MODE_NORMAL, GDK_g, 0, GDK_s, "source");
     keybind_add(VP_MODE_NORMAL, 0,     0, GDK_d, "quit");
 }
 
@@ -188,9 +220,9 @@ static void vp_setup_signals(void)
 
     /* Set up callbacks so that if either the main window or the browser
      * instance is closed, the program will exit */
-    g_signal_connect(gui->window, "destroy", G_CALLBACK(destroy_window_cb), NULL);
-    g_signal_connect(G_OBJECT(frame), "scrollbars-policy-changed", G_CALLBACK(dummy_cb), NULL);
-    g_signal_connect(G_OBJECT(gui->webview), "notify::load-status", G_CALLBACK(webview_load_status_cb), NULL);
+    g_signal_connect(gui->window, "destroy", G_CALLBACK(vp_destroy_window_cb), NULL);
+    g_signal_connect(G_OBJECT(frame), "scrollbars-policy-changed", G_CALLBACK(vp_frame_scrollbar_policy_changed_cb), NULL);
+    g_signal_connect(G_OBJECT(gui->webview), "notify::load-status", G_CALLBACK(vp_webview_load_status_cb), NULL);
 }
 
 int main(int argc, char* argv[])