* Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * 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 #define PURPLE_SMILEY_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_SMILEY, PurpleSmileyPrivate)) static GObjectClass *parent_class; static GParamSpec *properties[PROP_LAST]; /******************************************************************************* ******************************************************************************/ purple_smiley_new(const gchar *shortcut, const gchar *path) PurpleSmileyPrivate *priv; g_return_val_if_fail(shortcut != NULL, NULL); g_return_val_if_fail(path != NULL, NULL); smiley = g_object_new(PURPLE_TYPE_SMILEY, priv = PURPLE_SMILEY_GET_PRIVATE(smiley); priv->image = purple_image_new_from_file(path, FALSE); purple_debug_error("smiley", "Couldn't load smiley data "); purple_smiley_new_remote(const gchar *shortcut) PurpleSmileyPrivate *priv; g_return_val_if_fail(shortcut != NULL, NULL); smiley = g_object_new(PURPLE_TYPE_SMILEY, priv = PURPLE_SMILEY_GET_PRIVATE(smiley); priv->image = purple_image_transfer_new(); purple_smiley_get_shortcut(const PurpleSmiley *smiley) PurpleSmileyPrivate *priv = PURPLE_SMILEY_GET_PRIVATE(smiley); g_return_val_if_fail(priv != NULL, NULL); purple_smiley_get_image(PurpleSmiley *smiley) PurpleSmileyPrivate *priv = PURPLE_SMILEY_GET_PRIVATE(smiley); g_return_val_if_fail(priv != NULL, NULL); g_return_val_if_fail(priv->image != NULL, NULL); /******************************************************************************* ******************************************************************************/ purple_smiley_init(GTypeInstance *instance, gpointer klass) PurpleSmiley *smiley = PURPLE_SMILEY(instance); PURPLE_DBUS_REGISTER_POINTER(smiley, PurpleSmiley); purple_smiley_finalize(GObject *obj) PurpleSmiley *smiley = PURPLE_SMILEY(obj); PurpleSmileyPrivate *priv = PURPLE_SMILEY_GET_PRIVATE(smiley); g_object_unref(priv->image); PURPLE_DBUS_UNREGISTER_POINTER(smiley); G_OBJECT_CLASS(parent_class)->finalize(obj); purple_smiley_get_property(GObject *object, guint par_id, GValue *value, PurpleSmiley *smiley = PURPLE_SMILEY(object); PurpleSmileyPrivate *priv = PURPLE_SMILEY_GET_PRIVATE(smiley); g_value_set_string(value, priv->shortcut); G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec); purple_smiley_set_property(GObject *object, guint par_id, const GValue *value, PurpleSmiley *smiley = PURPLE_SMILEY(object); PurpleSmileyPrivate *priv = PURPLE_SMILEY_GET_PRIVATE(smiley); priv->shortcut = g_strdup(g_value_get_string(value)); G_OBJECT_WARN_INVALID_PROPERTY_ID(object, par_id, pspec); purple_smiley_class_init(PurpleSmileyClass *klass) GObjectClass *gobj_class = G_OBJECT_CLASS(klass); parent_class = g_type_class_peek_parent(klass); g_type_class_add_private(klass, sizeof(PurpleSmileyPrivate)); gobj_class->get_property = purple_smiley_get_property; gobj_class->set_property = purple_smiley_set_property; gobj_class->finalize = purple_smiley_finalize; properties[PROP_SHORTCUT] = g_param_spec_string("shortcut", "Shortcut", "A non-escaped textual representation of a smiley.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties(gobj_class, PROP_LAST, properties); purple_smiley_get_type(void) if (G_UNLIKELY(type == 0)) { static const GTypeInfo info = { .class_size = sizeof(PurpleSmileyClass), .class_init = (GClassInitFunc)purple_smiley_class_init, .instance_size = sizeof(PurpleSmiley), .instance_init = purple_smiley_init, type = g_type_register_static(G_TYPE_OBJECT, "PurpleSmiley", &info, 0);