Now loading text to textBuffer

This commit is contained in:
Markus Koch 2017-02-03 20:05:49 +01:00
parent 0a5ba481bc
commit 7f296855d5
3 changed files with 6 additions and 6 deletions

View File

@ -2,9 +2,7 @@
<!-- Generated with glade 3.20.0 --> <!-- Generated with glade 3.20.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkTextBuffer" id="entryTextBuffer"> <object class="GtkTextBuffer" id="entryTextBuffer"/>
<property name="text" translatable="yes">Test text for debugging.</property>
</object>
<object class="GtkEntryCompletion" id="searchEntryCompletion"/> <object class="GtkEntryCompletion" id="searchEntryCompletion"/>
<object class="GtkApplicationWindow" id="mainWindow"> <object class="GtkApplicationWindow" id="mainWindow">
<property name="can_focus">False</property> <property name="can_focus">False</property>

View File

@ -343,6 +343,7 @@ struct mainWindow *mainWindow_new()
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange")); mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView")); mainWindow->entryListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "entryListView"));
mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection")); mainWindow->entryListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder, "entryListSelection"));
mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer"));
mainWindow->filterSettings.time_start = 0; mainWindow->filterSettings.time_start = 0;
mainWindow->filterSettings.time_end = -1; mainWindow->filterSettings.time_end = -1;
@ -358,7 +359,7 @@ struct mainWindow *mainWindow_new()
* These need to be set to oldest and newest after indexing date * These need to be set to oldest and newest after indexing date
*/ */
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), "2016-01-01"); gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), "2016-01-01");
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), "2017-01-01"); gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), "2018-01-01");
return mainWindow; return mainWindow;
} }
@ -421,8 +422,8 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
selection = gtk_tree_view_get_selection(mainWindow->entryListView); selection = gtk_tree_view_get_selection(mainWindow->entryListView);
if (gtk_tree_selection_get_selected(selection, &model, &iter)) { if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
gtk_tree_model_get(model, &iter, COL_TITLE, &temp, -1); gtk_tree_model_get(model, &iter, COL_TEXT, &temp, -1);
printf("Selected entry: %s\n", temp); gtk_text_buffer_set_text(mainWindow->textBuffer, temp, g_utf8_strlen(temp, -1));
fflush(stdout); fflush(stdout);
g_free(temp); g_free(temp);
} }

View File

@ -15,6 +15,7 @@ struct mainWindow {
GtkWidget *calendarRange; GtkWidget *calendarRange;
GtkTreeView *entryListView; GtkTreeView *entryListView;
GtkTreeSelection *entryListSelection; GtkTreeSelection *entryListSelection;
GtkTextBuffer *textBuffer;
GtkListStore *entryListStore; GtkListStore *entryListStore;
GtkWidget *selectedDateEntry; GtkWidget *selectedDateEntry;