gpointing-device-settings r56 - in trunk: modules src
- From: hiikezoe svn gnome org
- To: svn-commits-list gnome org
- Subject: gpointing-device-settings r56 - in trunk: modules src
- Date: Sat, 28 Feb 2009 08:03:14 +0000 (UTC)
Author: hiikezoe
Date: Sat Feb 28 08:03:14 2009
New Revision: 56
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=56&view=rev
Log:
Use G_DEFINE_DYNAMIC_TYPE macro.
GPDS_MODULE_IMPL_INIT returns void.
Modified:
trunk/modules/Makefile.am
trunk/modules/gpds-touchpad-ui.c
trunk/modules/gpds-trackpoint-ui.c
trunk/src/gpds-module-impl.h
trunk/src/gpds-module.c
trunk/src/gpds-module.h
Modified: trunk/modules/Makefile.am
==============================================================================
--- trunk/modules/Makefile.am (original)
+++ trunk/modules/Makefile.am Sat Feb 28 08:03:14 2009
@@ -12,8 +12,7 @@
AM_LDFLAGS = \
-avoid-version -module \
-no-undefined \
- -export-dynamic \
- $(LIBTOOL_EXPORT_OPTIONS)
+ -export-dynamic $(LIBTOOL_EXPORT_OPTIONS)
gpds_module_LTLIBRARIES = \
trackpoint.la \
Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c (original)
+++ trunk/modules/gpds-touchpad-ui.c Sat Feb 28 08:03:14 2009
@@ -69,7 +69,7 @@
static const gint n_touchpad_device_names = G_N_ELEMENTS(touchpad_device_names);
-#define GPDS_TYPE_TOUCHPAD_UI gpds_type_touchpad_ui
+#define GPDS_TYPE_TOUCHPAD_UI (gpds_touchpad_ui_get_type())
#define GPDS_TOUCHPAD_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPDS_TYPE_TOUCHPAD_UI, GpdsTouchpadUI))
#define GPDS_TOUCHPAD_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GPDS_TYPE_TOUCHPAD_UI, GpdsTouchpadUIClass))
#define G_IS_TOUCHPAD_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPDS_TYPE_TOUCHPAD_UI))
@@ -93,8 +93,7 @@
GpdsUIClass parent_class;
};
-static GType gpds_type_touchpad_ui = 0;
-static GpdsUIClass *parent_class;
+GType gpds_touchpad_ui_get_type (void) G_GNUC_CONST;
static void dispose (GObject *object);
static gboolean is_available (GpdsUI *ui, GError **error);
@@ -102,13 +101,14 @@
static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
static GtkWidget *get_label_widget (GpdsUI *ui, GError **error);
+G_DEFINE_DYNAMIC_TYPE(GpdsTouchpadUI, gpds_touchpad_ui, GPDS_TYPE_UI)
+
static void
-class_init (GpdsTouchpadUIClass *klass)
+gpds_touchpad_ui_class_init (GpdsTouchpadUIClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
GpdsUIClass *ui_class = GPDS_UI_CLASS(klass);
- parent_class = g_type_class_peek_parent(klass);
gobject_class->dispose = dispose;
ui_class->is_available = is_available;
@@ -117,6 +117,11 @@
ui_class->get_label_widget = get_label_widget;
}
+static void
+gpds_touchpad_ui_class_finalize (GpdsTouchpadUIClass *klass)
+{
+}
+
static const gchar *
get_ui_file_directory (void)
{
@@ -127,7 +132,7 @@
}
static void
-init (GpdsTouchpadUI *ui)
+gpds_touchpad_ui_init (GpdsTouchpadUI *ui)
{
ui->device_name = NULL;
ui->xinput = NULL;
@@ -136,41 +141,13 @@
ui->gconf = gconf_client_get_default();
}
-static void
-register_type (GTypeModule *type_module)
-{
- static const GTypeInfo info =
- {
- sizeof (GpdsTouchpadUIClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GpdsTouchpadUI),
- 0,
- (GInstanceInitFunc) init,
- };
-
- gpds_type_touchpad_ui =
- g_type_module_register_type(type_module,
- GPDS_TYPE_UI,
- "GpdsTouchpadUI",
- &info, 0);
-}
-
-G_MODULE_EXPORT GList *
+G_MODULE_EXPORT void
GPDS_MODULE_IMPL_INIT (GTypeModule *type_module)
{
- GList *registered_types = NULL;
-
- register_type(type_module);
- if (gpds_type_touchpad_ui)
- registered_types =
- g_list_prepend(registered_types,
- (gchar *)g_type_name(gpds_type_touchpad_ui));
+ if (GPDS_TYPE_TOUCHPAD_UI)
+ return;
- return registered_types;
+ gpds_touchpad_ui_register_type(type_module);
}
G_MODULE_EXPORT void
@@ -202,8 +179,8 @@
g_free(ui->device_name);
g_free(ui->ui_file_path);
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ if (G_OBJECT_CLASS(gpds_touchpad_ui_parent_class)->dispose)
+ G_OBJECT_CLASS(gpds_touchpad_ui_parent_class)->dispose(object);
}
static void
Modified: trunk/modules/gpds-trackpoint-ui.c
==============================================================================
--- trunk/modules/gpds-trackpoint-ui.c (original)
+++ trunk/modules/gpds-trackpoint-ui.c Sat Feb 28 08:03:14 2009
@@ -39,7 +39,7 @@
#define WHEEL_EMULATION_BUTTON "Wheel Emulation Button"
#define DRAG_LOCK_BUTTONS "Drag Lock Buttons"
-#define GPDS_TYPE_TRACK_POINT_UI gpds_type_track_point_ui
+#define GPDS_TYPE_TRACK_POINT_UI (gpds_track_point_ui_get_type())
#define GPDS_TRACK_POINT_UI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GPDS_TYPE_TRACK_POINT_UI, GpdsTrackPointUI))
#define GPDS_TRACK_POINT_UI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GPDS_TYPE_TRACK_POINT_UI, GpdsTrackPointUIClass))
#define G_IS_TRACK_POINT_UI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GPDS_TYPE_TRACK_POINT_UI))
@@ -62,8 +62,7 @@
GpdsUIClass parent_class;
};
-static GType gpds_type_track_point_ui = 0;
-static GpdsUIClass *parent_class;
+GType gpds_track_point_ui_get_type (void) G_GNUC_CONST;
static void dispose (GObject *object);
static gboolean is_available (GpdsUI *ui, GError **error);
@@ -71,13 +70,14 @@
static GtkWidget *get_content_widget (GpdsUI *ui, GError **error);
static GtkWidget *get_label_widget (GpdsUI *ui, GError **error);
+G_DEFINE_DYNAMIC_TYPE(GpdsTrackPointUI, gpds_track_point_ui, GPDS_TYPE_UI)
+
static void
-class_init (GpdsTrackPointUIClass *klass)
+gpds_track_point_ui_class_init (GpdsTrackPointUIClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
GpdsUIClass *ui_class = GPDS_UI_CLASS(klass);
- parent_class = g_type_class_peek_parent(klass);
gobject_class->dispose = dispose;
ui_class->is_available = is_available;
@@ -86,6 +86,11 @@
ui_class->get_label_widget = get_label_widget;
}
+static void
+gpds_track_point_ui_class_finalize (GpdsTrackPointUIClass *klass)
+{
+}
+
static const gchar *
get_ui_file_directory (void)
{
@@ -96,7 +101,7 @@
}
static void
-init (GpdsTrackPointUI *ui)
+gpds_track_point_ui_init (GpdsTrackPointUI *ui)
{
ui->xinput = NULL;
ui->ui_file_path = g_build_filename(get_ui_file_directory(),
@@ -105,41 +110,13 @@
ui->gconf = gconf_client_get_default();
}
-static void
-register_type (GTypeModule *type_module)
-{
- static const GTypeInfo info =
- {
- sizeof (GpdsTrackPointUIClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(GpdsTrackPointUI),
- 0,
- (GInstanceInitFunc) init,
- };
-
- gpds_type_track_point_ui =
- g_type_module_register_type(type_module,
- GPDS_TYPE_UI,
- "GpdsTrackPointUI",
- &info, 0);
-}
-
-G_MODULE_EXPORT GList *
+G_MODULE_EXPORT void
GPDS_MODULE_IMPL_INIT (GTypeModule *type_module)
{
- GList *registered_types = NULL;
-
- register_type(type_module);
- if (gpds_type_track_point_ui)
- registered_types =
- g_list_prepend(registered_types,
- (gchar *)g_type_name(gpds_type_track_point_ui));
+ if (GPDS_TYPE_TRACK_POINT_UI)
+ return;
- return registered_types;
+ gpds_track_point_ui_register_type(type_module);
}
G_MODULE_EXPORT void
@@ -170,8 +147,8 @@
g_free(ui->ui_file_path);
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ if (G_OBJECT_CLASS(gpds_track_point_ui_parent_class)->dispose)
+ G_OBJECT_CLASS(gpds_track_point_ui_parent_class)->dispose(object);
}
static void
Modified: trunk/src/gpds-module-impl.h
==============================================================================
--- trunk/src/gpds-module-impl.h (original)
+++ trunk/src/gpds-module-impl.h Sat Feb 28 08:03:14 2009
@@ -24,7 +24,7 @@
G_BEGIN_DECLS
-typedef GList *(*GpdsModuleInitFunc) (GTypeModule *module);
+typedef void (*GpdsModuleInitFunc) (GTypeModule *module);
typedef void (*GpdsModuleExitFunc) (void);
typedef GObject *(*GpdsModuleInstantiateFunc) (void);
@@ -32,7 +32,7 @@
#define GPDS_MODULE_IMPL_EXIT gpds_module_impl_exit
#define GPDS_MODULE_IMPL_INSTANTIATE gpds_module_impl_instantiate
-GList *GPDS_MODULE_IMPL_INIT (GTypeModule *module);
+void GPDS_MODULE_IMPL_INIT (GTypeModule *module);
void GPDS_MODULE_IMPL_EXIT (void);
GObject *GPDS_MODULE_IMPL_INSTANTIATE (void);
Modified: trunk/src/gpds-module.c
==============================================================================
--- trunk/src/gpds-module.c (original)
+++ trunk/src/gpds-module.c Sat Feb 28 08:03:14 2009
@@ -34,7 +34,6 @@
{
GModule *library;
gchar *mod_path;
- GList *registered_types;
GpdsModuleInitFunc init;
GpdsModuleExitFunc exit;
@@ -79,7 +78,6 @@
priv->library = NULL;
priv->mod_path = NULL;
- priv->registered_types = NULL;
}
static void
@@ -89,8 +87,6 @@
g_free(priv->mod_path);
priv->mod_path = NULL;
- g_list_free(priv->registered_types);
- priv->registered_types = NULL;
G_OBJECT_CLASS(gpds_module_parent_class)->finalize(object);
}
@@ -118,8 +114,7 @@
return FALSE;
}
- g_list_free(priv->registered_types);
- priv->registered_types = priv->init(module);
+ priv->init(module);
return TRUE;
}
@@ -137,38 +132,6 @@
priv->init = NULL;
priv->exit = NULL;
priv->instantiate = NULL;
-
- g_list_free(priv->registered_types);
- priv->registered_types = NULL;
-}
-
-GList *
-gpds_module_collect_registered_types (GList *modules)
-{
- GList *results = NULL;
- GList *node;
-
- for (node = modules; node; node = g_list_next(node)) {
- GpdsModule *module = node->data;
- GTypeModule *g_type_module;
-
- g_type_module = G_TYPE_MODULE(module);
- if (g_type_module_use(g_type_module)) {
- GpdsModulePrivate *priv;
- GList *node;
-
- priv = GPDS_MODULE_GET_PRIVATE(module);
- for (node = priv->registered_types;
- node;
- node = g_list_next(node)) {
- results = g_list_prepend(results, node->data);
- }
-
- g_type_module_unuse(g_type_module);
- }
- }
-
- return results;
}
GList *
@@ -252,7 +215,7 @@
static void
_gpds_module_close (GModule *module)
{
- if (module && g_module_close(module)) {
+ if (module && !g_module_close(module)) {
_gpds_module_show_error(NULL);
}
}
Modified: trunk/src/gpds-module.h
==============================================================================
--- trunk/src/gpds-module.h (original)
+++ trunk/src/gpds-module.h Sat Feb 28 08:03:14 2009
@@ -55,7 +55,6 @@
const gchar *name);
const gchar *gpds_module_directory (void);
-GList *gpds_module_collect_registered_types (GList *modules);
GList *gpds_module_collect_names (GList *modules);
GObject *gpds_module_instantiate (GpdsModule *module);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]