2
* panel-config-global.c: panel global configuration module
4
* Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License as
8
* published by the Free Software Foundation; either version 2 of the
9
* License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22
* Mark McLoughlin <mark@skynet.ie>
23
* Glynn Foster <glynn.foster@sun.com>
28
#include "panel-config-global.h"
31
#include <gconf/gconf.h>
33
#include "panel-globals.h"
34
#include "panel-gconf.h"
37
guint tooltips_enabled : 1;
38
guint enable_animations : 1;
39
guint drawer_auto_close : 1;
40
guint confirm_panel_remove : 1;
41
guint highlight_when_over : 1;
44
static GlobalConfig global_config = { 0, };
45
static gboolean global_config_initialised = FALSE;
48
panel_global_config_get_highlight_when_over (void)
50
g_assert (global_config_initialised == TRUE);
52
return global_config.highlight_when_over;
56
panel_global_config_get_enable_animations (void)
58
g_assert (global_config_initialised == TRUE);
60
return global_config.enable_animations;
64
panel_global_config_get_drawer_auto_close (void)
66
g_assert (global_config_initialised == TRUE);
68
return global_config.drawer_auto_close;
72
panel_global_config_get_tooltips_enabled (void)
74
g_assert (global_config_initialised == TRUE);
76
return global_config.tooltips_enabled;
80
panel_global_config_get_confirm_panel_remove (void)
82
g_assert (global_config_initialised == TRUE);
84
return global_config.confirm_panel_remove;
88
panel_global_config_set_entry (GConfEntry *entry)
93
g_return_if_fail (entry != NULL);
95
value = gconf_entry_get_value (entry);
96
key = panel_gconf_basename (gconf_entry_get_key (entry));
101
if (strcmp (key, "tooltips_enabled") == 0)
102
global_config.tooltips_enabled =
103
gconf_value_get_bool (value);
105
else if (strcmp (key, "enable_animations") == 0)
106
global_config.enable_animations =
107
gconf_value_get_bool (value);
109
else if (strcmp (key, "drawer_autoclose") == 0)
110
global_config.drawer_auto_close =
111
gconf_value_get_bool (value);
113
else if (strcmp (key, "confirm_panel_remove") == 0)
114
global_config.confirm_panel_remove =
115
gconf_value_get_bool (value);
117
else if (strcmp (key, "highlight_launchers_on_mouseover") == 0)
118
global_config.highlight_when_over =
119
gconf_value_get_bool (value);
123
panel_global_config_notify (GConfClient *client,
128
panel_global_config_set_entry (entry);
132
panel_global_config_load (void)
136
const char *key = "/apps/panel/global";
138
client = panel_gconf_get_client ();
140
gconf_client_add_dir (client, key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
142
entries = gconf_client_all_entries (client, key, NULL);
144
for (l = entries; l; l = l->next) {
145
panel_global_config_set_entry (l->data);
146
gconf_entry_unref (l->data);
148
g_slist_free (entries);
150
gconf_client_notify_add (client, key, panel_global_config_notify, NULL, NULL, NULL);
152
global_config_initialised = TRUE;