#include <gtk/gtk.h>
+
struct task {
int id;
char *description;
char *status;
};
+static struct task **tasks;
+
static char *task_exec(char *opts)
{
FILE *f;
return tasks;
}
+static int cursor_changed_cbk(GtkTreeView *treeview, gpointer data)
+{
+ GtkTreePath *path;
+ GtkTreeViewColumn *cols;
+ gint *i;
+
+ printf("cursor_changed_cbk\n");
+
+ gtk_tree_view_get_cursor(treeview, &path, &cols);
+
+ if (path) {
+ i = gtk_tree_path_get_indices(path);
+
+ if (i)
+ printf("row selected: %d\n", *i);
+
+
+ }
+
+ gtk_tree_path_free(path);
+
+ return FALSE;
+}
int main(int argc, char **argv)
{
GtkWidget *window;
GtkTreeIter iter;
int i;
GtkTreeModel *model;
- struct task **tasks, **tasks_cur;
+ struct task **tasks_cur;
gtk_init(NULL, NULL);
builder = gtk_builder_new();
-1);
}
+ g_signal_connect(treeview,
+ "cursor-changed", (GCallback)cursor_changed_cbk, tasks);
+
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(window);