background: Make a few functions private

They were only used within gnome-wp-xml.c, and nowhere else
so hide them there.
This commit is contained in:
Bastien Nocera 2011-02-10 11:35:29 +00:00
parent 75d97e3bf4
commit 1416e68b92
3 changed files with 81 additions and 75 deletions

View file

@ -24,76 +24,6 @@
#include <string.h> #include <string.h>
#include "gnome-wp-item.h" #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) static void set_bg_properties (GnomeWPItem *item)
{ {
if (!item->bg) if (!item->bg)

View file

@ -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_update_size (GnomeWPItem *item, GnomeDesktopThumbnailFactory *thumbs);
void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item); 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 #endif

View file

@ -23,6 +23,13 @@
#include <gio/gio.h> #include <gio/gio.h>
#include <string.h> #include <string.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libgnome-desktop/gnome-bg.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
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, static gboolean gnome_wp_xml_get_bool (const xmlNode * parent,
const gchar * prop_name) { const gchar * prop_name) {
@ -380,3 +387,77 @@ void gnome_wp_xml_save_list (GnomeWpXml *data) {
xmlFreeDoc (wplist); xmlFreeDoc (wplist);
g_free (wpfile); 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;
}