static void sync_object (GladeEPropAttrs *eprop_attrs, gboolean use_command) { GList *attributes = NULL; GladeAttribute *gattr; GtkTreeIter iter; PangoAttrType type; AttrEditType edit_type; gchar *strval = NULL; gboolean valid; valid = gtk_tree_model_iter_children (eprop_attrs->model, &iter, NULL); while (valid) { if (!is_empty_row (eprop_attrs->model, &iter)) { gtk_tree_model_get (eprop_attrs->model, &iter, COLUMN_TYPE, &type, COLUMN_EDIT_TYPE, &edit_type, COLUMN_TEXT, &strval, -1); gattr = glade_gtk_attribute_from_string (type, (edit_type == EDIT_TOGGLE) ? "" : strval); strval = (g_free (strval), NULL); attributes = g_list_prepend (attributes, gattr); } valid = gtk_tree_model_iter_next (eprop_attrs->model, &iter); } if (use_command) { GValue value = { 0, }; g_value_init (&value, GLADE_TYPE_ATTR_GLIST); g_value_take_boxed (&value, g_list_reverse (attributes)); glade_editor_property_commit (GLADE_EDITOR_PROPERTY (eprop_attrs), &value); g_value_unset (&value); } else { GladeProperty *property = glade_editor_property_get_property (GLADE_EDITOR_PROPERTY (eprop_attrs)); glade_property_set (property, g_list_reverse (attributes)); glade_attr_list_free (attributes); } }
static void glade_tool_item_group_editor_load (GladeEditable *editable, GladeWidget *widget) { GladeToolItemGroupEditor *group_editor = GLADE_TOOL_ITEM_GROUP_EDITOR (editable); gboolean custom_label = FALSE; GList *l; /* Chain up to default implementation */ parent_editable_iface->load (editable, widget); /* load the embedded editable... */ if (group_editor->embed) glade_editable_load (GLADE_EDITABLE (group_editor->embed), widget); for (l = group_editor->properties; l; l = l->next) glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data), widget); if (widget) { glade_widget_property_get (widget, "custom-label", &custom_label); if (custom_label) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group_editor->label_widget_radio), TRUE); else gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group_editor->label_radio), TRUE); } }
static void icon_name_entry_activated (GtkEntry * entry, GladeEPropIconSources * eprop_sources) { const gchar *text = gtk_entry_get_text (entry); GladeProperty *property; GladeIconSources *sources = NULL; if (!text || !text[0]) return; property = glade_editor_property_get_property (GLADE_EDITOR_PROPERTY (eprop_sources)); if (!property) return; glade_property_get (property, &sources); if (sources == NULL || g_hash_table_lookup (sources->sources, text) == NULL) { /* Add the new source if it doesnt already exist */ gtk_combo_box_text_insert (GTK_COMBO_BOX_TEXT (eprop_sources->combo), -1, text, text); } /* Set the active id whether it existed or not */ gtk_combo_box_set_active_id (GTK_COMBO_BOX (eprop_sources->combo), text); }
static void icon_sources_populate_store (GladeEPropIconSources * eprop_sources) { GladeIconSources *sources = NULL; GladeProperty *property; gtk_tree_store_clear (eprop_sources->store); gtk_combo_box_text_remove_all (GTK_COMBO_BOX_TEXT (eprop_sources->combo)); property = glade_editor_property_get_property (GLADE_EDITOR_PROPERTY (eprop_sources)); if (!property) return; glade_property_get (property, &sources); if (sources) g_hash_table_foreach (sources->sources, (GHFunc) populate_store_foreach, eprop_sources); }
void accel_edited (GtkCellRendererAccel * accel, gchar * path_string, guint accel_key, GdkModifierType accel_mods, guint hardware_keycode, GladeEPropAccel * eprop_accel) { gboolean key_was_set; GtkTreeIter iter, parent_iter, new_iter; gchar *accel_text; GladePropertyClass *pclass; GladeWidgetAdaptor *adaptor; gboolean is_action; pclass = glade_editor_property_get_pclass (GLADE_EDITOR_PROPERTY (eprop_accel)); adaptor = glade_property_class_get_adaptor (pclass); if (!gtk_tree_model_get_iter_from_string (eprop_accel->model, &iter, path_string)) return; is_action = (glade_widget_adaptor_get_object_type (adaptor) == GTK_TYPE_ACTION || g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), GTK_TYPE_ACTION)); gtk_tree_model_get (eprop_accel->model, &iter, ACCEL_COLUMN_KEY_ENTERED, &key_was_set, -1); accel_text = gtk_accelerator_name (accel_key, accel_mods); gtk_tree_store_set (GTK_TREE_STORE (eprop_accel->model), &iter, ACCEL_COLUMN_KEY_ENTERED, TRUE, ACCEL_COLUMN_STYLE, PANGO_STYLE_NORMAL, ACCEL_COLUMN_FOREGROUND, "Black", ACCEL_COLUMN_TEXT, accel_text, ACCEL_COLUMN_KEYCODE, accel_key, ACCEL_COLUMN_MODIFIERS, accel_mods, -1); g_free (accel_text); /* Append a new one if needed */ if (is_action == FALSE && key_was_set == FALSE && gtk_tree_model_iter_parent (eprop_accel->model, &parent_iter, &iter)) { gchar *signal, *real_signal; gtk_tree_model_get (eprop_accel->model, &iter, ACCEL_COLUMN_SIGNAL, &signal, ACCEL_COLUMN_REAL_SIGNAL, &real_signal, -1); /* Append a new empty slot at the end */ gtk_tree_store_insert_after (GTK_TREE_STORE (eprop_accel->model), &new_iter, &parent_iter, &iter); gtk_tree_store_set (GTK_TREE_STORE (eprop_accel->model), &new_iter, ACCEL_COLUMN_SIGNAL, signal, ACCEL_COLUMN_REAL_SIGNAL, real_signal, ACCEL_COLUMN_TEXT, _("<choose a key>"), ACCEL_COLUMN_WEIGHT, PANGO_WEIGHT_NORMAL, ACCEL_COLUMN_STYLE, PANGO_STYLE_ITALIC, ACCEL_COLUMN_FOREGROUND, "Grey", ACCEL_COLUMN_VISIBLE, TRUE, ACCEL_COLUMN_KEYCODE, 0, ACCEL_COLUMN_MODIFIERS, 0, ACCEL_COLUMN_KEY_ENTERED, FALSE, -1); g_free (signal); g_free (real_signal); } }