1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2, or (at your option)
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
#include <glib/gi18n-lib.h>
26
#include "gnome-settings-plugin.h"
27
#include "gnome-xsettings-plugin.h"
28
#include "gnome-xsettings-manager.h"
30
struct GnomeXSettingsPluginPrivate {
31
GnomeXSettingsManager *manager;
34
#define GNOME_XSETTINGS_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GNOME_TYPE_XSETTINGS_PLUGIN, GnomeXSettingsPluginPrivate))
36
GNOME_SETTINGS_PLUGIN_REGISTER (GnomeXSettingsPlugin, gnome_xsettings_plugin)
39
gnome_xsettings_plugin_init (GnomeXSettingsPlugin *plugin)
41
plugin->priv = GNOME_XSETTINGS_PLUGIN_GET_PRIVATE (plugin);
43
g_debug ("GnomeXSettingsPlugin initializing");
45
plugin->priv->manager = gnome_xsettings_manager_new ();
49
gnome_xsettings_plugin_finalize (GObject *object)
51
GnomeXSettingsPlugin *plugin;
53
g_return_if_fail (object != NULL);
54
g_return_if_fail (GNOME_IS_XSETTINGS_PLUGIN (object));
56
g_debug ("GnomeXSettingsPlugin finalizing");
58
plugin = GNOME_XSETTINGS_PLUGIN (object);
60
g_return_if_fail (plugin->priv != NULL);
62
if (plugin->priv->manager != NULL) {
63
g_object_unref (plugin->priv->manager);
66
G_OBJECT_CLASS (gnome_xsettings_plugin_parent_class)->finalize (object);
70
impl_activate (GnomeSettingsPlugin *plugin)
75
g_debug ("Activating xsettings plugin");
78
res = gnome_xsettings_manager_start (GNOME_XSETTINGS_PLUGIN (plugin)->priv->manager, &error);
80
g_warning ("Unable to start xsettings manager: %s", error->message);
86
impl_deactivate (GnomeSettingsPlugin *plugin)
88
g_debug ("Deactivating xsettings plugin");
92
gnome_xsettings_plugin_class_init (GnomeXSettingsPluginClass *klass)
94
GObjectClass *object_class = G_OBJECT_CLASS (klass);
95
GnomeSettingsPluginClass *plugin_class = GNOME_SETTINGS_PLUGIN_CLASS (klass);
97
object_class->finalize = gnome_xsettings_plugin_finalize;
99
plugin_class->activate = impl_activate;
100
plugin_class->deactivate = impl_deactivate;
102
g_type_class_add_private (klass, sizeof (GnomeXSettingsPluginPrivate));