Browse Source

Now loading text to textBuffer

newfile
Markus Koch 5 years ago
parent
commit
7f296855d5
  1. 4
      glade/mainWindow.glade
  2. 7
      src/mainwindow.c
  3. 1
      src/mainwindow.h

4
glade/mainWindow.glade

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

7
src/mainwindow.c

@ -343,6 +343,7 @@ struct mainWindow *mainWindow_new()
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"));
mainWindow->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer"));
mainWindow->filterSettings.time_start = 0;
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
*/
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;
}
@ -421,8 +422,8 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
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);
gtk_tree_model_get(model, &iter, COL_TEXT, &temp, -1);
gtk_text_buffer_set_text(mainWindow->textBuffer, temp, g_utf8_strlen(temp, -1));
fflush(stdout);
g_free(temp);
}

1
src/mainwindow.h

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

Loading…
Cancel
Save