Don't try to load the wallpaper if it's not enabled

2001-07-26  Bradford Hovinen  <hovinen@ximian.com>

	* applier.c (applier_apply_prefs): Don't try to load the wallpaper
	if it's not enabled

	* preferences.c (preferences_new_from_bonobo_pbag): Use
	bonobo_property_editor_client_get_value_*
	(preferences_new_from_bonobo_pbag): Set gradient_enabled properly
	from property bag
	(preferences_new_from_bonobo_pbag): Check for wallpaper == "(none)"
	(preferences_new_from_bonobo_db): Ditto above
This commit is contained in:
Bradford Hovinen 2001-07-27 02:49:48 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 0336802107
commit 9db70e8ea7
4 changed files with 42 additions and 16 deletions

View file

@ -1,5 +1,15 @@
2001-07-26 Bradford Hovinen <hovinen@ximian.com>
* applier.c (applier_apply_prefs): Don't try to load the wallpaper
if it's not enabled
* preferences.c (preferences_new_from_bonobo_pbag): Use
bonobo_property_editor_client_get_value_*
(preferences_new_from_bonobo_pbag): Set gradient_enabled properly
from property bag
(preferences_new_from_bonobo_pbag): Check for wallpaper == "(none)"
(preferences_new_from_bonobo_db): Ditto above
* applier.c (renderer_render_wallpaper): Restore some lost tweaks
from earlier.

View file

@ -339,7 +339,8 @@ applier_apply_prefs (Applier *applier, Preferences *prefs,
applier->private->wallpaper_pixbuf = NULL;
}
if (prefs->wallpaper_filename &&
if (prefs->wallpaper_enabled &&
prefs->wallpaper_filename &&
(applier->private->wallpaper_filename == NULL ||
strcmp (applier->private->wallpaper_filename,
prefs->wallpaper_filename)))

View file

@ -192,20 +192,21 @@ bonobo_color_to_gdk (Bonobo_Config_Color *color)
}
static gulong
pb_get_value_ulong (Bonobo_PropertyBag bag, const gchar *prop)
bonobo_property_bag_client_get_value_gulong (Bonobo_PropertyBag pb, gchar *propname, CORBA_Environment *ev)
{
BonoboArg *arg;
gulong val;
arg = bonobo_property_bag_client_get_value_any (bag, prop, NULL);
val = BONOBO_ARG_GET_GENERAL (arg, TC_ulong, CORBA_unsigned_long, NULL);
gulong retval;
arg = bonobo_property_bag_client_get_value_any (pb, propname, ev);
if (BONOBO_EX (ev)) return 0;
retval = BONOBO_ARG_GET_GENERAL (arg, TC_ulong, CORBA_long, ev);
bonobo_arg_release (arg);
return val;
return retval;
}
#define PB_GET_VALUE(v) (bonobo_property_bag_client_get_value_any (pb, (v), NULL))
/* Probably has CORBA memory leaks */
GtkObject*
preferences_new_from_bonobo_pbag (Bonobo_PropertyBag pb, CORBA_Environment *ev)
{
@ -216,14 +217,15 @@ preferences_new_from_bonobo_pbag (Bonobo_PropertyBag pb, CORBA_Environment *ev)
prefs = PREFERENCES (preferences_new ());
prefs->orientation = pb_get_value_ulong (pb, "orientation");
if (prefs->orientation != ORIENTATION_SOLID)
prefs->gradient_enabled = TRUE;
prefs->wallpaper_type = pb_get_value_ulong (pb, "wallpaper_type");
prefs->wallpaper_type = bonobo_property_bag_client_get_value_gulong (pb, "wallpaper_type", ev);
prefs->wallpaper_filename = g_strdup (*((CORBA_char **)(PB_GET_VALUE ("wallpaper_filename"))->_value));
if (prefs->wallpaper_filename && strcmp (prefs->wallpaper_filename, "") != 0)
if (prefs->wallpaper_filename != NULL &&
strcmp (prefs->wallpaper_filename, "") != 0 &&
strcmp (prefs->wallpaper_filename, "(none)") != 0)
prefs->wallpaper_enabled = TRUE;
else
prefs->wallpaper_enabled = FALSE;
prefs->color1 = bonobo_color_to_gdk ((Bonobo_Config_Color *)(PB_GET_VALUE ("color1"))->_value);
prefs->color2 = bonobo_color_to_gdk ((Bonobo_Config_Color *)(PB_GET_VALUE ("color2"))->_value);
@ -232,6 +234,13 @@ preferences_new_from_bonobo_pbag (Bonobo_PropertyBag pb, CORBA_Environment *ev)
if (prefs->opacity != 100)
prefs->adjust_opacity = FALSE;
prefs->orientation = bonobo_property_bag_client_get_value_gulong (pb, "orientation", ev);
if (prefs->orientation == ORIENTATION_SOLID)
prefs->gradient_enabled = FALSE;
else
prefs->gradient_enabled = TRUE;
return GTK_OBJECT (prefs);
}
@ -251,11 +260,17 @@ preferences_new_from_bonobo_db (Bonobo_ConfigDatabase db, CORBA_Environment *ev)
if (prefs->orientation != ORIENTATION_SOLID)
prefs->gradient_enabled = TRUE;
else
prefs->gradient_enabled = FALSE;
prefs->wallpaper_type = bonobo_config_get_ulong (db, "/main/wallpaper_type", NULL);
prefs->wallpaper_filename = g_strdup (*((CORBA_char **)(DB_GET_VALUE ("/main/wallpaper_filename"))->_value));
if (prefs->wallpaper_filename && strcmp (prefs->wallpaper_filename, "") != 0)
if (prefs->wallpaper_filename &&
strcmp (prefs->wallpaper_filename, "") != 0 &&
strcmp (prefs->wallpaper_filename, "(none)") != 0)
prefs->wallpaper_enabled = TRUE;
else
prefs->wallpaper_enabled = FALSE;
prefs->color1 = bonobo_color_to_gdk ((Bonobo_Config_Color *)(DB_GET_VALUE ("/main/color1"))->_value);
prefs->color2 = bonobo_color_to_gdk ((Bonobo_Config_Color *)(DB_GET_VALUE ("/main/color2"))->_value);

View file

@ -40,7 +40,7 @@ typedef struct _Preferences Preferences;
typedef struct _PreferencesClass PreferencesClass;
typedef enum _orientation_t {
ORIENTATION_SOLID, ORIENTATION_HORIZ, ORIENTATION_VERT
ORIENTATION_SOLID, ORIENTATION_HORIZ, ORIENTATION_VERT
} orientation_t;
typedef enum _wallpaper_type_t {