Added comment headers to functions
This commit is contained in:
parent
6a8cbccbfe
commit
ec7a072920
@ -11,7 +11,9 @@ enum {
|
|||||||
COL_COUNT
|
COL_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The dateFormats struct contains regex/date-info pairs to parse different date formats.
|
||||||
|
*/
|
||||||
struct dateFormats {
|
struct dateFormats {
|
||||||
gchar *regex;
|
gchar *regex;
|
||||||
guint index_count;
|
guint index_count;
|
||||||
@ -59,7 +61,7 @@ struct dateFormats {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tries to guess the date format used and converts it to GDateTime.
|
* @brief mainWindow_get_date_from_string tries to guess the date format used and converts it to GDateTime.
|
||||||
* @param Input string.
|
* @param Input string.
|
||||||
* @return A GDateTime object or NULL on error. You need to free it after use.
|
* @return A GDateTime object or NULL on error. You need to free it after use.
|
||||||
*/
|
*/
|
||||||
@ -113,7 +115,9 @@ static GDateTime *mainWindow_get_date_from_string(gchar *string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns: The string, needs to be freed using g_free().
|
* @brief mainWindow_taglist_to_string concatenates a list with commas
|
||||||
|
* @param list is a GList of strings to concatenate
|
||||||
|
* @return The string, it needs to be freed using g_free().
|
||||||
*/
|
*/
|
||||||
static gchar *mainWindow_taglist_to_string(GList *list)
|
static gchar *mainWindow_taglist_to_string(GList *list)
|
||||||
{
|
{
|
||||||
@ -136,7 +140,12 @@ static gchar *mainWindow_taglist_to_string(GList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: This function creates a copyof each argument.
|
* @brief mainWindow_list_add_entry adds a diary entry to the main store. All parameters are duplicated.
|
||||||
|
* @param mainWindow struct mainWindow *
|
||||||
|
* @param title entry title
|
||||||
|
* @param datetime entry date time
|
||||||
|
* @param tags string list of tags
|
||||||
|
* @param text MD source of the entry
|
||||||
*/
|
*/
|
||||||
static void mainWindow_list_add_entry(struct mainWindow *mainWindow,
|
static void mainWindow_list_add_entry(struct mainWindow *mainWindow,
|
||||||
gchar *title,
|
gchar *title,
|
||||||
@ -164,6 +173,13 @@ static void mainWindow_list_add_entry(struct mainWindow *mainWindow,
|
|||||||
g_free(date_text);
|
g_free(date_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_list_entry_visible checks whether the entry should be displayed.
|
||||||
|
* @param model N/A
|
||||||
|
* @param iter N/A
|
||||||
|
* @param mainWindow struct mainWindow *
|
||||||
|
* @return True when it should displayed, else false.
|
||||||
|
*/
|
||||||
static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter *iter, struct mainWindow *mainWindow)
|
static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter *iter, struct mainWindow *mainWindow)
|
||||||
{
|
{
|
||||||
GDateTime *datetime;
|
GDateTime *datetime;
|
||||||
@ -178,6 +194,14 @@ static gboolean mainWindow_list_entry_visible(GtkTreeModel *model, GtkTreeIter *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_sort_date_compare_func Compares the two GDateTimes from the main store.
|
||||||
|
* @param model N/A
|
||||||
|
* @param a N/A
|
||||||
|
* @param b N/A
|
||||||
|
* @param userdata N/A
|
||||||
|
* @return N/A
|
||||||
|
*/
|
||||||
static gint mainWindow_sort_date_compare_func(GtkTreeModel *model,
|
static gint mainWindow_sort_date_compare_func(GtkTreeModel *model,
|
||||||
GtkTreeIter *a,
|
GtkTreeIter *a,
|
||||||
GtkTreeIter *b,
|
GtkTreeIter *b,
|
||||||
@ -201,7 +225,10 @@ static gint mainWindow_sort_date_compare_func(GtkTreeModel *model,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_configure_treeView configures GtkTreeView
|
||||||
|
* @param mainWindow struct mainWindow *
|
||||||
|
*/
|
||||||
static void mainWindow_configure_treeView(struct mainWindow *mainWindow)
|
static void mainWindow_configure_treeView(struct mainWindow *mainWindow)
|
||||||
{
|
{
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
@ -281,6 +308,10 @@ static void mainWindow_configure_treeView(struct mainWindow *mainWindow)
|
|||||||
g_date_time_unref(dt);
|
g_date_time_unref(dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_connect_signals connects are g signals
|
||||||
|
* @param mainWindow struct mainWindow *
|
||||||
|
*/
|
||||||
static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
||||||
{
|
{
|
||||||
g_signal_connect(mainWindow->dateStart,
|
g_signal_connect(mainWindow->dateStart,
|
||||||
@ -329,6 +360,10 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
|||||||
mainWindow);
|
mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_new creates a new mainWindow.
|
||||||
|
* @return Returns struct mainWindow *
|
||||||
|
*/
|
||||||
struct mainWindow *mainWindow_new()
|
struct mainWindow *mainWindow_new()
|
||||||
{
|
{
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
@ -368,18 +403,29 @@ struct mainWindow *mainWindow_new()
|
|||||||
return mainWindow;
|
return mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_chooseWorkspaceClicked is called when the user clicks the Choose Workspace button.
|
||||||
|
* @param widget N/A
|
||||||
|
* @param event N/A
|
||||||
|
* @param user_data struct mainWindow *
|
||||||
|
*/
|
||||||
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
|
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
|
||||||
{
|
{
|
||||||
printf("Choose workspace.\n");
|
printf("Choose workspace.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_showPopover is called from a dateEntry when it is focused.
|
||||||
|
* @param widget is the text entry.
|
||||||
|
* @param event N/A
|
||||||
|
* @param user_data struct mainWindow *
|
||||||
|
*/
|
||||||
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
GDateTime *datetime;
|
GDateTime *datetime;
|
||||||
|
|
||||||
|
|
||||||
mainWindow->selectedDateEntry = NULL;
|
mainWindow->selectedDateEntry = NULL;
|
||||||
|
|
||||||
datetime = g_date_time_new_from_unix_local((widget == mainWindow->dateStart
|
datetime = g_date_time_new_from_unix_local((widget == mainWindow->dateStart
|
||||||
@ -402,6 +448,11 @@ void mainWindow_showPopover(GtkWidget *widget, GdkEvent *event, gpointer user_da
|
|||||||
gtk_popover_set_relative_to(GTK_POPOVER(mainWindow->popoverDate), widget);
|
gtk_popover_set_relative_to(GTK_POPOVER(mainWindow->popoverDate), widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_calendarSelected is the callback when the user selects a date in the calendar.
|
||||||
|
* @param widget is the calendar.
|
||||||
|
* @param user_data struct mainWindow *
|
||||||
|
*/
|
||||||
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
@ -416,6 +467,11 @@ void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_entrySelected is the callback when the user selects a diary entry.
|
||||||
|
* @param widget N/A
|
||||||
|
* @param user_data struct mainWindow *
|
||||||
|
*/
|
||||||
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
@ -466,6 +522,12 @@ void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data)
|
|||||||
gtk_tree_model_filter_refilter(mainWindow->entryListFiltered);
|
gtk_tree_model_filter_refilter(mainWindow->entryListFiltered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_checkDate checks the date in a text box and resets it if necessary.
|
||||||
|
* @param widget is the GtkEntry to be checked.
|
||||||
|
* @param event N/A
|
||||||
|
* @param user_data struct mainWindow *
|
||||||
|
*/
|
||||||
void mainWindow_checkDate(GtkWidget *widget, gint event, gpointer user_data)
|
void mainWindow_checkDate(GtkWidget *widget, gint event, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user