diff options
author | Stefano Karapetsas <[email protected]> | 2012-12-07 06:06:41 -0800 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-12-07 06:06:41 -0800 |
commit | 12dcf19aa5f51901053c273cd7f5c17ce85e909d (patch) | |
tree | 5b71387df7bf817dd5d0dff60ecc09d8291dba0d /plugins/background | |
parent | a279b02b4d563d2300ccb588e5969c7dfac8108e (diff) | |
parent | 6e61d207a2088479f5bb12ce4edb1d2886c40b53 (diff) | |
download | mate-settings-daemon-12dcf19aa5f51901053c273cd7f5c17ce85e909d.tar.bz2 mate-settings-daemon-12dcf19aa5f51901053c273cd7f5c17ce85e909d.tar.xz |
Merge pull request #29 from jasmineaura/develop
Fix #23, and some cleanups
Diffstat (limited to 'plugins/background')
-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 |