Mercurial > pidgin
diff libpurple/theme.c @ 25911:0c7b74fc558e
Lots of minor whitespace and comment changes:
* Removed stray whitespace
* Changed a few places that used space indentation to use tabs
* Changed some places that used tabs for alignment in the middle
of a line of code to use spaces
* Use two tabs to indent code that spans more than one line instead of
a few tabs and a few spaces in an effort to align the subsequent lines
with the initial one
* Changed "#ifdef _BLAH_H" to "#ifdef BLAH_H" because an underscore
followed by a capital letter is reserved for use by the compiler and
system libraries.
I also changed the path to the sound theme.xml file from
root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader");
to
root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-theme-loader");
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Sun, 25 Jan 2009 22:55:23 +0000 |
| parents | 1eacf60a73dd |
| children | f70e86aec7d0 |
line wrap: on
line diff
--- a/libpurple/theme.c Sat Jan 24 03:11:09 2009 +0000 +++ b/libpurple/theme.c Sun Jan 25 22:55:23 2009 +0000 @@ -1,5 +1,5 @@ /* - * Themes for LibPurple + * Themes for libpurple * * Pidgin is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this @@ -18,8 +18,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - * */ + #include <glib.h> #include <string.h> @@ -35,6 +35,7 @@ /****************************************************************************** * Structs *****************************************************************************/ + typedef struct { gchar *name; gchar *description; @@ -65,16 +66,16 @@ }; /****************************************************************************** - * GObject Stuff * + * GObject Stuff *****************************************************************************/ static void purple_theme_get_property(GObject *obj, guint param_id, GValue *value, - GParamSpec *psec) + GParamSpec *psec) { PurpleTheme *theme = PURPLE_THEME(obj); - switch(param_id) { + switch (param_id) { case PROP_NAME: g_value_set_string(value, purple_theme_get_name(theme)); break; @@ -101,11 +102,11 @@ static void purple_theme_set_property(GObject *obj, guint param_id, const GValue *value, - GParamSpec *psec) + GParamSpec *psec) { PurpleTheme *theme = PURPLE_THEME(obj); - switch(param_id) { + switch (param_id) { case PROP_NAME: purple_theme_set_name(theme, g_value_get_string(value)); break; @@ -132,7 +133,7 @@ static void purple_theme_init(GTypeInstance *instance, - gpointer klass) + gpointer klass) { PurpleTheme *theme = PURPLE_THEME(instance); theme->priv = g_new0(PurpleThemePrivate, 1); @@ -141,9 +142,9 @@ static void purple_theme_finalize(GObject *obj) { - PurpleTheme *theme = PURPLE_THEME(obj); + PurpleTheme *theme = PURPLE_THEME(obj); PurpleThemePrivate *priv = PURPLE_THEME_GET_PRIVATE(theme); - + g_free(priv->name); g_free(priv->description); g_free(priv->author); @@ -155,7 +156,7 @@ } static void -purple_theme_class_init (PurpleThemeClass *klass) +purple_theme_class_init(PurpleThemeClass *klass) { GObjectClass *obj_class = G_OBJECT_CLASS(klass); GParamSpec *pspec; @@ -165,90 +166,89 @@ obj_class->get_property = purple_theme_get_property; obj_class->set_property = purple_theme_set_property; obj_class->finalize = purple_theme_finalize; - + /* NAME */ pspec = g_param_spec_string("name", "Name", - "The name of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + "The name of the theme", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_NAME, pspec); /* DESCRIPTION */ pspec = g_param_spec_string("description", "Description", - "The description of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + "The description of the theme", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_DESCRIPTION, pspec); /* AUTHOR */ pspec = g_param_spec_string("author", "Author", - "The author of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + "The author of the theme", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_AUTHOR, pspec); /* TYPE STRING (read only) */ pspec = g_param_spec_string("type", "Type", - "The string represtenting the type of the theme", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); + "The string represtenting the type of the theme", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property(obj_class, PROP_TYPE, pspec); /* DIRECTORY */ pspec = g_param_spec_string("directory", "Directory", - "The directory that contains the theme and all its files", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT); + "The directory that contains the theme and all its files", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT); g_object_class_install_property(obj_class, PROP_DIR, pspec); /* PREVIEW IMAGE */ pspec = g_param_spec_string("image", "Image", - "A preview image of the theme", - NULL, - G_PARAM_READWRITE); + "A preview image of the theme", + NULL, + G_PARAM_READWRITE); g_object_class_install_property(obj_class, PROP_IMAGE, pspec); } -GType -purple_theme_get_type (void) +GType +purple_theme_get_type(void) { - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (PurpleThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)purple_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PurpleTheme), - 0, /* n_preallocs */ - purple_theme_init, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static (G_TYPE_OBJECT, - "PurpleTheme", - &info, G_TYPE_FLAG_ABSTRACT); - } - return type; + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof(PurpleThemeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)purple_theme_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(PurpleTheme), + 0, /* n_preallocs */ + purple_theme_init, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static (G_TYPE_OBJECT, + "PurpleTheme", &info, G_TYPE_FLAG_ABSTRACT); + } + return type; } /****************************************************************************** * Helper Functions *****************************************************************************/ -static gchar* +static gchar * theme_clean_text(const gchar *text) { - gchar *clean_text = g_markup_escape_text(text, strlen(text)); + gchar *clean_text = g_markup_escape_text(text, -1); g_strdelimit(clean_text, "\n", ' '); purple_str_strip_char(clean_text, '\r'); return clean_text; } /***************************************************************************** - * Public API functions + * Public API function *****************************************************************************/ const gchar * @@ -349,7 +349,7 @@ } const gchar * -purple_theme_get_dir(PurpleTheme *theme) +purple_theme_get_dir(PurpleTheme *theme) { PurpleThemePrivate *priv; @@ -388,15 +388,15 @@ purple_theme_get_image_full(PurpleTheme *theme) { const gchar *filename = purple_theme_get_image(theme); - + g_return_val_if_fail(filename, NULL); return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL); } -void +void purple_theme_set_image(PurpleTheme *theme, const gchar *img) -{ +{ PurpleThemePrivate *priv; g_return_if_fail(PURPLE_IS_THEME(theme));
