projects
/
ptask.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e27cd0a
)
(no commit message)
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Mon, 15 Oct 2012 13:24:25 +0000
(13:24 +0000)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Mon, 15 Oct 2012 13:24:25 +0000
(13:24 +0000)
src/main.c
patch
|
blob
|
history
diff --git
a/src/main.c
b/src/main.c
index
c0456c7
..
7fade92
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-24,12
+24,15
@@
#include <gtk/gtk.h>
#include <gtk/gtk.h>
+
struct task {
int id;
char *description;
char *status;
};
struct task {
int id;
char *description;
char *status;
};
+static struct task **tasks;
+
static char *task_exec(char *opts)
{
FILE *f;
static char *task_exec(char *opts)
{
FILE *f;
@@
-126,6
+129,29
@@
static struct task **get_all_tasks()
return tasks;
}
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;
int main(int argc, char **argv)
{
GtkWidget *window;
@@
-134,7
+160,7
@@
int main(int argc, char **argv)
GtkTreeIter iter;
int i;
GtkTreeModel *model;
GtkTreeIter iter;
int i;
GtkTreeModel *model;
- struct task **tasks
, **tasks
_cur;
+ struct task **tasks_cur;
gtk_init(NULL, NULL);
builder = gtk_builder_new();
gtk_init(NULL, NULL);
builder = gtk_builder_new();
@@
-160,6
+186,9
@@
int main(int argc, char **argv)
-1);
}
-1);
}
+ g_signal_connect(treeview,
+ "cursor-changed", (GCallback)cursor_changed_cbk, tasks);
+
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(window);
g_object_unref(G_OBJECT(builder));
gtk_widget_show_all(window);