[maemo-commits] [maemo-commits] r8791 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Dec 15 17:44:51 EET 2006
- Previous message: [maemo-commits] r8790 - projects/haf/branches/hildon-fm/1.x
- Next message: [maemo-commits] r8792 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gdk gdk/x11
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2006-12-15 17:44:50 +0200 (Fri, 15 Dec 2006) New Revision: 8791 Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.c projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.h Log: 2006-12-15 Lucas Rocha <lucas.rocha at nokia.com> * libhildondesktop/hildon-desktop-plugin.[ch]: new macro which correctly registers the GType from the GTypeModule. This way, when the type is not used anymore the module is unloaded. Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-15 15:31:42 UTC (rev 8790) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog 2006-12-15 15:44:50 UTC (rev 8791) @@ -1,3 +1,9 @@ +2006-12-15 Lucas Rocha <lucas.rocha at nokia.com> + + * libhildondesktop/hildon-desktop-plugin.[ch]: new macro which correctly + registers the GType from the GTypeModule. This way, when the type is + not used anymore the module is unloaded. + 2006-12-15 Johan Bilien <johan.bilien at nokia.com> * libhildondesktop/hildon-home-area.c: use item_find_by_id instead Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.c =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.c 2006-12-15 15:31:42 UTC (rev 8790) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.c 2006-12-15 15:44:50 UTC (rev 8791) @@ -23,11 +23,11 @@ * */ -#include "hildon-desktop-plugin.h" - #include <config.h> #include <gmodule.h> +#include "hildon-desktop-plugin.h" + #define HILDON_DESKTOP_PLUGIN_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), HILDON_DESKTOP_TYPE_PLUGIN, HildonDesktopPluginPrivate)) Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.h =================================================================== --- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.h 2006-12-15 15:31:42 UTC (rev 8790) +++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-plugin.h 2006-12-15 15:44:50 UTC (rev 8791) @@ -41,17 +41,6 @@ #define HILDON_DESKTOP_IS_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), HILDON_DESKTOP_TYPE_PLUGIN)) #define HILDON_DESKTOP_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), HILDON_DESKTOP_TYPE_PLUGIN, HildonDesktopPluginClass)) -#define HILDON_DESKTOP_PLUGIN_SYMBOLS(o) \ -G_MODULE_EXPORT void hildon_desktop_plugin_load (HildonDesktopPlugin *plugin); \ -G_MODULE_EXPORT void hildon_desktop_plugin_load (HildonDesktopPlugin *plugin) \ -{ \ - hildon_desktop_plugin_add_type (plugin, o##_get_type()); \ -} \ -G_MODULE_EXPORT void hildon_desktop_plugin_unload (HildonDesktopPlugin *plugin); \ -G_MODULE_EXPORT void hildon_desktop_plugin_unload (HildonDesktopPlugin *plugin) \ -{ \ -} - struct _HildonDesktopPlugin { GTypeModule parent; @@ -75,6 +64,61 @@ void hildon_desktop_plugin_add_type (HildonDesktopPlugin *plugin, GType type); +#define HILDON_DESKTOP_PLUGIN_REGISTER_TYPE (PluginName, plugin_name, PARENT_TYPE) \ + \ +static GType type = 0; \ + \ +GType \ +plugin_name##_get_type (void) \ +{ \ + return 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 void \ +hildon_desktop_plugin_load (HildonDesktopPlugin *plugin); \ +G_MODULE_EXPORT void \ +hildon_desktop_plugin_load (HildonDesktopPlugin *plugin) \ +{ \ + static const GTypeInfo 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 \ + }; \ + \ + type = g_type_module_register_type (G_TYPE_MODULE (plugin), \ + PARENT_TYPE, \ + #PluginName, \ + &info, \ + 0); \ + \ + hildon_desktop_plugin_add_type (plugin, type); \ +} \ + \ +G_MODULE_EXPORT void \ +hildon_desktop_plugin_unload (HildonDesktopPlugin *plugin); \ +G_MODULE_EXPORT void \ +hildon_desktop_plugin_unload (HildonDesktopPlugin *plugin) \ +{ \ +} + + G_END_DECLS #endif /*__HILDON_DESKTOP_PLUGIN_H__*/
- Previous message: [maemo-commits] r8790 - projects/haf/branches/hildon-fm/1.x
- Next message: [maemo-commits] r8792 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gdk gdk/x11
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]