Ik heb om de editor maar een scrollwindow gezet.
[sgc.git] / signals-editor.c
blob34f00db3ef887360079eff1c4d82c82caa86dd9b
1 #include "sgc.h"
3 void on_buttonAdd_clicked (GtkWidget *treeview, gpointer data)
5 add_entry("san1");
8 void add_entry(gchar *txt) {
9 /* ignore if entry is empty */
10 if (txt && *txt)
12 GtkTreeIter newrow;
14 gtk_list_store_append(GTK_LIST_STORE(liststore), &newrow);
16 gtk_list_store_set(GTK_LIST_STORE(liststore), &newrow, COL_TEXT, txt, -1);
18 if (treevalid == FALSE) {
19 treevalid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(liststore), &mainIter);
20 updateWidgets();
25 void remove_entry (GtkWidget *treeview, gpointer data)
27 GtkTreeSelection *sel;
28 GtkTreeIter selected_row;
30 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
32 if (gtk_tree_selection_get_selected(sel, &liststore, &selected_row))
34 gtk_list_store_remove(GTK_LIST_STORE(liststore), &selected_row);
35 treevalid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(liststore), &mainIter);
36 updateWidgets();
40 void on_treeview_edited (GtkCellRendererText *celltext,
41 const gchar *string_path, const gchar *new_text, gpointer data) {
43 GtkTreeModel *model = GTK_TREE_MODEL(data);
44 GtkTreeIter iter;
45 gtk_tree_model_get_iter_from_string(model, &iter, string_path);
46 gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEXT, new_text, -1);
47 treevalid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(liststore), &mainIter);
48 updateWidgets();
51 gboolean on_treeother() {
52 treevalid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(liststore), &mainIter);
53 updateWidgets();
54 return false;
57 void on_buttonOpen_clicked(GtkWidget *filechooser, gpointer data) {
58 /* Eerst vragen oude op te slaan ? */
59 //TODO: Freecheck
60 fileOpen(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filechooser)));