Compare commits
3 Commits
a3c4b3164d
...
57623e464e
Author | SHA1 | Date | |
---|---|---|---|
57623e464e | |||
fe1e6b8f35 | |||
d42a0ffc2e |
@ -48,10 +48,12 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkCheckButton" id="checkSearchTitle">
|
||||||
|
<property name="label" translatable="yes">Title</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="label" translatable="yes">search in: </property>
|
<property name="receives_default">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -60,8 +62,8 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="checkSearchTitle">
|
<object class="GtkCheckButton" id="checkSearchSummary">
|
||||||
<property name="label" translatable="yes">Title</property>
|
<property name="label" translatable="yes">Summary</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
@ -169,6 +171,30 @@
|
|||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="buttonClearSearch">
|
||||||
|
<property name="label" translatable="yes">View all</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="resize">False</property>
|
<property name="resize">False</property>
|
||||||
@ -208,22 +234,80 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<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="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="editable">False</property>
|
<property name="shadow_type">in</property>
|
||||||
<property name="wrap_mode">word-char</property>
|
<child>
|
||||||
<property name="left_margin">4</property>
|
<object class="GtkTextView" id="entryText">
|
||||||
<property name="right_margin">4</property>
|
<property name="visible">True</property>
|
||||||
<property name="top_margin">4</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="bottom_margin">4</property>
|
<property name="editable">False</property>
|
||||||
<property name="buffer">entryTextBuffer</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>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -41,6 +41,13 @@ static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter *
|
|||||||
search_matched = 1;
|
search_matched = 1;
|
||||||
g_free(temp);
|
g_free(temp);
|
||||||
|
|
||||||
|
gtk_tree_model_get(model, iter, COL_SUMMARY, &temp, -1);
|
||||||
|
if (!search_matched &&
|
||||||
|
mainWindow->filterSettings.search_summary &&
|
||||||
|
g_regex_match(regex, temp, 0, &match_info) && g_match_info_matches(match_info))
|
||||||
|
search_matched = 1;
|
||||||
|
g_free(temp);
|
||||||
|
|
||||||
gtk_tree_model_get(model, iter, COL_TEXT, &temp, -1);
|
gtk_tree_model_get(model, iter, COL_TEXT, &temp, -1);
|
||||||
if (!search_matched &&
|
if (!search_matched &&
|
||||||
mainWindow->filterSettings.search_text &&
|
mainWindow->filterSettings.search_text &&
|
||||||
@ -218,6 +225,27 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
|||||||
"toggled",
|
"toggled",
|
||||||
(GCallback) mainWindow_filterChanged,
|
(GCallback) mainWindow_filterChanged,
|
||||||
mainWindow);
|
mainWindow);
|
||||||
|
g_signal_connect(mainWindow->checkSearchSummary,
|
||||||
|
"toggled",
|
||||||
|
(GCallback) mainWindow_filterChanged,
|
||||||
|
mainWindow);
|
||||||
|
|
||||||
|
g_signal_connect(mainWindow->buttonClearSearch,
|
||||||
|
"clicked",
|
||||||
|
(GCallback) mainWindow_clearSearch,
|
||||||
|
mainWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_init_to_default initializes all non-date related UI elements to sensible values.
|
||||||
|
* @param mainWindow
|
||||||
|
*/
|
||||||
|
static void mainWindow_init_to_default(struct mainWindow *mainWindow)
|
||||||
|
{
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchTitle), 1);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchSummary), 1);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchTags), 1);
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -241,8 +269,11 @@ struct mainWindow *mainWindow_new()
|
|||||||
mainWindow->popoverDate = GTK_WIDGET(gtk_builder_get_object(builder, "popoverDate"));
|
mainWindow->popoverDate = GTK_WIDGET(gtk_builder_get_object(builder, "popoverDate"));
|
||||||
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
|
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
|
||||||
mainWindow->checkSearchTitle = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTitle"));
|
mainWindow->checkSearchTitle = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTitle"));
|
||||||
|
mainWindow->checkSearchSummary = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchSummary"));
|
||||||
mainWindow->checkSearchTags = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTags"));
|
mainWindow->checkSearchTags = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTags"));
|
||||||
mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText"));
|
mainWindow->checkSearchText = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchText"));
|
||||||
|
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
|
||||||
|
mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch"));
|
||||||
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->textBuffer = GTK_TEXT_BUFFER(gtk_builder_get_object(builder, "entryTextBuffer"));
|
||||||
@ -257,15 +288,9 @@ struct mainWindow *mainWindow_new()
|
|||||||
mainWindow_configure_treeView(mainWindow);
|
mainWindow_configure_treeView(mainWindow);
|
||||||
mainWindow_connect_signals(mainWindow);
|
mainWindow_connect_signals(mainWindow);
|
||||||
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchTitle), 1);
|
mainWindow_init_to_default(mainWindow);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchTags), 1);
|
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0);
|
|
||||||
|
|
||||||
/**
|
mainWindow_clearSearch(NULL, mainWindow);
|
||||||
* 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), "2018-01-01");
|
|
||||||
|
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
}
|
}
|
||||||
@ -345,14 +370,27 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
|||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
gchar *text;
|
||||||
|
gchar *title;
|
||||||
|
gchar *summary;
|
||||||
gchar *temp;
|
gchar *temp;
|
||||||
|
|
||||||
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_TEXT, &temp, -1);
|
gtk_tree_model_get(model, &iter, COL_TEXT, &text, -1);
|
||||||
gtk_text_buffer_set_text(mainWindow->textBuffer, temp, g_utf8_strlen(temp, -1));
|
gtk_text_buffer_set_text(mainWindow->textBuffer, text, g_utf8_strlen(text, -1));
|
||||||
fflush(stdout);
|
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);
|
g_free(temp);
|
||||||
|
} else {
|
||||||
|
gtk_text_buffer_set_text(mainWindow->textBuffer, "", 0);
|
||||||
|
gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "Please select an entry in the list above.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,12 +421,14 @@ void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow->filterSettings.search_title = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
mainWindow->filterSettings.search_title = gtk_toggle_button_get_active(
|
||||||
mainWindow->checkSearchTitle));
|
GTK_TOGGLE_BUTTON(mainWindow->checkSearchTitle));
|
||||||
mainWindow->filterSettings.search_tags = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
mainWindow->filterSettings.search_tags = gtk_toggle_button_get_active(
|
||||||
mainWindow->checkSearchTags));
|
GTK_TOGGLE_BUTTON(mainWindow->checkSearchTags));
|
||||||
mainWindow->filterSettings.search_text = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
mainWindow->filterSettings.search_text = gtk_toggle_button_get_active(
|
||||||
mainWindow->checkSearchText));
|
GTK_TOGGLE_BUTTON(mainWindow->checkSearchText));
|
||||||
|
mainWindow->filterSettings.search_summary = gtk_toggle_button_get_active(
|
||||||
|
GTK_TOGGLE_BUTTON(mainWindow->checkSearchSummary));
|
||||||
|
|
||||||
gtk_tree_model_filter_refilter(mainWindow->entryListFiltered);
|
gtk_tree_model_filter_refilter(mainWindow->entryListFiltered);
|
||||||
}
|
}
|
||||||
@ -414,3 +454,22 @@ void mainWindow_checkDate(GtkWidget *widget, gint event, gpointer user_data)
|
|||||||
}
|
}
|
||||||
g_date_time_unref(datetime);
|
g_date_time_unref(datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_clearSearch resets all search UI elements
|
||||||
|
* @param widget
|
||||||
|
* @param event
|
||||||
|
* @param user_data
|
||||||
|
*/
|
||||||
|
void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data)
|
||||||
|
{
|
||||||
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
|
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->searchEntry), "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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), "2018-01-01");
|
||||||
|
}
|
||||||
|
@ -15,8 +15,11 @@ struct mainWindow {
|
|||||||
GtkWidget *popoverDate;
|
GtkWidget *popoverDate;
|
||||||
GtkWidget *calendarRange;
|
GtkWidget *calendarRange;
|
||||||
GtkWidget *checkSearchTitle;
|
GtkWidget *checkSearchTitle;
|
||||||
|
GtkWidget *checkSearchSummary;
|
||||||
GtkWidget *checkSearchTags;
|
GtkWidget *checkSearchTags;
|
||||||
GtkWidget *checkSearchText;
|
GtkWidget *checkSearchText;
|
||||||
|
GtkWidget *labelSummary;
|
||||||
|
GtkWidget *buttonClearSearch;
|
||||||
GtkTreeView *entryListView;
|
GtkTreeView *entryListView;
|
||||||
GtkTreeSelection *entryListSelection;
|
GtkTreeSelection *entryListSelection;
|
||||||
GtkTextBuffer *textBuffer;
|
GtkTextBuffer *textBuffer;
|
||||||
@ -30,6 +33,7 @@ struct mainWindow {
|
|||||||
guint time_end;
|
guint time_end;
|
||||||
gboolean search_title;
|
gboolean search_title;
|
||||||
gboolean search_tags;
|
gboolean search_tags;
|
||||||
|
gboolean search_summary;
|
||||||
gboolean search_text;
|
gboolean search_text;
|
||||||
} filterSettings;
|
} filterSettings;
|
||||||
};
|
};
|
||||||
@ -39,6 +43,7 @@ struct mainWindow *mainWindow_new();
|
|||||||
/* Slots */
|
/* Slots */
|
||||||
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data);
|
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data);
|
||||||
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data);
|
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data);
|
||||||
|
void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data);
|
||||||
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data);
|
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data);
|
||||||
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);
|
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);
|
||||||
void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data);
|
void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data);
|
||||||
|
Loading…
Reference in New Issue
Block a user