Commit 4a70f67d9f1d56877da33be48c3f7aa45f0c0769
- Diff rendering mode:
- inline
- side by side
gladeui/glade-settings-editor.c
(57 / 13)
|   | |||
| 47 | 47 | ||
| 48 | 48 | #define KEY_DEFAULT _("<Type here>") | |
| 49 | 49 | ||
| 50 | static void | ||
| 51 | add_property (GladeSettingsEditor *self, | ||
| 52 | GladeProperty *property) | ||
| 53 | { | ||
| 54 | gtk_list_store_append (GTK_LIST_STORE (self->data), &iter); | ||
| 55 | |||
| 56 | // FIXME: set tooltip as klass->name | ||
| 57 | gtk_list_store_set (GTK_LIST_STORE (self->data), &iter, | ||
| 58 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, property, | ||
| 59 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY_NAME, property_class->id, | ||
| 60 | GLADE_SETTINGS_EDITOR_COLUMN_KEY_NAME, KEY_DEFAULT, | ||
| 61 | -1); | ||
| 62 | }; | ||
| 63 | |||
| 50 | 64 | void | |
| 51 | 65 | glade_settings_editor_show (GladeSettingsEditor *self, | |
| 52 | 66 | GladeWidget *widget, | |
| … | … | ||
| 76 | 76 | glade_settings_editor_set_widget (GladeSettingsEditor *self, | |
| 77 | 77 | GladeWidget *widget) | |
| 78 | 78 | { | |
| 79 | GList *node; | ||
| 80 | |||
| 79 | 81 | if (widget == self->widget) | |
| 80 | 82 | return; | |
| 81 | 83 | ||
| 82 | // FIXME: load all bound properties into treeview | ||
| 83 | // should a widget keep a list of all its bound properties to save us going through | ||
| 84 | /* Load the widget's bound properties. */ | ||
| 85 | gtk_list_store_clear (GTK_LIST_STORE (self->data)); | ||
| 86 | |||
| 87 | // FIXME: should a widget keep a list of all its bound properties to save us going through | ||
| 84 | 88 | // each one? | |
| 89 | for (node=widget->properties; node; node=node->next) { | ||
| 90 | GladeProperty *property = GLADE_PROPERTY (node->data); | ||
| 85 | 91 | ||
| 92 | if (node->key != NULL) { | ||
| 93 | |||
| 94 | |||
| 95 | }; | ||
| 96 | }; | ||
| 97 | |||
| 86 | 98 | self->widget = widget; | |
| 87 | 99 | }; | |
| 88 | 100 | ||
| … | … | ||
| 105 | 105 | GladePropertyClass *property_class = property->klass;; | |
| 106 | 106 | GtkTreeIter iter; | |
| 107 | 107 | ||
| 108 | }; | ||
| 109 | }; | ||
| 110 | |||
| 111 | self->widget = widget; | ||
| 112 | }; | ||
| 113 | |||
| 114 | void | ||
| 115 | glade_settings_editor_set_property (GladeSettingsEditor *self, | ||
| 116 | GladeProperty *property) | ||
| 117 | { | ||
| 118 | GladePropertyClass *property_class = property->klass;; | ||
| 119 | GtkTreeIter iter; | ||
| 120 | |||
| 121 | if (property == self->property) | ||
| 122 | return; | ||
| 123 | |||
| 108 | 124 | if (property->widget != self->widget) | |
| 109 | 125 | glade_settings_editor_set_widget (self, property->widget); | |
| 110 | 126 | ||
| 111 | 127 | // FIXME: look for property in list | |
| 112 | gtk_list_store_append (GTK_LIST_STORE (self->data), &iter); | ||
| 113 | // FIXME: set tooltip as klass->name | ||
| 114 | gtk_list_store_set (GTK_LIST_STORE (self->data), &iter, | ||
| 115 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, property_class->id, | ||
| 116 | GLADE_SETTINGS_EDITOR_COLUMN_KEY, KEY_DEFAULT, | ||
| 117 | -1); | ||
| 128 | add_property (self, property); | ||
| 118 | 129 | }; | |
| 119 | 130 | ||
| 120 | 131 | static void | |
| … | … | ||
| 137 | 137 | GladeSettingsEditor *self = GLADE_SETTINGS_EDITOR (data); | |
| 138 | 138 | GtkTreePath *path = gtk_tree_path_new_from_string (path_str); | |
| 139 | 139 | GtkTreeIter iter; | |
| 140 | gboolean is_void; | ||
| 140 | GladeProperty *property; | ||
| 141 | 141 | ||
| 142 | 142 | g_return_if_fail (gtk_tree_model_get_iter (self->data, &iter, path)); | |
| 143 | 143 | gtk_tree_path_free (path); | |
| 144 | 144 | ||
| 145 | gtk_tree_model_get (self->data, &iter, | ||
| 146 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, &property, | ||
| 147 | -1); | ||
| 148 | |||
| 145 | 149 | if (new_key == NULL || *new_key == 0) | |
| 146 | 150 | { | |
| 147 | 151 | /* Not bound any more - remove from tree model */ | |
| … | … | ||
| 153 | 153 | } | |
| 154 | 154 | else { | |
| 155 | 155 | gtk_list_store_set (GTK_LIST_STORE (self->data), &iter, | |
| 156 | GLADE_SETTINGS_EDITOR_COLUMN_KEY, new_key, | ||
| 156 | GLADE_SETTINGS_EDITOR_COLUMN_KEY_NAME, new_key, | ||
| 157 | 157 | -1); | |
| 158 | 158 | }; | |
| 159 | 159 | ||
| 160 | glade_command_set_property_binding (property, new_key); | ||
| 161 | |||
| 160 | 162 | /*old_signal = glade_signal_new (signal_name, handler, old_userdata, after); | |
| 161 | 163 | ||
| 162 | 164 | new_signal = glade_signal_new (signal_name, handler, new_userdata, after); | |
| … | … | ||
| 191 | 191 | (type, n_construct_properties, construct_properties); | |
| 192 | 192 | self = GLADE_SETTINGS_EDITOR (retval); | |
| 193 | 193 | ||
| 194 | self->data = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING)); | ||
| 194 | self->data = GTK_TREE_MODEL (gtk_list_store_new (3, GLADE_TYPE_PROPERTY, | ||
| 195 | G_TYPE_STRING, G_TYPE_STRING)); | ||
| 195 | 196 | ||
| 196 | 197 | self->dialog = gtk_dialog_new_with_buttons (_("Settings connections"), | |
| 197 | 198 | GTK_WINDOW (glade_app_get_window ()), 0, | |
| … | … | ||
| 205 | 205 | cell_renderer = gtk_cell_renderer_text_new (); | |
| 206 | 206 | column = gtk_tree_view_column_new_with_attributes | |
| 207 | 207 | (_("Property Name"), cell_renderer, | |
| 208 | "text", GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, | ||
| 208 | "text", GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY_NAME, | ||
| 209 | 209 | NULL); | |
| 210 | 210 | gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); | |
| 211 | 211 | ||
| … | … | ||
| 213 | 213 | g_object_set (cell_renderer, "editable", TRUE, NULL); | |
| 214 | 214 | column = gtk_tree_view_column_new_with_attributes | |
| 215 | 215 | (_("Settings Key"), cell_renderer, | |
| 216 | "text", GLADE_SETTINGS_EDITOR_COLUMN_KEY, | ||
| 216 | "text", GLADE_SETTINGS_EDITOR_COLUMN_KEY_NAME, | ||
| 217 | 217 | NULL); | |
| 218 | 218 | gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); | |
| 219 | 219 |
|   | |||
| 19 | 19 | enum | |
| 20 | 20 | { | |
| 21 | 21 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, | |
| 22 | GLADE_SETTINGS_EDITOR_COLUMN_KEY, | ||
| 22 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY_NAME, | ||
| 23 | GLADE_SETTINGS_EDITOR_COLUMN_KEY_NAME, | ||
| 23 | 24 | GLADE_SETTINGS_EDITOR_NUM_COLUMNS | |
| 24 | 25 | }; | |
| 25 | 26 |

