Commit 9dc9f4c8 authored by Glynn Foster's avatar Glynn Foster Committed by Glynn Foster

Fix up gconf stuff. Now things work with the global properties dialog.

2001-12-10  Glynn Foster  <glynn.foster@sun.com>

	* basep-widget.c, gnome-panel-properties.c
	  gnome-panel-properties.glade, main.c
	  panel-gconf.c, panel-gconf.h, panel_config_global.h
	  panelglobalconfig.schemas, session.c:

	Fix up gconf stuff. Now things work with the global
	properties dialog.
parent 4ccb4338
2001-12-10 Glynn Foster <glynn.foster@sun.com>
* basep-widget.c, gnome-panel-properties.c
gnome-panel-properties.glade, main.c
panel-gconf.c, panel-gconf.h, panel_config_global.h
panelglobalconfig.schemas, session.c:
Fix up gconf stuff. Now things work with the global
properties dialog.
2001-12-10 Stephen Browne <stephen.browne@sun.com>
* gnome-panel-properties.c
......
......@@ -849,7 +849,7 @@ basep_widget_do_hiding(BasePWidget *basep, PanelOrient hide_orient,
break;
}
if(!global_config.disable_animations && step != 0) {
if(global_config.enable_animations && step != 0) {
GTimeVal tval;
long start_secs;
long start_time;
......@@ -956,7 +956,7 @@ basep_widget_do_showing(BasePWidget *basep, PanelOrient hide_orient,
break;
}
if(!global_config.disable_animations && step != 0) {
if(global_config.enable_animations && step != 0) {
int i;
GTimeVal tval;
long start_secs;
......
......@@ -52,7 +52,7 @@ gchar* checkboxes[] = {
"confirm-panel-remove",
"avoid-panel-overlap",
"keep-menus-in-memory",
"disable-animations",
"enable-animations",
NULL
};
......@@ -201,12 +201,12 @@ checkbox_clicked (GtkWidget *widget, gpointer data)
}
static void
disable_animations_clicked (GtkWidget *widget, gpointer data)
enable_animations_clicked (GtkWidget *widget, gpointer data)
{
GtkWidget *vbox = GTK_WIDGET(data);
int disable = GTK_TOGGLE_BUTTON(widget)->active;
int enable = GTK_TOGGLE_BUTTON(widget)->active;
gtk_widget_set_sensitive(vbox,disable);
gtk_widget_set_sensitive(vbox,enable);
}
static void
......@@ -255,12 +255,12 @@ load_booleans_for_checkboxes(GladeXML *gui, GConfClient *client)
key = NULL;
}*/
checkbox = glade_xml_get_widget(gui,"disable-animations");
checkbox = glade_xml_get_widget(gui,"enable-animations");
anim_vbox = glade_xml_get_widget(gui,"animation-vbox");
gtk_widget_set_sensitive(anim_vbox,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)));
g_signal_connect(G_OBJECT(checkbox),"clicked",
G_CALLBACK(disable_animations_clicked),anim_vbox);
G_CALLBACK(enable_animations_clicked),anim_vbox);
}
static void
......
......@@ -52,7 +52,7 @@ gchar* checkboxes[] = {
"confirm-panel-remove",
"avoid-panel-overlap",
"keep-menus-in-memory",
"disable-animations",
"enable-animations",
NULL
};
......@@ -201,12 +201,12 @@ checkbox_clicked (GtkWidget *widget, gpointer data)
}
static void
disable_animations_clicked (GtkWidget *widget, gpointer data)
enable_animations_clicked (GtkWidget *widget, gpointer data)
{
GtkWidget *vbox = GTK_WIDGET(data);
int disable = GTK_TOGGLE_BUTTON(widget)->active;
int enable = GTK_TOGGLE_BUTTON(widget)->active;
gtk_widget_set_sensitive(vbox,disable);
gtk_widget_set_sensitive(vbox,enable);
}
static void
......@@ -255,12 +255,12 @@ load_booleans_for_checkboxes(GladeXML *gui, GConfClient *client)
key = NULL;
}*/
checkbox = glade_xml_get_widget(gui,"disable-animations");
checkbox = glade_xml_get_widget(gui,"enable-animations");
anim_vbox = glade_xml_get_widget(gui,"animation-vbox");
gtk_widget_set_sensitive(anim_vbox,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)));
g_signal_connect(G_OBJECT(checkbox),"clicked",
G_CALLBACK(disable_animations_clicked),anim_vbox);
G_CALLBACK(enable_animations_clicked),anim_vbox);
}
static void
......
......@@ -161,7 +161,7 @@
<widget>
<class>GtkCheckButton</class>
<name>disable-animations</name>
<name>enable-animations</name>
<can_focus>True</can_focus>
<label>_Enable animation</label>
<active>False</active>
......
......@@ -430,6 +430,10 @@ tell_user_Im_on_crack (void)
gtk_widget_destroy (dialog);
}
static void
session_notify_global_changes (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) {
session_read_global_config ();
}
int
main(int argc, char **argv)
......@@ -499,10 +503,15 @@ main(int argc, char **argv)
load_system_wide ();
panel_gconf_add_dir ("/apps/panel/global");
/* set the globals, it is important this is before
* init_user_applets */
session_read_global_config ();
/* Do the notification stuff */
panel_gconf_notify_add ("/apps/panel/global", session_notify_global_changes, NULL);
/* this is so the capplet gets the right defaults */
if ( ! commie_mode)
session_write_global_config ();
......
......@@ -12,7 +12,7 @@ struct _GlobalConfig {
int show_delay;
gboolean tooltips_enabled;
gboolean keep_menus_in_memory;
gboolean disable_animations;
gboolean enable_animations;
gboolean autoraise;
PanelLayer layer;
gboolean drawer_auto_close;
......
......@@ -7,11 +7,13 @@
#include "panel-gconf.h"
static gchar * panel_gconf_global_config_get_full_key (const gchar *key) {
static gchar *
panel_gconf_global_config_get_full_key (const gchar *key) {
return g_strdup_printf ("/apps/panel/global/%s", key);
}
GConfClient * panel_gconf_get_client (void) {
GConfClient *
panel_gconf_get_client (void) {
static GConfClient *client = NULL;
if (!client)
......@@ -20,7 +22,8 @@ GConfClient * panel_gconf_get_client (void) {
return client;
}
gchar * panel_gconf_get_session_key (void) {
gchar *
panel_gconf_get_session_key (void) {
static gchar *session_key;
if (session_key == NULL) {
const gchar *panel_client_id;
......@@ -48,7 +51,8 @@ panel_gconf_all_global_entries (void)
return list;
}
gint panel_gconf_global_config_get_int (const gchar *key) {
gint
panel_gconf_global_config_get_int (const gchar *key) {
gint value;
gchar *full_key;
......@@ -60,7 +64,8 @@ gint panel_gconf_global_config_get_int (const gchar *key) {
return value;
}
gboolean panel_gconf_global_config_get_bool (const gchar *key) {
gboolean
panel_gconf_global_config_get_bool (const gchar *key) {
gboolean value;
gchar *full_key;
......@@ -72,7 +77,8 @@ gboolean panel_gconf_global_config_get_bool (const gchar *key) {
return value;
}
gchar * panel_gconf_global_config_get_string (const gchar *key) {
gchar *
panel_gconf_global_config_get_string (const gchar *key) {
gchar *value;
gchar *full_key;
......@@ -84,7 +90,8 @@ gchar * panel_gconf_global_config_get_string (const gchar *key) {
return value;
}
void panel_gconf_global_config_set_int (const gchar *key, gint value) {
void
panel_gconf_global_config_set_int (const gchar *key, gint value) {
gchar *full_key;
full_key = panel_gconf_global_config_get_full_key (key);
......@@ -98,7 +105,8 @@ void panel_gconf_global_config_set_int (const gchar *key, gint value) {
return;
}
void panel_gconf_global_config_set_bool (const gchar *key, gboolean value) {
void
panel_gconf_global_config_set_bool (const gchar *key, gboolean value) {
gchar *full_key;
full_key = panel_gconf_global_config_get_full_key (key);
......@@ -111,7 +119,8 @@ void panel_gconf_global_config_set_bool (const gchar *key, gboolean value) {
return;
}
void panel_gconf_global_config_set_string (const gchar *key, const gchar *value) {
void
panel_gconf_global_config_set_string (const gchar *key, const gchar *value) {
gchar *full_key;
full_key = panel_gconf_global_config_get_full_key (key);
......@@ -123,3 +132,23 @@ void panel_gconf_global_config_set_string (const gchar *key, const gchar *value)
g_free (full_key);
return;
}
void
panel_gconf_notify_add (const gchar *key, GConfClientNotifyFunc notify_func, gpointer user_data) {
gconf_client_notify_add (panel_gconf_get_client (),
key,
notify_func,
user_data,
NULL,
NULL);
return;
}
void
panel_gconf_add_dir (const gchar *key) {
gconf_client_add_dir (panel_gconf_get_client (),
key,
GCONF_CLIENT_PRELOAD_NONE,
NULL);
return;
}
......@@ -16,10 +16,18 @@ gint panel_gconf_global_config_get_int (const gchar *key);
gboolean panel_gconf_global_config_get_bool (const gchar *key);
gchar* panel_gconf_global_config_get_string (const gchar *key);
void panel_gconf_global_config_set_int (const gchar *key, gint value);
void panel_gconf_global_config_set_bool (const gchar *key, gboolean value);
void panel_gconf_global_config_set_string (const gchar *key, const gchar *value);
void panel_gconf_global_config_set_int (const gchar *key,
gint value);
void panel_gconf_global_config_set_bool (const gchar *key,
gboolean value);
void panel_gconf_global_config_set_string (const gchar *key,
const gchar *value);
void panel_gconf_notify_add (const gchar *key,
GConfClientNotifyFunc notify_func,
gpointer user_data);
void panel_gconf_add_dir (const gchar *key);
G_END_DECLS
#endif /* PANEL_GCONF_H */
......@@ -55,29 +55,17 @@ Panel Global Config Schema File - work in progress
</schema>
<schema>
<key>/schemas/apps/panel/global/disable-animations</key>
<applyto>/apps/panel/global/disable-animations</applyto>
<key>/schemas/apps/panel/global/enable-animations</key>
<applyto>/apps/panel/global/enable-animations</applyto>
<owner>panel</owner>
<type>bool</type>
<default>false</default>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/animation-speed</key>
<applyto>/apps/panel/animation-speed</applyto>
<owner>panel</owner>
<type>string</type>
<default>Slow</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/global/panel-minimized-size</key>
<applyto>/apps/panel/global/panel-minimized-size</applyto>
......@@ -95,7 +83,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-show-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......@@ -107,9 +95,9 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-animation-speed</applyto>
<owner>panel</owner>
<type>int</type>
<default>80</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<short>FIXME - need to define limits fast = 0, medium = 1, slow = 2</short>
<long></long>
</locale>
</schema>
......@@ -119,7 +107,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-hide-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>30</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......
......@@ -55,29 +55,17 @@ Panel Global Config Schema File - work in progress
</schema>
<schema>
<key>/schemas/apps/panel/global/disable-animations</key>
<applyto>/apps/panel/global/disable-animations</applyto>
<key>/schemas/apps/panel/global/enable-animations</key>
<applyto>/apps/panel/global/enable-animations</applyto>
<owner>panel</owner>
<type>bool</type>
<default>false</default>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/animation-speed</key>
<applyto>/apps/panel/animation-speed</applyto>
<owner>panel</owner>
<type>string</type>
<default>Slow</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/global/panel-minimized-size</key>
<applyto>/apps/panel/global/panel-minimized-size</applyto>
......@@ -95,7 +83,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-show-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......@@ -107,9 +95,9 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-animation-speed</applyto>
<owner>panel</owner>
<type>int</type>
<default>80</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<short>FIXME - need to define limits fast = 0, medium = 1, slow = 2</short>
<long></long>
</locale>
</schema>
......@@ -119,7 +107,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-hide-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>30</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......
......@@ -55,29 +55,17 @@ Panel Global Config Schema File - work in progress
</schema>
<schema>
<key>/schemas/apps/panel/global/disable-animations</key>
<applyto>/apps/panel/global/disable-animations</applyto>
<key>/schemas/apps/panel/global/enable-animations</key>
<applyto>/apps/panel/global/enable-animations</applyto>
<owner>panel</owner>
<type>bool</type>
<default>false</default>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/animation-speed</key>
<applyto>/apps/panel/animation-speed</applyto>
<owner>panel</owner>
<type>string</type>
<default>Slow</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/global/panel-minimized-size</key>
<applyto>/apps/panel/global/panel-minimized-size</applyto>
......@@ -95,7 +83,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-show-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......@@ -107,9 +95,9 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-animation-speed</applyto>
<owner>panel</owner>
<type>int</type>
<default>80</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<short>FIXME - need to define limits fast = 0, medium = 1, slow = 2</short>
<long></long>
</locale>
</schema>
......@@ -119,7 +107,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-hide-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>30</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......
......@@ -55,29 +55,17 @@ Panel Global Config Schema File - work in progress
</schema>
<schema>
<key>/schemas/apps/panel/global/disable-animations</key>
<applyto>/apps/panel/global/disable-animations</applyto>
<key>/schemas/apps/panel/global/enable-animations</key>
<applyto>/apps/panel/global/enable-animations</applyto>
<owner>panel</owner>
<type>bool</type>
<default>false</default>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/animation-speed</key>
<applyto>/apps/panel/animation-speed</applyto>
<owner>panel</owner>
<type>string</type>
<default>Slow</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/global/panel-minimized-size</key>
<applyto>/apps/panel/global/panel-minimized-size</applyto>
......@@ -95,7 +83,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-show-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......@@ -107,9 +95,9 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-animation-speed</applyto>
<owner>panel</owner>
<type>int</type>
<default>80</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<short>FIXME - need to define limits fast = 0, medium = 1, slow = 2</short>
<long></long>
</locale>
</schema>
......@@ -119,7 +107,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-hide-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>30</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......
......@@ -12,7 +12,7 @@ struct _GlobalConfig {
int show_delay;
gboolean tooltips_enabled;
gboolean keep_menus_in_memory;
gboolean disable_animations;
gboolean enable_animations;
gboolean autoraise;
PanelLayer layer;
gboolean drawer_auto_close;
......
......@@ -55,29 +55,17 @@ Panel Global Config Schema File - work in progress
</schema>
<schema>
<key>/schemas/apps/panel/global/disable-animations</key>
<applyto>/apps/panel/global/disable-animations</applyto>
<key>/schemas/apps/panel/global/enable-animations</key>
<applyto>/apps/panel/global/enable-animations</applyto>
<owner>panel</owner>
<type>bool</type>
<default>false</default>
<default>true</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/animation-speed</key>
<applyto>/apps/panel/animation-speed</applyto>
<owner>panel</owner>
<type>string</type>
<default>Slow</default>
<locale name="C">
<short></short>
<long></long>
</locale>
</schema>
<schema>
<key>/schemas/apps/panel/global/panel-minimized-size</key>
<applyto>/apps/panel/global/panel-minimized-size</applyto>
......@@ -95,7 +83,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-show-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......@@ -107,9 +95,9 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-animation-speed</applyto>
<owner>panel</owner>
<type>int</type>
<default>80</default>
<default>0</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<short>FIXME - need to define limits fast = 0, medium = 1, slow = 2</short>
<long></long>
</locale>
</schema>
......@@ -119,7 +107,7 @@ Panel Global Config Schema File - work in progress
<applyto>/apps/panel/global/panel-hide-delay</applyto>
<owner>panel</owner>
<type>int</type>
<default>2</default>
<default>30</default>
<locale name="C">
<short>FIXME - need to define limits</short>
<long></long>
......
......@@ -1382,9 +1382,21 @@ session_read_global_config (void)
key = g_path_get_basename (gconf_entry_get_key (entry));
if (!strcmp (key, "panel-animation-speed"))
global_config.animation_speed =
gconf_value_get_int (value);
if (!strcmp (key, "panel-animation-speed")) {
switch (gconf_value_get_int (value)) {
case 0:
global_config.animation_speed = 80;
break;
case 1:
global_config.animation_speed = 60;
break;
case 2:
global_config.animation_speed = 10;
break;
default:
global_config.animation_speed = 60;
}
}
else if (!strcmp (key, "panel-minimized-speed"))
global_config.minimized_size =
......@@ -1410,8 +1422,8 @@ session_read_global_config (void)
global_config.keep_menus_in_memory =
gconf_value_get_bool (value);
else if (!strcmp (key, "disable-animations"))
global_config.disable_animations =
else if (!strcmp (key, "enable-animations"))
global_config.enable_animations =
gconf_value_get_bool (value);
else if (!strcmp (key, "autoraise-panel"))
......@@ -1530,7 +1542,7 @@ session_write_global_config (void)
gconf_change_set_set_bool (global_config_cs, "tooltips-enabled", global_config.tooltips_enabled);
gconf_change_set_set_bool (global_config_cs, "use-large-icons", global_config.use_large_icons);
gconf_change_set_set_bool (global_config_cs, "disable-animations", global_config.disable_animations);
gconf_change_set_set_bool (global_config_cs, "enable-animations", global_config.enable_animations);
gconf_change_set_set_bool (global_config_cs, "autoraise-panel", global_config.autoraise);
gconf_change_set_set_bool (global_config_cs, "drawer-autoclose", global_config.drawer_auto_close);
gconf_change_set_set_bool (global_config_cs, "highlight-launchers-on-mouseover", global_config.highlight_when_over);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment