Added individual clear icons for the date entries
This commit is contained in:
parent
5fdc302820
commit
ae87f0cfa1
@ -132,6 +132,8 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="max_length">10</property>
|
||||
<property name="width_chars">10</property>
|
||||
<property name="secondary_icon_stock">gtk-clear</property>
|
||||
<property name="secondary_icon_tooltip_text" translatable="yes">fg</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
@ -157,6 +159,7 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="max_length">10</property>
|
||||
<property name="width_chars">10</property>
|
||||
<property name="secondary_icon_stock">gtk-clear</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
|
@ -236,6 +236,15 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
||||
"clicked",
|
||||
(GCallback) mainWindow_clearSearch,
|
||||
mainWindow);
|
||||
|
||||
g_signal_connect(mainWindow->dateStart,
|
||||
"icon-press",
|
||||
(GCallback) mainWindow_dateIconPress,
|
||||
mainWindow);
|
||||
g_signal_connect(mainWindow->dateEnd,
|
||||
"icon-press",
|
||||
(GCallback) mainWindow_dateIconPress,
|
||||
mainWindow);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -485,17 +494,30 @@ void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data)
|
||||
GDateTime *datetime;
|
||||
gchar *temp;
|
||||
|
||||
if (widget == mainWindow->buttonClearSearch)
|
||||
widget = NULL;
|
||||
|
||||
if (!widget || widget == mainWindow->searchEntry)
|
||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->searchEntry), "");
|
||||
|
||||
if (!widget || widget == mainWindow->dateStart) {
|
||||
datetime = g_date_time_new_from_unix_local(mainWindow->time_earliest);
|
||||
temp = g_date_time_format(datetime, "%Y-%m-%d");
|
||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), temp);
|
||||
g_date_time_unref(datetime);
|
||||
g_free(temp);
|
||||
}
|
||||
|
||||
if (!widget || widget == mainWindow->dateEnd) {
|
||||
datetime = g_date_time_new_from_unix_local(mainWindow->time_latest);
|
||||
temp = g_date_time_format(datetime, "%Y-%m-%d");
|
||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), temp);
|
||||
g_date_time_unref(datetime);
|
||||
g_free(temp);
|
||||
}
|
||||
}
|
||||
|
||||
void mainWindow_dateIconPress(GtkWidget *widget, gint icon_pos, gint event, gpointer user_data)
|
||||
{
|
||||
mainWindow_clearSearch(widget, user_data);
|
||||
}
|
||||
|
@ -53,5 +53,6 @@ void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data);
|
||||
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data);
|
||||
void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data);
|
||||
void mainWindow_checkDate(GtkWidget *widget, gint event, gpointer user_data);
|
||||
void mainWindow_dateIconPress(GtkWidget *widget, gint icon_pos, gint event, gpointer user_data);
|
||||
|
||||
#endif /* MAINWINDOW_H */
|
||||
|
Loading…
Reference in New Issue
Block a user