static void glade_gtk_widget_read_style_classes (GladeWidget * widget, GladeXmlNode * node) { GladeXmlNode *style_node; GladeXmlNode *class_node; GList *string_list = NULL; if ((style_node = glade_xml_search_child (node, GLADE_TAG_STYLE)) != NULL) { for (class_node = glade_xml_node_get_children (style_node); class_node; class_node = glade_xml_node_next (class_node)) { gchar *name; if (!glade_xml_node_verify (class_node, GLADE_TAG_CLASS)) continue; name = glade_xml_get_property_string (class_node, GLADE_TAG_NAME); string_list = glade_string_list_append (string_list, name, NULL, NULL, FALSE, NULL); g_free (name); } glade_widget_property_set (widget, "glade-style-classes", string_list); glade_string_list_free (string_list); } }
static void glade_gtk_filter_read_strings (GladeWidget *widget, GladeXmlNode *node, FilterType type, const gchar *property_name) { GladeXmlNode *items_node; GladeXmlNode *item_node; GList *string_list = NULL; const gchar *string_group_tag; const gchar *string_tag; switch (type) { case FILTER_PATTERN: string_group_tag = GLADE_TAG_PATTERNS; string_tag = GLADE_TAG_PATTERN; break; case FILTER_MIME: string_group_tag = GLADE_TAG_MIME_TYPES; string_tag = GLADE_TAG_MIME_TYPE; break; case FILTER_APPLICATION: string_group_tag = GLADE_TAG_APPLICATIONS; string_tag = GLADE_TAG_APPLICATION; break; default: g_assert_not_reached (); break; } if ((items_node = glade_xml_search_child (node, string_group_tag)) != NULL) { for (item_node = glade_xml_node_get_children (items_node); item_node; item_node = glade_xml_node_next (item_node)) { gchar *str; if (!glade_xml_node_verify (item_node, string_tag)) continue; if ((str = glade_xml_get_content (item_node)) == NULL) continue; string_list = glade_string_list_append (string_list, str, NULL, NULL, FALSE, NULL); g_free (str); } glade_widget_property_set (widget, property_name, string_list); glade_string_list_free (string_list); } }
static void glade_gtk_combo_box_text_read_items (GladeWidget *widget, GladeXmlNode *node) { GladeXmlNode *items_node; GladeXmlNode *item_node; GList *string_list = NULL; if ((items_node = glade_xml_search_child (node, GLADE_TAG_ITEMS)) != NULL) { for (item_node = glade_xml_node_get_children (items_node); item_node; item_node = glade_xml_node_next (item_node)) { gchar *str, *comment, *context; gchar *id; gboolean translatable; if (!glade_xml_node_verify (item_node, GLADE_TAG_ITEM)) continue; if ((str = glade_xml_get_content (item_node)) == NULL) continue; id = glade_xml_get_property_string (item_node, GLADE_TAG_ID); context = glade_xml_get_property_string (item_node, GLADE_TAG_CONTEXT); comment = glade_xml_get_property_string (item_node, GLADE_TAG_COMMENT); translatable = glade_xml_get_property_boolean (item_node, GLADE_TAG_TRANSLATABLE, FALSE); string_list = glade_string_list_append (string_list, str, comment, context, translatable, id); g_free (str); g_free (context); g_free (comment); g_free (id); } glade_widget_property_set (widget, "glade-items", string_list); glade_string_list_free (string_list); } }
static void string_edited (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GladeEditorProperty *eprop) { GladeEPropStringList *eprop_string_list = GLADE_EPROP_STRING_LIST (eprop); GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); GtkTreeIter iter; gboolean dummy; guint index; GladeProperty *property = glade_editor_property_get_property (eprop); GList *string_list = NULL; gtk_tree_model_get_iter (eprop_string_list->model, &iter, tree_path); gtk_tree_model_get (eprop_string_list->model, &iter, COLUMN_INDEX, &index, COLUMN_DUMMY, &dummy, -1); glade_property_get (property, &string_list); if (string_list) string_list = glade_string_list_copy (string_list); if (dummy) { if (new_text && new_text[0] && strcmp (new_text, _("<Type Here>")) != 0) string_list = glade_string_list_append (string_list, new_text, NULL, NULL, eprop_string_list->translatable, NULL); } else if (new_text && new_text[0]) { GladeString *string = g_list_nth_data (string_list, index); g_free (string->string); string->string = g_strdup (new_text); } else { GList *node = g_list_nth (string_list, index); glade_string_free (node->data); string_list = g_list_delete_link (string_list, node); } eprop_string_list->editing_index = index; if (eprop_string_list->pending_string_list) glade_string_list_free (eprop_string_list->pending_string_list); eprop_string_list->pending_string_list = string_list; if (eprop_string_list->update_id == 0) eprop_string_list->update_id = g_idle_add ((GSourceFunc) update_string_list_idle, eprop); gtk_tree_path_free (tree_path); }