Added Title/Summary header
This commit is contained in:
parent
a3c4b3164d
commit
d42a0ffc2e
@ -208,22 +208,80 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="entryText">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">4</property>
|
||||
<property name="margin_right">4</property>
|
||||
<property name="margin_top">2</property>
|
||||
<property name="margin_bottom">2</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="labelSummary">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Please select an entry in the list above.</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<attributes>
|
||||
<attribute name="scale" value="1.3999999999999999"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<property name="left_margin">4</property>
|
||||
<property name="right_margin">4</property>
|
||||
<property name="top_margin">4</property>
|
||||
<property name="bottom_margin">4</property>
|
||||
<property name="buffer">entryTextBuffer</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="entryText">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">word-char</property>
|
||||
<property name="left_margin">4</property>
|
||||
<property name="right_margin">4</property>
|
||||
<property name="top_margin">4</property>
|
||||
<property name="bottom_margin">4</property>
|
||||
<property name="buffer">entryTextBuffer</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
@ -243,6 +243,7 @@ struct mainWindow *mainWindow_new()
|
||||
mainWindow->checkSearchTitle = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTitle"));
|
||||
mainWindow->checkSearchTags = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTags"));
|
||||
mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText"));
|
||||
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
|
||||
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"));
|
||||
@ -345,14 +346,27 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
gchar *text;
|
||||
gchar *title;
|
||||
gchar *summary;
|
||||
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_TEXT, &temp, -1);
|
||||
gtk_text_buffer_set_text(mainWindow->textBuffer, temp, g_utf8_strlen(temp, -1));
|
||||
fflush(stdout);
|
||||
gtk_tree_model_get(model, &iter, COL_TEXT, &text, -1);
|
||||
gtk_text_buffer_set_text(mainWindow->textBuffer, text, g_utf8_strlen(text, -1));
|
||||
g_free(text);
|
||||
|
||||
gtk_tree_model_get(model, &iter, COL_SUMMARY, &summary, -1);
|
||||
gtk_tree_model_get(model, &iter, COL_TITLE, &title, -1);
|
||||
temp = g_strdup_printf("<b>%s</b>: %s", title, summary);
|
||||
gtk_label_set_markup(GTK_LABEL(mainWindow->labelSummary), temp);
|
||||
g_free(title);
|
||||
g_free(summary);
|
||||
g_free(temp);
|
||||
} else {
|
||||
gtk_text_buffer_set_text(mainWindow->textBuffer, "", 0);
|
||||
gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ struct mainWindow {
|
||||
GtkWidget *checkSearchTitle;
|
||||
GtkWidget *checkSearchTags;
|
||||
GtkWidget *checkSearchText;
|
||||
GtkWidget *labelSummary;
|
||||
GtkTreeView *entryListView;
|
||||
GtkTreeSelection *entryListSelection;
|
||||
GtkTextBuffer *textBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user