[gnome-settings-daemon] plugins: Cleanup macro magic in plugin.h
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] plugins: Cleanup macro magic in plugin.h
- Date: Wed, 13 Oct 2010 14:02:15 +0000 (UTC)
commit 0dda56c4462e070dabdab68092b6574b5e894181
Author: Paolo Borelli <pborelli katamail com>
Date: Wed Oct 13 15:00:01 2010 +0100
plugins: Cleanup macro magic in plugin.h
gnome-settings--plugin.h contains a lot of macro voodoo coming
from the original gedit code.
glib 2.14 introduced a macro that can be used to simplify
all that cruft.
https://bugzilla.gnome.org/show_bug.cgi?id=591798
gnome-settings-daemon/gnome-settings-plugin.h | 126 ++--------------------
plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c | 6 +
plugins/background/gsd-background-plugin.c | 6 +
plugins/clipboard/gsd-clipboard-plugin.c | 6 +
plugins/dummy/gsd-dummy-plugin.c | 6 +
plugins/font/gsd-font-plugin.c | 6 +
plugins/housekeeping/gsd-housekeeping-plugin.c | 6 +
plugins/keybindings/gsd-keybindings-plugin.c | 6 +
plugins/keyboard/gsd-keyboard-plugin.c | 6 +
plugins/media-keys/gsd-media-keys-plugin.c | 6 +
plugins/mouse/gsd-mouse-plugin.c | 6 +
plugins/smartcard/gsd-smartcard-plugin.c | 6 +
plugins/sound/gsd-sound-plugin.c | 6 +
plugins/xrandr/gsd-xrandr-plugin.c | 6 +
plugins/xrdb/gsd-xrdb-plugin.c | 6 +
plugins/xsettings/gsd-xsettings-plugin.c | 6 +
16 files changed, 101 insertions(+), 115 deletions(-)
---
diff --git a/gnome-settings-daemon/gnome-settings-plugin.h b/gnome-settings-daemon/gnome-settings-plugin.h
index 77f2dd9..9186a1f 100644
--- a/gnome-settings-daemon/gnome-settings-plugin.h
+++ b/gnome-settings-daemon/gnome-settings-plugin.h
@@ -57,123 +57,19 @@ void gnome_settings_plugin_deactivate (GnomeSettingsPlugin *
*
* use: GNOME_SETTINGS_PLUGIN_REGISTER (PluginName, plugin_name)
*/
-#define GNOME_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \
- \
-static GType plugin_name##_type = 0; \
-static GTypeModule *plugin_module_type = 0; \
- \
-GType \
-plugin_name##_get_type (void) \
-{ \
- return plugin_name##_type; \
-} \
- \
-static void plugin_name##_init (PluginName *self); \
-static void plugin_name##_class_init (PluginName##Class *klass); \
-static gpointer plugin_name##_parent_class = NULL; \
-static void plugin_name##_class_intern_init (gpointer klass) \
-{ \
- plugin_name##_parent_class = g_type_class_peek_parent (klass); \
- plugin_name##_class_init ((PluginName##Class *) klass); \
-} \
- \
-G_MODULE_EXPORT GType \
-register_gnome_settings_plugin (GTypeModule *module) \
-{ \
- static const GTypeInfo our_info = \
- { \
- sizeof (PluginName##Class), \
- NULL, /* base_init */ \
- NULL, /* base_finalize */ \
- (GClassInitFunc) plugin_name##_class_intern_init, \
- NULL, \
- NULL, /* class_data */ \
- sizeof (PluginName), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) plugin_name##_init \
- }; \
- \
- g_debug ("Registering " #PluginName); \
- \
- /* Initialise the i18n stuff */ \
- bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); \
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \
- \
- plugin_module_type = module; \
- plugin_name##_type = g_type_module_register_type (module, \
- GNOME_TYPE_SETTINGS_PLUGIN, \
- #PluginName, \
- &our_info, \
- 0); \
- \
- return plugin_name##_type; \
+#define GNOME_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \
+ G_DEFINE_DYNAMIC_TYPE (PluginName, \
+ plugin_name, \
+ GNOME_TYPE_SETTINGS_PLUGIN) \
+ \
+G_MODULE_EXPORT GType \
+register_gnome_settings_plugin (GTypeModule *type_module) \
+{ \
+ plugin_name##_register_type (type_module); \
+ \
+ return plugin_name##_get_type(); \
}
-/*
- * Utility macro used to register gobject types in plugins with additional code
- *
- * use: GNOME_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE)
- */
-#define GNOME_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \
-static void object_name##_init (ObjectName *self); \
-static void object_name##_class_init (ObjectName##Class *klass); \
-static gpointer object_name##_parent_class = ((void *)0); \
-static GType ojbect_name##_type_id = 0; \
- \
-static void object_name##_class_intern_init (gpointer klass) \
-{ \
- object_name##_parent_class = g_type_class_peek_parent (klass); \
- object_name##_class_init ((ObjectName##Class *) klass); \
-} \
- \
- \
-GType \
-object_name##_get_type (void) \
-{ \
- g_assert (object_name##_type_id != 0); \
- \
- return object_name##_type_id; \
-} \
- \
-GType \
-object_name##_register_type (GTypeModule *module) \
-{ \
- if ((object_name##_type_id == 0)) { \
- const GTypeInfo g_define_type_info = { \
- sizeof (ObjectName##Class), \
- (GBaseInitFunc) ((void *)0), \
- (GBaseFinalizeFunc) ((void *)0), \
- (GClassInitFunc) object_name##_class_intern_init, \
- (GClassFinalizeFunc) ((void *)0), \
- ((void *)0), \
- sizeof (ObjectName), \
- 0, \
- (GInstanceInitFunc) object_name##_init, \
- ((void *)0) \
- }; \
- object_name##_type_id = \
- g_type_module_register_type (module, \
- PARENT_TYPE, \
- #ObjectName, \
- &g_define_type_info, \
- (GTypeFlags) 0); \
- } \
- \
- g_debug ("Registering " #ObjectName); \
- \
- CODE \
- \
- return type_name##_type_id; \
-}
-
-/*
- * Utility macro used to register gobject types in plugins
- *
- * use: GNOME_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE)
- */
-#define GNOME_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \
- GNOME_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;)
-
G_END_DECLS
#endif /* __GNOME_SETTINGS_PLUGIN_H__ */
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
index e35cf3f..d6e22bc 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
@@ -102,3 +102,9 @@ gsd_a11y_keyboard_plugin_class_init (GsdA11yKeyboardPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdA11yKeyboardPluginPrivate));
}
+
+static void
+gsd_a11y_keyboard_plugin_class_finalize (GsdA11yKeyboardPluginClass *klass)
+{
+}
+
diff --git a/plugins/background/gsd-background-plugin.c b/plugins/background/gsd-background-plugin.c
index 46e98be..ed434e6 100644
--- a/plugins/background/gsd-background-plugin.c
+++ b/plugins/background/gsd-background-plugin.c
@@ -102,3 +102,9 @@ gsd_background_plugin_class_init (GsdBackgroundPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdBackgroundPluginPrivate));
}
+
+static void
+gsd_background_plugin_class_finalize (GsdBackgroundPluginClass *klass)
+{
+}
+
diff --git a/plugins/clipboard/gsd-clipboard-plugin.c b/plugins/clipboard/gsd-clipboard-plugin.c
index 9b3b05c..f4bfc19 100644
--- a/plugins/clipboard/gsd-clipboard-plugin.c
+++ b/plugins/clipboard/gsd-clipboard-plugin.c
@@ -102,3 +102,9 @@ gsd_clipboard_plugin_class_init (GsdClipboardPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdClipboardPluginPrivate));
}
+
+static void
+gsd_clipboard_plugin_class_finalize (GsdClipboardPluginClass *klass)
+{
+}
+
diff --git a/plugins/dummy/gsd-dummy-plugin.c b/plugins/dummy/gsd-dummy-plugin.c
index 78342d7..1bb01d9 100644
--- a/plugins/dummy/gsd-dummy-plugin.c
+++ b/plugins/dummy/gsd-dummy-plugin.c
@@ -102,3 +102,9 @@ gsd_dummy_plugin_class_init (GsdDummyPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdDummyPluginPrivate));
}
+
+static void
+gsd_dummy_plugin_class_finalize (GsdDummyPluginClass *klass)
+{
+}
+
diff --git a/plugins/font/gsd-font-plugin.c b/plugins/font/gsd-font-plugin.c
index 6808742..83905f3 100644
--- a/plugins/font/gsd-font-plugin.c
+++ b/plugins/font/gsd-font-plugin.c
@@ -102,3 +102,9 @@ gsd_font_plugin_class_init (GsdFontPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdFontPluginPrivate));
}
+
+static void
+gsd_font_plugin_class_finalize (GsdFontPluginClass *klass)
+{
+}
+
diff --git a/plugins/housekeeping/gsd-housekeeping-plugin.c b/plugins/housekeeping/gsd-housekeeping-plugin.c
index 5e7a965..6532223 100644
--- a/plugins/housekeeping/gsd-housekeeping-plugin.c
+++ b/plugins/housekeeping/gsd-housekeeping-plugin.c
@@ -102,3 +102,9 @@ gsd_housekeeping_plugin_class_init (GsdHousekeepingPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdHousekeepingPluginPrivate));
}
+
+static void
+gsd_housekeeping_plugin_class_finalize (GsdHousekeepingPluginClass *klass)
+{
+}
+
diff --git a/plugins/keybindings/gsd-keybindings-plugin.c b/plugins/keybindings/gsd-keybindings-plugin.c
index f9388de..938164c 100644
--- a/plugins/keybindings/gsd-keybindings-plugin.c
+++ b/plugins/keybindings/gsd-keybindings-plugin.c
@@ -102,3 +102,9 @@ gsd_keybindings_plugin_class_init (GsdKeybindingsPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdKeybindingsPluginPrivate));
}
+
+static void
+gsd_keybindings_plugin_class_finalize (GsdKeybindingsPluginClass *klass)
+{
+}
+
diff --git a/plugins/keyboard/gsd-keyboard-plugin.c b/plugins/keyboard/gsd-keyboard-plugin.c
index 456d37d..72549a8 100644
--- a/plugins/keyboard/gsd-keyboard-plugin.c
+++ b/plugins/keyboard/gsd-keyboard-plugin.c
@@ -102,3 +102,9 @@ gsd_keyboard_plugin_class_init (GsdKeyboardPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdKeyboardPluginPrivate));
}
+
+static void
+gsd_keyboard_plugin_class_finalize (GsdKeyboardPluginClass *klass)
+{
+}
+
diff --git a/plugins/media-keys/gsd-media-keys-plugin.c b/plugins/media-keys/gsd-media-keys-plugin.c
index 3fe36e4..8ae38e7 100644
--- a/plugins/media-keys/gsd-media-keys-plugin.c
+++ b/plugins/media-keys/gsd-media-keys-plugin.c
@@ -102,3 +102,9 @@ gsd_media_keys_plugin_class_init (GsdMediaKeysPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdMediaKeysPluginPrivate));
}
+
+static void
+gsd_media_keys_plugin_class_finalize (GsdMediaKeysPluginClass *klass)
+{
+}
+
diff --git a/plugins/mouse/gsd-mouse-plugin.c b/plugins/mouse/gsd-mouse-plugin.c
index 3eca07e..80f2679 100644
--- a/plugins/mouse/gsd-mouse-plugin.c
+++ b/plugins/mouse/gsd-mouse-plugin.c
@@ -102,3 +102,9 @@ gsd_mouse_plugin_class_init (GsdMousePluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdMousePluginPrivate));
}
+
+static void
+gsd_mouse_plugin_class_finalize (GsdMousePluginClass *klass)
+{
+}
+
diff --git a/plugins/smartcard/gsd-smartcard-plugin.c b/plugins/smartcard/gsd-smartcard-plugin.c
index 3d1dcd4..fa3e990 100644
--- a/plugins/smartcard/gsd-smartcard-plugin.c
+++ b/plugins/smartcard/gsd-smartcard-plugin.c
@@ -335,3 +335,9 @@ gsd_smartcard_plugin_class_init (GsdSmartcardPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdSmartcardPluginPrivate));
}
+
+static void
+gsd_smartcard_plugin_class_finalize (GsdSmartcardPluginClass *klass)
+{
+}
+
diff --git a/plugins/sound/gsd-sound-plugin.c b/plugins/sound/gsd-sound-plugin.c
index 941dc90..54652c3 100644
--- a/plugins/sound/gsd-sound-plugin.c
+++ b/plugins/sound/gsd-sound-plugin.c
@@ -98,3 +98,9 @@ gsd_sound_plugin_class_init (GsdSoundPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdSoundPluginPrivate));
}
+
+static void
+gsd_sound_plugin_class_finalize (GsdSoundPluginClass *klass)
+{
+}
+
diff --git a/plugins/xrandr/gsd-xrandr-plugin.c b/plugins/xrandr/gsd-xrandr-plugin.c
index 23177e5..a08652b 100644
--- a/plugins/xrandr/gsd-xrandr-plugin.c
+++ b/plugins/xrandr/gsd-xrandr-plugin.c
@@ -102,3 +102,9 @@ gsd_xrandr_plugin_class_init (GsdXrandrPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdXrandrPluginPrivate));
}
+
+static void
+gsd_xrandr_plugin_class_finalize (GsdXrandrPluginClass *klass)
+{
+}
+
diff --git a/plugins/xrdb/gsd-xrdb-plugin.c b/plugins/xrdb/gsd-xrdb-plugin.c
index 3aaff61..de99a55 100644
--- a/plugins/xrdb/gsd-xrdb-plugin.c
+++ b/plugins/xrdb/gsd-xrdb-plugin.c
@@ -102,3 +102,9 @@ gsd_xrdb_plugin_class_init (GsdXrdbPluginClass *klass)
g_type_class_add_private (klass, sizeof (GsdXrdbPluginPrivate));
}
+
+static void
+gsd_xrdb_plugin_class_finalize (GsdXrdbPluginClass *klass)
+{
+}
+
diff --git a/plugins/xsettings/gsd-xsettings-plugin.c b/plugins/xsettings/gsd-xsettings-plugin.c
index 36a09dd..0a31906 100644
--- a/plugins/xsettings/gsd-xsettings-plugin.c
+++ b/plugins/xsettings/gsd-xsettings-plugin.c
@@ -102,3 +102,9 @@ gnome_xsettings_plugin_class_init (GnomeXSettingsPluginClass *klass)
g_type_class_add_private (klass, sizeof (GnomeXSettingsPluginPrivate));
}
+
+static void
+gnome_xsettings_plugin_class_finalize (GnomeXSettingsPluginClass *klass)
+{
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]