X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktextbufferserialize.c;h=0b3f547b6450e2d800637a9a20ff63d21c0bafce;hb=9d0febc9a64a5bfb0fcfc3a88de4757f6c1ff090;hp=16a36d3994a4d2cc60197d878cac702996c7e42f;hpb=d3f1745493867d37f7c7cbe48002ce076c9db5f7;p=~andy%2Fgtk diff --git a/gtk/gtktextbufferserialize.c b/gtk/gtktextbufferserialize.c index 16a36d399..0b3f547b6 100644 --- a/gtk/gtktextbufferserialize.c +++ b/gtk/gtktextbufferserialize.c @@ -14,9 +14,7 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ /* FIXME: We should use other error codes for the @@ -32,6 +30,7 @@ #include "gdk-pixbuf/gdk-pixdata.h" #include "gtktextbufferserialize.h" +#include "gtktexttagprivate.h" #include "gtkintl.h" @@ -53,7 +52,7 @@ serialize_value (GValue *value) { if (g_value_type_transformable (value->g_type, G_TYPE_STRING)) { - GValue text_value = { 0 }; + GValue text_value = G_VALUE_INIT; gchar *tmp; g_value_init (&text_value, G_TYPE_STRING); @@ -70,10 +69,6 @@ serialize_value (GValue *value) return g_strdup_printf ("%x:%x:%x", color->red, color->green, color->blue); } - else if (g_type_is_a (value->g_type, GDK_TYPE_DRAWABLE)) - { - /* Don't do anything */ - } else { g_warning ("Type %s is not serializable\n", g_type_name (value->g_type)); @@ -88,7 +83,7 @@ deserialize_value (const gchar *str, { if (g_value_type_transformable (G_TYPE_STRING, value->g_type)) { - GValue text_value = { 0 }; + GValue text_value = G_VALUE_INIT; gboolean retval; g_value_init (&text_value, G_TYPE_STRING); @@ -296,9 +291,9 @@ serialize_tag (gpointer key, g_string_append (context->tag_table_str, " name) + if (tag->priv->name) { - tag_name = g_markup_escape_text (tag->name, -1); + tag_name = g_markup_escape_text (tag->priv->name, -1); g_string_append_printf (context->tag_table_str, "name=\"%s\"", tag_name); g_free (tag_name); } @@ -309,14 +304,14 @@ serialize_tag (gpointer key, g_string_append_printf (context->tag_table_str, "id=\"%d\"", tag_id); } - g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priority); + g_string_append_printf (context->tag_table_str, " priority=\"%d\">\n", tag->priv->priority); /* Serialize properties */ pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (tag), &n_pspecs); for (i = 0; i < n_pspecs; i++) { - GValue value = { 0 }; + GValue value = G_VALUE_INIT; gchar *tmp, *tmp2; if (!(pspecs[i]->flags & G_PARAM_READABLE) || @@ -493,9 +488,9 @@ serialize_text (GtkTextBuffer *buffer, /* Add it to the tag hash table */ g_hash_table_insert (context->tags, tag, tag); - if (tag->name) + if (tag->priv->name) { - tag_name = g_markup_escape_text (tag->name, -1); + tag_name = g_markup_escape_text (tag->priv->name, -1); g_string_append_printf (context->text_str, "", tag_name); g_free (tag_name); @@ -1167,7 +1162,7 @@ parse_attr_element (GMarkupParseContext *context, { const gchar *name, *type, *value; GType gtype; - GValue gvalue = { 0 }; + GValue gvalue = G_VALUE_INIT; GParamSpec *pspec; g_assert (peek_state (info) == STATE_TAG); @@ -1485,10 +1480,10 @@ end_element_handler (GMarkupParseContext *context, pop_state (info); g_assert (peek_state (info) == STATE_TAGS); - if (info->current_tag->name) + if (info->current_tag->priv->name) { /* Add tag to defined tags hash */ - tmp = g_strdup (info->current_tag->name); + tmp = g_strdup (info->current_tag->priv->name); g_hash_table_insert (info->defined_tags, tmp, tmp); } @@ -1787,8 +1782,7 @@ read_headers (const gchar *start, return g_list_reverse (headers); error: - g_list_foreach (headers, (GFunc) g_free, NULL); - g_list_free (headers); + g_list_free_full (headers, g_free); g_set_error_literal (error, G_MARKUP_ERROR, @@ -1882,8 +1876,7 @@ _gtk_text_buffer_deserialize_rich_text (GtkTextBuffer *register_buffer, create_tags, error, headers->next); out: - g_list_foreach (headers, (GFunc)g_free, NULL); - g_list_free (headers); + g_list_free_full (headers, g_free); return retval; }