diff options
author | Jasmine Hassan <[email protected]> | 2012-12-05 02:55:27 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-12-06 18:48:25 +0200 |
commit | 6e182dc5cdb3451a4ec4bd443b1159df318541c8 (patch) | |
tree | 049d7a8d3c8e466ce9824c34faf4a7d33c5824ed /plugins/background/msd-background-plugin.c | |
parent | 4006c217f458e936d77683b5974600070a253bac (diff) | |
download | mate-settings-daemon-6e182dc5cdb3451a4ec4bd443b1159df318541c8.tar.bz2 mate-settings-daemon-6e182dc5cdb3451a4ec4bd443b1159df318541c8.tar.xz |
[plugins] cleanup macro magic in plugin.h
And instead, use glib macros (since 2.14)
http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=0dda56c4462e070dabdab68092b6574b5e894181
Diffstat (limited to 'plugins/background/msd-background-plugin.c')
-rw-r--r-- | plugins/background/msd-background-plugin.c | 121 |
1 files changed, 62 insertions, 59 deletions
diff --git a/plugins/background/msd-background-plugin.c b/plugins/background/msd-background-plugin.c index f5cb0d1..ee6b49c 100644 --- a/plugins/background/msd-background-plugin.c +++ b/plugins/background/msd-background-plugin.c @@ -27,85 +27,88 @@ #include "msd-background-plugin.h" #include "msd-background-manager.h" -//class MsdBackgroundPlugin -//{ - struct MsdBackgroundPluginPrivate { - MsdBackgroundManager* manager; - }; +struct MsdBackgroundPluginPrivate { + MsdBackgroundManager* manager; +}; - #define MSD_BACKGROUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE((object), MSD_TYPE_BACKGROUND_PLUGIN, MsdBackgroundPluginPrivate)) +#define MSD_BACKGROUND_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE((object), MSD_TYPE_BACKGROUND_PLUGIN, MsdBackgroundPluginPrivate)) - MATE_SETTINGS_PLUGIN_REGISTER(MsdBackgroundPlugin, msd_background_plugin) +MATE_SETTINGS_PLUGIN_REGISTER(MsdBackgroundPlugin, msd_background_plugin) - static void - msd_background_plugin_init (MsdBackgroundPlugin* plugin) - { - plugin->priv = MSD_BACKGROUND_PLUGIN_GET_PRIVATE(plugin); - - g_debug("MsdBackgroundPlugin initializing"); +static void +msd_background_plugin_init (MsdBackgroundPlugin* plugin) +{ + plugin->priv = MSD_BACKGROUND_PLUGIN_GET_PRIVATE(plugin); - plugin->priv->manager = msd_background_manager_new(); - } + g_debug("MsdBackgroundPlugin initializing"); - static void - msd_background_plugin_finalize (GObject* object) - { - MsdBackgroundPlugin* plugin; + plugin->priv->manager = msd_background_manager_new(); +} - g_return_if_fail(object != NULL); - g_return_if_fail(MSD_IS_BACKGROUND_PLUGIN(object)); +static void +msd_background_plugin_finalize (GObject* object) +{ + MsdBackgroundPlugin* plugin; - g_debug("MsdBackgroundPlugin finalizing"); + g_return_if_fail(object != NULL); + g_return_if_fail(MSD_IS_BACKGROUND_PLUGIN(object)); - plugin = MSD_BACKGROUND_PLUGIN(object); + g_debug("MsdBackgroundPlugin finalizing"); - g_return_if_fail(plugin->priv != NULL); + plugin = MSD_BACKGROUND_PLUGIN(object); - if (plugin->priv->manager != NULL) - { - g_object_unref (plugin->priv->manager); - } + g_return_if_fail(plugin->priv != NULL); - G_OBJECT_CLASS(msd_background_plugin_parent_class)->finalize(object); + if (plugin->priv->manager != NULL) + { + g_object_unref (plugin->priv->manager); } - static void - impl_activate (MateSettingsPlugin* plugin) - { - gboolean res; - GError* error; + G_OBJECT_CLASS(msd_background_plugin_parent_class)->finalize(object); +} - g_debug("Activating background plugin"); +static void +impl_activate (MateSettingsPlugin* plugin) +{ + gboolean res; + GError* error; - error = NULL; - res = msd_background_manager_start(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager, &error); + g_debug("Activating background plugin"); - if (!res) - { - g_warning("Unable to start background manager: %s", error->message); - g_error_free(error); - } - } + error = NULL; + res = msd_background_manager_start(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager, &error); - static void - impl_deactivate (MateSettingsPlugin* plugin) + if (!res) { - g_debug("Deactivating background plugin"); - - msd_background_manager_stop(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager); + g_warning("Unable to start background manager: %s", error->message); + g_error_free(error); } +} - static void - msd_background_plugin_class_init (MsdBackgroundPluginClass* klass) - { - GObjectClass* object_class = G_OBJECT_CLASS(klass); - MateSettingsPluginClass* plugin_class = MATE_SETTINGS_PLUGIN_CLASS(klass); +static void +impl_deactivate (MateSettingsPlugin* plugin) +{ + g_debug("Deactivating background plugin"); - object_class->finalize = msd_background_plugin_finalize; + msd_background_manager_stop(MSD_BACKGROUND_PLUGIN(plugin)->priv->manager); +} - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; +static void +msd_background_plugin_class_init (MsdBackgroundPluginClass* klass) +{ + GObjectClass* object_class = G_OBJECT_CLASS(klass); + MateSettingsPluginClass* plugin_class = MATE_SETTINGS_PLUGIN_CLASS(klass); + + object_class->finalize = msd_background_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private(klass, sizeof(MsdBackgroundPluginPrivate)); +} + +static void +msd_background_plugin_class_finalize (MsdBackgroundPluginClass *klass) +{ +} - g_type_class_add_private(klass, sizeof(MsdBackgroundPluginPrivate)); - } -//}
\ No newline at end of file |