]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcomboboxtext.c
GtkEntry: Sanity check the end_pos value in _get_display_text()
[~andy/gtk] / gtk / gtkcomboboxtext.c
index b11c6454c64fb35fa64d5572577d3cb28c4cd6a2..e09f3ef3c490f825f8ba01b25309015b67d1edcd 100644 (file)
@@ -157,6 +157,7 @@ typedef struct {
   GtkBuilder    *builder;
   GObject       *object;
   const gchar   *domain;
+  gchar         *id;
 
   GString       *string;
 
@@ -199,6 +200,8 @@ item_start_element (GMarkupParseContext *context,
            }
          else if (strcmp (names[i], "context") == 0) 
            data->context = g_strdup (values[i]);
+         else if (strcmp (names[i], "id") == 0)
+           data->id = g_strdup (values[i]);
          else
            g_warning ("Unknown custom combo box item attribute: %s", names[i]);
        }
@@ -244,13 +247,15 @@ item_end_element (GMarkupParseContext *context,
          g_string_append (data->string, translated);
        }
 
-      gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->object), data->string->str);
+      gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (data->object), data->id, data->string->str);
     }
 
   data->translatable = FALSE;
   g_string_set_size (data->string, 0);
   g_free (data->context);
   data->context = NULL;
+  g_free (data->id);
+  data->id = NULL;
   data->is_text = FALSE;
 }
 
@@ -462,7 +467,7 @@ gtk_combo_box_text_prepend (GtkComboBoxText *combo_box,
  *
  * Inserts @text at @position in the list of strings stored in @combo_box.
  * If @id is non-%NULL then it is used as the ID of the row.  See
- * #GtkComboBox::id-column.
+ * #GtkComboBox:id-column.
  *
  * If @position is negative then @text is appended.
  *
@@ -571,8 +576,8 @@ gtk_combo_box_text_remove_all (GtkComboBoxText *combo_box)
  * function will return its contents (which will not necessarily
  * be an item from the list).
  *
- * Returns: a newly allocated string containing the currently
- *     active text. Must be freed with g_free().
+ * Returns: (transfer full): a newly allocated string containing the
+ *     currently active text. Must be freed with g_free().
  *
  * Since: 2.24
  */