Compare commits
2 Commits
2e1c1512be
...
c469d585e2
Author | SHA1 | Date | |
---|---|---|---|
c469d585e2 | |||
ac6cec66e9 |
@ -99,9 +99,9 @@ static void mainWindow_configure_treeView(struct mainWindow *mainWindow)
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeSortable *sortable;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeModelFilter *filtered;
|
||||
GtkTreeModelSort *sorted;
|
||||
GtkTreeModel *model;
|
||||
|
||||
mainWindow->entryListStore = gtk_list_store_new(COL_COUNT,
|
||||
G_TYPE_STRING,
|
||||
@ -184,6 +184,11 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
||||
"day-selected",
|
||||
(GCallback) mainWindow_calendarSelected,
|
||||
mainWindow);
|
||||
|
||||
g_signal_connect(mainWindow->entryListSelection,
|
||||
"changed",
|
||||
(GCallback) mainWindow_entrySelected,
|
||||
mainWindow);
|
||||
}
|
||||
|
||||
struct mainWindow *mainWindow_new()
|
||||
@ -203,6 +208,7 @@ struct mainWindow *mainWindow_new()
|
||||
mainWindow->popoverDate = GTK_WIDGET(gtk_builder_get_object(builder, "popoverDate"));
|
||||
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
|
||||
mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView"));
|
||||
mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection"));
|
||||
|
||||
gtk_builder_connect_signals(builder, NULL);
|
||||
|
||||
@ -244,3 +250,20 @@ void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
||||
|
||||
gtk_popover_popdown(GTK_POPOVER(mainWindow->popoverDate));
|
||||
}
|
||||
|
||||
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
gchar *temp;
|
||||
|
||||
selection = gtk_tree_view_get_selection(mainWindow->entryListView);
|
||||
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
||||
gtk_tree_model_get(model, &iter, COL_TITLE, &temp, -1);
|
||||
printf("Selected entry: %s\n", temp);
|
||||
fflush(stdout);
|
||||
g_free(temp);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ struct mainWindow {
|
||||
GtkWidget *popoverDate;
|
||||
GtkWidget *calendarRange;
|
||||
GtkTreeView *entryListView;
|
||||
GtkTreeSelection *entryListSelection;
|
||||
|
||||
GtkListStore *entryListStore;
|
||||
GtkWidget *selectedDateEntry;
|
||||
@ -25,5 +26,6 @@ struct mainWindow *mainWindow_new();
|
||||
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data);
|
||||
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data);
|
||||
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data);
|
||||
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);
|
||||
|
||||
#endif /* MAINWINDOW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user