Implemented link on to label to set both days at the same time
This commit is contained in:
parent
a6bb0234f7
commit
e6bba9f0ee
@ -209,7 +209,8 @@
|
|||||||
<object class="GtkLabel" id="label_date_to_date">
|
<object class="GtkLabel" id="label_date_to_date">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">to</property>
|
<property name="label" translatable="yes"><a href="">to</a></property>
|
||||||
|
<property name="use_markup">True</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -22,7 +22,7 @@ int main(int argc, char *argv[])
|
|||||||
gtk_widget_show(mainWindow->mainWindow);
|
gtk_widget_show(mainWindow->mainWindow);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
|
|
||||||
mdiary_save_settings(settings_path, settings);
|
mdiary_save_settings(settings_path, settings); //
|
||||||
mdiary_settings_free(settings);
|
mdiary_settings_free(settings);
|
||||||
g_free(settings_path);
|
g_free(settings_path);
|
||||||
|
|
||||||
|
@ -322,6 +322,10 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
|||||||
"focus-in-event",
|
"focus-in-event",
|
||||||
(GCallback) mainWindow_showPopover,
|
(GCallback) mainWindow_showPopover,
|
||||||
mainWindow);
|
mainWindow);
|
||||||
|
g_signal_connect(mainWindow->labelDateToDate,
|
||||||
|
"activate-link",
|
||||||
|
(GCallback) mainWindow_showPopover,
|
||||||
|
mainWindow);
|
||||||
g_signal_connect(mainWindow->calendarRange,
|
g_signal_connect(mainWindow->calendarRange,
|
||||||
"day-selected",
|
"day-selected",
|
||||||
(GCallback) mainWindow_calendarSelected,
|
(GCallback) mainWindow_calendarSelected,
|
||||||
@ -443,6 +447,7 @@ struct mainWindow *mainWindow_new()
|
|||||||
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
|
mainWindow->labelSummary = GTK_WIDGET(gtk_builder_get_object(builder, "labelSummary"));
|
||||||
mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch"));
|
mainWindow->buttonClearSearch = GTK_WIDGET(gtk_builder_get_object(builder, "buttonClearSearch"));
|
||||||
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
|
mainWindow->headerBar = GTK_WIDGET(gtk_builder_get_object(builder, "headerBar"));
|
||||||
|
mainWindow->labelDateToDate = GTK_WIDGET(gtk_builder_get_object(builder, "label_date_to_date"));
|
||||||
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"));
|
||||||
@ -538,12 +543,15 @@ void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
|||||||
guint year, month, day;
|
guint year, month, day;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
if (mainWindow->selectedDateEntry) {
|
|
||||||
gtk_calendar_get_date(GTK_CALENDAR(mainWindow->calendarRange), &year, &month, &day);
|
gtk_calendar_get_date(GTK_CALENDAR(mainWindow->calendarRange), &year, &month, &day);
|
||||||
text = g_strdup_printf("%d-%02d-%02d", year, month + 1, day);
|
text = g_strdup_printf("%d-%02d-%02d", year, month + 1, day);
|
||||||
|
if (mainWindow->selectedDateEntry == mainWindow->labelDateToDate) {
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), text);
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), text);
|
||||||
|
} else if (mainWindow->selectedDateEntry) {
|
||||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->selectedDateEntry), text);
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->selectedDateEntry), text);
|
||||||
g_free(text);
|
|
||||||
}
|
}
|
||||||
|
g_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,6 +30,7 @@ struct mainWindow {
|
|||||||
GtkWidget *labelSummary;
|
GtkWidget *labelSummary;
|
||||||
GtkWidget *buttonClearSearch;
|
GtkWidget *buttonClearSearch;
|
||||||
GtkWidget *headerBar;
|
GtkWidget *headerBar;
|
||||||
|
GtkWidget *labelDateToDate;
|
||||||
GtkTreeView *entryListView;
|
GtkTreeView *entryListView;
|
||||||
GtkTreeSelection *entryListSelection;
|
GtkTreeSelection *entryListSelection;
|
||||||
GtkTextBuffer *textBuffer;
|
GtkTextBuffer *textBuffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user