Commit c8663580360e312cbf6dfdb8180b883d52b26d79
- Diff rendering mode:
- inline
- side by side
gladeui/glade-settings-editor.c
(32 / 2)
|   | |||
| 33 | 33 | #include <glib/gi18n-lib.h> | |
| 34 | 34 | ||
| 35 | 35 | #include "glade.h" | |
| 36 | #include "glade-settings-editor.h" | ||
| 36 | 37 | ||
| 37 | 38 | G_DEFINE_TYPE (GladeSettingsEditor, glade_settings_editor, GTK_TYPE_OBJECT) | |
| 38 | 39 | ||
| … | … | ||
| 105 | 105 | if (property->key != NULL) | |
| 106 | 106 | { | |
| 107 | 107 | add_property (self, property, NULL); | |
| 108 | |||
| 108 | 109 | if (first_property == NULL) | |
| 109 | 110 | first_property = property; | |
| 110 | 111 | } | |
| … | … | ||
| 189 | 189 | if (!found) | |
| 190 | 190 | add_property (self, property, &iter); | |
| 191 | 191 | ||
| 192 | tree_selection = gtk_tree_view_get_selection (self->view); | ||
| 192 | tree_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->view)); | ||
| 193 | 193 | gtk_tree_selection_select_iter (tree_selection, &iter); | |
| 194 | 194 | ||
| 195 | 195 | self->property = property; | |
| … | … | ||
| 241 | 241 | } | |
| 242 | 242 | ||
| 243 | 243 | static void | |
| 244 | remove_clicked (GtkButton *button, | ||
| 245 | GladeSettingsEditor *self) | ||
| 246 | { | ||
| 247 | GtkTreeIter iter; | ||
| 248 | GladeProperty *property; | ||
| 249 | |||
| 250 | if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection (self->view), | ||
| 251 | NULL, &iter)) | ||
| 252 | return; | ||
| 253 | |||
| 254 | gtk_tree_model_get (self->data, &iter, | ||
| 255 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, &property, | ||
| 256 | -1); | ||
| 257 | gtk_list_store_remove (GTK_LIST_STORE (self->data), &iter); | ||
| 258 | |||
| 259 | self->property = NULL; | ||
| 260 | glade_property_set_binding (property, NULL); | ||
| 261 | }; | ||
| 262 | |||
| 263 | static void | ||
| 244 | 264 | dialog_response (GtkDialog *dialog) | |
| 245 | 265 | { | |
| 246 | 266 | gtk_widget_hide (GTK_WIDGET (dialog)); | |
| … | … | ||
| 275 | 275 | GObject *retval; | |
| 276 | 276 | GtkCellRenderer *cell_renderer; | |
| 277 | 277 | GtkTreeViewColumn *column; | |
| 278 | GtkWidget *frame, *alignment, *button, *action_area; | ||
| 278 | 279 | ||
| 279 | 280 | retval = G_OBJECT_CLASS (glade_settings_editor_parent_class)->constructor | |
| 280 | 281 | (type, n_construct_properties, construct_properties); | |
| … | … | ||
| 309 | 309 | ||
| 310 | 310 | g_signal_connect (cell_renderer, "edited", G_CALLBACK (key_edited), self); | |
| 311 | 311 | ||
| 312 | |||
| 313 | 312 | gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self->dialog))), | |
| 314 | 313 | self->view); | |
| 314 | |||
| 315 | /* Add 'remove' button to action area. */ | ||
| 316 | button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); | ||
| 317 | g_signal_connect (button, "clicked", remove_clicked, self); | ||
| 318 | |||
| 319 | action_area = gtk_dialog_get_action_area (GTK_DIALOG (self->dialog)); | ||
| 320 | gtk_container_add (GTK_BOX (action_area), button); | ||
| 321 | gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (action_area), button, TRUE); | ||
| 315 | 322 | ||
| 316 | 323 | g_signal_connect (self->dialog, "response", G_CALLBACK (dialog_response), NULL); | |
| 317 | 324 |

