From 43f48a9b43e3c7d8dbc6e05f8fe5eeb850fb6ae8 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 8 Jan 2009 02:29:07 +0100 Subject: [PATCH] Let glib-genmarshal write our marshallers --- midori/marshal.list | 4 ++ midori/midori-locationaction.c | 37 +---------- midori/midori-panel.c | 38 +---------- midori/midori-searchaction.c | 37 +---------- midori/midori-view.c | 111 +-------------------------------- midori/wscript_build | 1 + wscript | 1 + 7 files changed, 12 insertions(+), 217 deletions(-) create mode 100644 midori/marshal.list diff --git a/midori/marshal.list b/midori/marshal.list new file mode 100644 index 00000000..53e9849d --- /dev/null +++ b/midori/marshal.list @@ -0,0 +1,4 @@ +BOOLEAN:VOID +VOID:OBJECT,ENUM +VOID:STRING,BOOLEAN +VOID:STRING,INT,STRING diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index c3b004bf..7fcf7867 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -13,6 +13,7 @@ #include "midori-locationaction.h" #include "gtkiconentry.h" +#include "marshal.h" #include "sokoke.h" #include @@ -95,42 +96,6 @@ static void midori_location_action_disconnect_proxy (GtkAction* action, GtkWidget* proxy); -static void -midori_cclosure_marshal_VOID__STRING_BOOLEAN (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void(*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, - const gchar* arg_1, - gboolean arg_2, - gpointer data2); - register GMarshalFunc_VOID__STRING_BOOLEAN callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data - ? marshal_data : cc->callback); - callback (data1, - g_value_get_string (param_values + 1), - g_value_get_boolean (param_values + 2), - data2); -} - static void midori_location_action_class_init (MidoriLocationActionClass* class) { diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 9794d257..4129d825 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -12,8 +12,10 @@ #include "midori-panel.h" #include "midori-view.h" -#include "sokoke.h" + #include "compat.h" +#include "marshal.h" +#include "sokoke.h" #include @@ -81,40 +83,6 @@ midori_panel_close (MidoriPanel* panel) return FALSE; } -static void -midori_cclosure_marshal_BOOLEAN__VOID (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef gboolean(*GMarshalFunc_BOOLEAN__VOID) (gpointer data1, - gpointer data2); - register GMarshalFunc_BOOLEAN__VOID callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - gboolean v_return; - - g_return_if_fail (return_value != NULL); - g_return_if_fail (n_param_values == 1); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data - ? marshal_data : cc->callback); - v_return = callback (data1, data2); - g_value_set_boolean (return_value, v_return); -} - static void midori_panel_class_init (MidoriPanelClass* class) { diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index b32d30e9..6a9d21c4 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -12,6 +12,7 @@ #include "midori-searchaction.h" #include "gtkiconentry.h" +#include "marshal.h" #include "sokoke.h" #include @@ -90,42 +91,6 @@ static void midori_search_action_disconnect_proxy (GtkAction* action, GtkWidget* proxy); -static void -midori_cclosure_marshal_VOID__STRING_BOOLEAN (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void(*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, - const gchar* arg_1, - gboolean arg_2, - gpointer data2); - register GMarshalFunc_VOID__STRING_BOOLEAN callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data - ? marshal_data : cc->callback); - callback (data1, - g_value_get_string (param_values + 1), - g_value_get_boolean (param_values + 2), - data2); -} - static void midori_search_action_class_init (MidoriSearchActionClass* class) { diff --git a/midori/midori-view.c b/midori/midori-view.c index 89b5e600..bd114f78 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -18,6 +18,7 @@ #include "midori-stock.h" #include "compat.h" +#include "marshal.h" #include "sokoke.h" #include @@ -163,116 +164,6 @@ midori_view_settings_notify_cb (MidoriWebSettings* settings, GParamSpec* pspec, MidoriView* view); -static void -midori_cclosure_marshal_VOID__STRING_BOOLEAN (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void(*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, - gpointer arg_1, - gboolean arg_2, - gpointer data2); - register GMarshalFunc_VOID__STRING_BOOLEAN callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data - ? marshal_data : cc->callback); - callback (data1, - (gchar*)g_value_get_string (param_values + 1), - g_value_get_boolean (param_values + 2), - data2); -} - -static void -midori_cclosure_marshal_VOID__OBJECT_ENUM (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void(*GMarshalFunc_VOID__OBJECT_ENUM) (gpointer data1, - gpointer arg_1, - gint arg_2, - gpointer data2); - register GMarshalFunc_VOID__OBJECT_ENUM callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 3); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__OBJECT_ENUM) (marshal_data - ? marshal_data : cc->callback); - callback (data1, - g_value_get_object (param_values + 1), - g_value_get_enum (param_values + 2), - data2); -} - -static void -midori_cclosure_marshal_VOID__STRING_INT_STRING (GClosure* closure, - GValue* return_value, - guint n_param_values, - const GValue* param_values, - gpointer invocation_hint, - gpointer marshal_data) -{ - typedef void(*GMarshalFunc_VOID__STRING_INT_STRING) (gpointer data1, - gpointer arg_1, - gint arg_2, - gpointer arg_3, - gpointer data2); - register GMarshalFunc_VOID__STRING_INT_STRING callback; - register GCClosure* cc = (GCClosure*) closure; - register gpointer data1, data2; - - g_return_if_fail (n_param_values == 4); - - if (G_CCLOSURE_SWAP_DATA (closure)) - { - data1 = closure->data; - data2 = g_value_peek_pointer (param_values + 0); - } - else - { - data1 = g_value_peek_pointer (param_values + 0); - data2 = closure->data; - } - callback = (GMarshalFunc_VOID__STRING_INT_STRING) (marshal_data - ? marshal_data : cc->callback); - callback (data1, - (gchar*)g_value_get_string (param_values + 1), - g_value_get_int (param_values + 2), - (gchar*)g_value_get_string (param_values + 3), - data2); -} - static void midori_view_class_init (MidoriViewClass* class) { diff --git a/midori/wscript_build b/midori/wscript_build index 3e3b1324..9c8d1273 100644 --- a/midori/wscript_build +++ b/midori/wscript_build @@ -6,5 +6,6 @@ obj = bld.new_task_gen ('cc', 'program') obj.target = 'midori' obj.includes = '. .. ../panels' obj.find_sources_in_dirs ('. ../panels') +obj.add_marshal_file ('marshal.list', 'midori_cclosure_marshal') obj.uselib = 'UNIQUE LIBSOUP GMODULE GTHREAD GIO GTK SQLITE WEBKIT LIBXML' obj.uselib_local = 'katze' diff --git a/wscript b/wscript index 31383330..a1565052 100644 --- a/wscript +++ b/wscript @@ -50,6 +50,7 @@ def configure (conf): return dirvalue conf.check_tool ('compiler_cc') + conf.check_tool ('glib2') if option_enabled ('userdocs'): conf.find_program ('rst2html.py', var='RST2HTML')