diff --git a/panels/background/gnome-wp-item.c b/panels/background/gnome-wp-item.c index 21f8c8495..56ddefae6 100644 --- a/panels/background/gnome-wp-item.c +++ b/panels/background/gnome-wp-item.c @@ -24,76 +24,6 @@ #include #include "gnome-wp-item.h" -static struct { - GDesktopBackgroundStyle value; - gchar *string; -} options_lookup[] = { - { G_DESKTOP_BACKGROUND_STYLE_CENTERED, "centered" }, - { G_DESKTOP_BACKGROUND_STYLE_STRETCHED, "stretched" }, - { G_DESKTOP_BACKGROUND_STYLE_SCALED, "scaled" }, - { G_DESKTOP_BACKGROUND_STYLE_ZOOM, "zoom" }, - { G_DESKTOP_BACKGROUND_STYLE_WALLPAPER, "wallpaper" }, - { G_DESKTOP_BACKGROUND_STYLE_SPANNED, "spanned" }, - { 0, NULL } -}; - -static struct { - GDesktopBackgroundShading value; - gchar *string; -} shade_lookup[] = { - { G_DESKTOP_BACKGROUND_SHADING_SOLID, "solid" }, - { G_DESKTOP_BACKGROUND_SHADING_HORIZONTAL, "horizontal-gradient" }, - { G_DESKTOP_BACKGROUND_SHADING_VERTICAL, "vertical-gradient" }, - { 0, NULL } -}; - -const gchar *wp_item_option_to_string (GDesktopBackgroundStyle type) -{ - int i; - - for (i = 0; options_lookup[i].value != 0; i++) { - if (options_lookup[i].value == type) - return (const gchar *) options_lookup[i].string; - } - - return "scaled"; -} - -const gchar *wp_item_shading_to_string (GDesktopBackgroundShading type) -{ - int i; - - for (i = 0; shade_lookup[i].value != 0; i++) { - if (shade_lookup[i].value == type) - return (const gchar *) shade_lookup[i].string; - } - - return "solid"; -} - -GDesktopBackgroundStyle wp_item_string_to_option (const gchar *option) -{ - gint i; - - for (i = 0; options_lookup[i].value != 0; i++) { - if (g_str_equal (options_lookup[i].string, option)) - return options_lookup[i].value; - } - - return G_DESKTOP_BACKGROUND_STYLE_SCALED; -} - -GDesktopBackgroundShading wp_item_string_to_shading (const gchar *shade_type) -{ - int i; - - for (i = 0; shade_lookup[i].value != 0; i++) { - if (g_str_equal (shade_lookup[i].string, shade_type)) - return options_lookup[i].value; - } - return G_DESKTOP_BACKGROUND_SHADING_SOLID; -} - static void set_bg_properties (GnomeWPItem *item) { if (!item->bg) diff --git a/panels/background/gnome-wp-item.h b/panels/background/gnome-wp-item.h index 01e40d59e..c820269ee 100644 --- a/panels/background/gnome-wp-item.h +++ b/panels/background/gnome-wp-item.h @@ -86,9 +86,4 @@ void gnome_wp_item_update (GnomeWPItem *item); void gnome_wp_item_update_size (GnomeWPItem *item, GnomeDesktopThumbnailFactory *thumbs); void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item); -const gchar *wp_item_option_to_string (GDesktopBackgroundStyle type); -const gchar *wp_item_shading_to_string (GDesktopBackgroundShading type); -GDesktopBackgroundStyle wp_item_string_to_option (const gchar *option); -GDesktopBackgroundShading wp_item_string_to_shading (const gchar *shade_type); - #endif diff --git a/panels/background/gnome-wp-xml.c b/panels/background/gnome-wp-xml.c index 4672ec3ea..46bddc2a0 100644 --- a/panels/background/gnome-wp-xml.c +++ b/panels/background/gnome-wp-xml.c @@ -23,6 +23,13 @@ #include #include #include +#include +#include + +static const gchar *wp_item_option_to_string (GDesktopBackgroundStyle type); +static const gchar *wp_item_shading_to_string (GDesktopBackgroundShading type); +static GDesktopBackgroundStyle wp_item_string_to_option (const gchar *option); +static GDesktopBackgroundShading wp_item_string_to_shading (const gchar *shade_type); static gboolean gnome_wp_xml_get_bool (const xmlNode * parent, const gchar * prop_name) { @@ -380,3 +387,77 @@ void gnome_wp_xml_save_list (GnomeWpXml *data) { xmlFreeDoc (wplist); g_free (wpfile); } + +static struct { + GDesktopBackgroundStyle value; + gchar *string; +} options_lookup[] = { + { G_DESKTOP_BACKGROUND_STYLE_CENTERED, "centered" }, + { G_DESKTOP_BACKGROUND_STYLE_STRETCHED, "stretched" }, + { G_DESKTOP_BACKGROUND_STYLE_SCALED, "scaled" }, + { G_DESKTOP_BACKGROUND_STYLE_ZOOM, "zoom" }, + { G_DESKTOP_BACKGROUND_STYLE_WALLPAPER, "wallpaper" }, + { G_DESKTOP_BACKGROUND_STYLE_SPANNED, "spanned" }, + { 0, NULL } +}; + +static struct { + GDesktopBackgroundShading value; + gchar *string; +} shade_lookup[] = { + { G_DESKTOP_BACKGROUND_SHADING_SOLID, "solid" }, + { G_DESKTOP_BACKGROUND_SHADING_HORIZONTAL, "horizontal-gradient" }, + { G_DESKTOP_BACKGROUND_SHADING_VERTICAL, "vertical-gradient" }, + { 0, NULL } +}; + +static const +gchar *wp_item_option_to_string (GDesktopBackgroundStyle type) +{ + int i; + + for (i = 0; options_lookup[i].value != 0; i++) { + if (options_lookup[i].value == type) + return (const gchar *) options_lookup[i].string; + } + + return "scaled"; +} + +static const +gchar *wp_item_shading_to_string (GDesktopBackgroundShading type) +{ + int i; + + for (i = 0; shade_lookup[i].value != 0; i++) { + if (shade_lookup[i].value == type) + return (const gchar *) shade_lookup[i].string; + } + + return "solid"; +} + +static GDesktopBackgroundStyle +wp_item_string_to_option (const gchar *option) +{ + gint i; + + for (i = 0; options_lookup[i].value != 0; i++) { + if (g_str_equal (options_lookup[i].string, option)) + return options_lookup[i].value; + } + + return G_DESKTOP_BACKGROUND_STYLE_SCALED; +} + +static GDesktopBackgroundShading +wp_item_string_to_shading (const gchar *shade_type) +{ + int i; + + for (i = 0; shade_lookup[i].value != 0; i++) { + if (g_str_equal (shade_lookup[i].string, shade_type)) + return options_lookup[i].value; + } + return G_DESKTOP_BACKGROUND_SHADING_SOLID; +}