Compare commits
4 Commits
b7e98db42b
...
f8d3bb8730
Author | SHA1 | Date | |
---|---|---|---|
f8d3bb8730 | |||
5fd6f339d3 | |||
2b81a67087 | |||
538b2c54d9 |
@ -2,7 +2,72 @@
|
|||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
|
<object class="GtkFileChooserWidget" id="chooseDirectoryDialog">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="action">select-folder</property>
|
||||||
|
</object>
|
||||||
<object class="GtkTextBuffer" id="entryTextBuffer"/>
|
<object class="GtkTextBuffer" id="entryTextBuffer"/>
|
||||||
|
<object class="GtkPopover" id="popoverWorkspace">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">8</property>
|
||||||
|
<property name="margin_right">8</property>
|
||||||
|
<property name="margin_top">8</property>
|
||||||
|
<property name="margin_bottom">8</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<property name="spacing">8</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSearchEntry" id="searchWorkspace">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="primary_icon_name">edit-find-symbolic</property>
|
||||||
|
<property name="primary_icon_activatable">False</property>
|
||||||
|
<property name="primary_icon_sensitive">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="treeWorkspace">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="headers_visible">False</property>
|
||||||
|
<property name="hover_selection">True</property>
|
||||||
|
<property name="enable_grid_lines">horizontal</property>
|
||||||
|
<property name="activate_on_single_click">True</property>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection" id="treeWorkspaceSelection"/>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="buttonOtherWorkspace">
|
||||||
|
<property name="label" translatable="yes">Other Workspaces ...</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">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkEntryCompletion" id="searchEntryCompletion"/>
|
<object class="GtkEntryCompletion" id="searchEntryCompletion"/>
|
||||||
<object class="GtkApplicationWindow" id="mainWindow">
|
<object class="GtkApplicationWindow" id="mainWindow">
|
||||||
<property name="width_request">720</property>
|
<property name="width_request">720</property>
|
||||||
@ -132,7 +197,6 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="max_length">10</property>
|
<property name="max_length">10</property>
|
||||||
<property name="width_chars">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>
|
<property name="secondary_icon_tooltip_text" translatable="yes">fg</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
@ -159,7 +223,6 @@
|
|||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="max_length">10</property>
|
<property name="max_length">10</property>
|
||||||
<property name="width_chars">10</property>
|
<property name="width_chars">10</property>
|
||||||
<property name="secondary_icon_stock">gtk-clear</property>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
@ -339,12 +402,42 @@
|
|||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="spacing">4</property>
|
<property name="spacing">4</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="buttonChooseWorkspace">
|
<object class="GtkMenuButton">
|
||||||
<property name="label" translatable="yes">Choose workspace</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">True</property>
|
<property name="receives_default">True</property>
|
||||||
<signal name="clicked" handler="mainWindow_chooseWorkspaceClicked" swapped="no"/>
|
<property name="popover">popoverWorkspace</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="spacing">2</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Choose Workspace</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkImage">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="icon_name">pan-down-symbolic</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -102,6 +102,45 @@ static gint mainWindow_sort_date_compare_func(GtkTreeModel *model,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief mainWindow_wschooser_configure_treeView configures the GtkTreeView for workspace selection
|
||||||
|
* @param mainWindow
|
||||||
|
*/
|
||||||
|
static void mainWindow_configure_workspaceTreeView(struct mainWindow *mainWindow)
|
||||||
|
{
|
||||||
|
GtkCellRenderer *renderer;
|
||||||
|
GtkTreeViewColumn *col;
|
||||||
|
|
||||||
|
mainWindow->workspaceListStore = gtk_list_store_new(1, G_TYPE_STRING);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO:
|
||||||
|
* gtk_tree_model_filter_set_visible_func(mainWindow->workspaceListStore,
|
||||||
|
* (GtkTreeModelFilterVisibleFunc) mainWindow_list_entry_visible,
|
||||||
|
* mainWindow, NULL);
|
||||||
|
*/
|
||||||
|
|
||||||
|
gtk_tree_view_set_model(mainWindow->workspaceListView, GTK_TREE_MODEL(mainWindow->workspaceListStore));
|
||||||
|
|
||||||
|
renderer = gtk_cell_renderer_text_new();
|
||||||
|
gtk_tree_view_insert_column_with_attributes(mainWindow->workspaceListView, -1, "", renderer,
|
||||||
|
"markup", 0, NULL);
|
||||||
|
|
||||||
|
/* Test entry for debugging */
|
||||||
|
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
gtk_list_store_append(mainWindow->workspaceListStore, &iter);
|
||||||
|
gtk_list_store_set(mainWindow->workspaceListStore, &iter,
|
||||||
|
0, "<b>testworkspace</b>\n\n<span weight=\"ultralight\">/home/user/Documents</span>",
|
||||||
|
-1);
|
||||||
|
gtk_list_store_append(mainWindow->workspaceListStore, &iter);
|
||||||
|
gtk_list_store_set(mainWindow->workspaceListStore, &iter,
|
||||||
|
0, "<b>testworkspace</b>\n\n<span weight=\"ultralight\">/home/user/Documents</span>",
|
||||||
|
-1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mainWindow_configure_treeView configures GtkTreeView
|
* @brief mainWindow_configure_treeView configures GtkTreeView
|
||||||
* @param mainWindow struct mainWindow *
|
* @param mainWindow struct mainWindow *
|
||||||
@ -245,6 +284,15 @@ static void mainWindow_connect_signals(struct mainWindow *mainWindow)
|
|||||||
"icon-press",
|
"icon-press",
|
||||||
(GCallback) mainWindow_dateIconPress,
|
(GCallback) mainWindow_dateIconPress,
|
||||||
mainWindow);
|
mainWindow);
|
||||||
|
|
||||||
|
g_signal_connect(mainWindow->buttonOtherWorkspace,
|
||||||
|
"clicked",
|
||||||
|
(GCallback) mainWindow_otherWorkspaceClicked,
|
||||||
|
mainWindow);
|
||||||
|
g_signal_connect(mainWindow->workspaceListView,
|
||||||
|
"row-activated",
|
||||||
|
(GCallback) mainWindow_workspaceListClicked,
|
||||||
|
mainWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -272,7 +320,6 @@ struct mainWindow *mainWindow_new()
|
|||||||
|
|
||||||
mainWindow = malloc(sizeof(struct mainWindow));
|
mainWindow = malloc(sizeof(struct mainWindow));
|
||||||
mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow"));
|
mainWindow->mainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "mainWindow"));
|
||||||
mainWindow->buttonChooseWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "buttonChooseWorkspace"));
|
|
||||||
mainWindow->searchEntry = GTK_WIDGET(gtk_builder_get_object(builder, "searchEntry"));
|
mainWindow->searchEntry = GTK_WIDGET(gtk_builder_get_object(builder, "searchEntry"));
|
||||||
mainWindow->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart"));
|
mainWindow->dateStart = GTK_WIDGET(gtk_builder_get_object(builder, "dateStart"));
|
||||||
mainWindow->dateEnd = GTK_WIDGET(gtk_builder_get_object(builder, "dateEnd"));
|
mainWindow->dateEnd = GTK_WIDGET(gtk_builder_get_object(builder, "dateEnd"));
|
||||||
@ -289,6 +336,13 @@ struct mainWindow *mainWindow_new()
|
|||||||
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"));
|
||||||
|
|
||||||
|
mainWindow->buttonOtherWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "buttonOtherWorkspace"));
|
||||||
|
mainWindow->searchWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "searchWorkspace"));
|
||||||
|
mainWindow->popoverWorkspace = GTK_WIDGET(gtk_builder_get_object(builder, "popoverWorkspace"));
|
||||||
|
mainWindow->workspaceListView = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeWorkspace"));
|
||||||
|
mainWindow->workspaceListSelection = GTK_TREE_SELECTION(gtk_builder_get_object(builder,
|
||||||
|
"treeWorkspaceSelection"));
|
||||||
|
|
||||||
mainWindow->filterSettings.time_start = 0;
|
mainWindow->filterSettings.time_start = 0;
|
||||||
mainWindow->filterSettings.time_end = -1;
|
mainWindow->filterSettings.time_end = -1;
|
||||||
mainWindow->time_earliest = 0;
|
mainWindow->time_earliest = 0;
|
||||||
@ -300,9 +354,8 @@ struct mainWindow *mainWindow_new()
|
|||||||
|
|
||||||
mainWindow_configure_treeView(mainWindow);
|
mainWindow_configure_treeView(mainWindow);
|
||||||
mainWindow_connect_signals(mainWindow);
|
mainWindow_connect_signals(mainWindow);
|
||||||
|
mainWindow_configure_workspaceTreeView(mainWindow);
|
||||||
mainWindow_init_to_default(mainWindow);
|
mainWindow_init_to_default(mainWindow);
|
||||||
|
|
||||||
mainWindow_clearSearch(NULL, mainWindow);
|
mainWindow_clearSearch(NULL, mainWindow);
|
||||||
|
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
@ -323,15 +376,14 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mainWindow_chooseWorkspaceClicked is called when the user clicks the Choose Workspace button.
|
* @brief mainWindow_otherWorkspaceClicked is called when the user clicks the Other Workspace button.
|
||||||
* @param widget N/A
|
* @param widget N/A
|
||||||
* @param event N/A
|
* @param event N/A
|
||||||
* @param user_data struct mainWindow *
|
* @param user_data struct mainWindow *
|
||||||
*/
|
*/
|
||||||
void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
|
void mainWindow_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
|
||||||
{
|
{
|
||||||
printf("Choose workspace.\n");
|
g_print("TODO: Show directory browser dialog.\n");
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -438,6 +490,9 @@ void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data)
|
|||||||
mainWindow->filterSettings.time_start = g_date_time_to_unix(datetime);
|
mainWindow->filterSettings.time_start = g_date_time_to_unix(datetime);
|
||||||
g_date_time_unref(datetime);
|
g_date_time_unref(datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget ? widget : mainWindow->dateStart),
|
||||||
|
GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic");
|
||||||
}
|
}
|
||||||
if (!widget || widget == mainWindow->dateEnd) {
|
if (!widget || widget == mainWindow->dateEnd) {
|
||||||
datetime = mdiary_get_date_from_string((gchar *)gtk_entry_get_text(
|
datetime = mdiary_get_date_from_string((gchar *)gtk_entry_get_text(
|
||||||
@ -446,6 +501,9 @@ void mainWindow_filterChanged(GtkWidget *widget, gpointer user_data)
|
|||||||
mainWindow->filterSettings.time_end = g_date_time_to_unix(datetime);
|
mainWindow->filterSettings.time_end = g_date_time_to_unix(datetime);
|
||||||
g_date_time_unref(datetime);
|
g_date_time_unref(datetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget ? widget : mainWindow->dateStart),
|
||||||
|
GTK_ENTRY_ICON_SECONDARY, "edit-clear-symbolic");
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow->filterSettings.search_title = gtk_toggle_button_get_active(
|
mainWindow->filterSettings.search_title = gtk_toggle_button_get_active(
|
||||||
@ -506,6 +564,8 @@ void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data)
|
|||||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), temp);
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateStart), temp);
|
||||||
g_date_time_unref(datetime);
|
g_date_time_unref(datetime);
|
||||||
g_free(temp);
|
g_free(temp);
|
||||||
|
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget ? widget : mainWindow->dateStart),
|
||||||
|
GTK_ENTRY_ICON_SECONDARY, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!widget || widget == mainWindow->dateEnd) {
|
if (!widget || widget == mainWindow->dateEnd) {
|
||||||
@ -514,6 +574,8 @@ void mainWindow_clearSearch(GtkWidget *widget, gpointer user_data)
|
|||||||
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), temp);
|
gtk_entry_set_text(GTK_ENTRY(mainWindow->dateEnd), temp);
|
||||||
g_date_time_unref(datetime);
|
g_date_time_unref(datetime);
|
||||||
g_free(temp);
|
g_free(temp);
|
||||||
|
gtk_entry_set_icon_from_icon_name(GTK_ENTRY(widget ? widget : mainWindow->dateEnd),
|
||||||
|
GTK_ENTRY_ICON_SECONDARY, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,3 +583,14 @@ void mainWindow_dateIconPress(GtkWidget *widget, gint icon_pos, gint event, gpoi
|
|||||||
{
|
{
|
||||||
mainWindow_clearSearch(widget, user_data);
|
mainWindow_clearSearch(widget, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mainWindow_workspaceListClicked(GtkWidget *widget,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
struct mainWindow *mainWindow = (struct mainWindow *)user_data;
|
||||||
|
|
||||||
|
gtk_popover_popdown(GTK_POPOVER(mainWindow->popoverWorkspace));
|
||||||
|
g_print("TODO: Workspace list clicked.\n");
|
||||||
|
}
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
struct mainWindow {
|
struct mainWindow {
|
||||||
GtkWidget *mainWindow;
|
GtkWidget *mainWindow;
|
||||||
GtkWidget *buttonChooseWorkspace;
|
|
||||||
GtkWidget *searchEntry;
|
GtkWidget *searchEntry;
|
||||||
GtkWidget *dateStart;
|
GtkWidget *dateStart;
|
||||||
GtkWidget *dateEnd;
|
GtkWidget *dateEnd;
|
||||||
@ -40,6 +39,13 @@ struct mainWindow {
|
|||||||
gboolean search_summary;
|
gboolean search_summary;
|
||||||
gboolean search_text;
|
gboolean search_text;
|
||||||
} filterSettings;
|
} filterSettings;
|
||||||
|
|
||||||
|
GtkWidget *buttonOtherWorkspace;
|
||||||
|
GtkWidget *searchWorkspace;
|
||||||
|
GtkWidget *popoverWorkspace;
|
||||||
|
GtkTreeView *workspaceListView;
|
||||||
|
GtkTreeSelection *workspaceListSelection;
|
||||||
|
GtkListStore *workspaceListStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mainWindow *mainWindow_new();
|
struct mainWindow *mainWindow_new();
|
||||||
@ -47,7 +53,11 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
|
|||||||
|
|
||||||
/* 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_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data);
|
||||||
|
void mainWindow_workspaceListClicked(GtkWidget *widget,
|
||||||
|
GtkTreePath *path,
|
||||||
|
GtkTreeViewColumn *column,
|
||||||
|
gpointer user_data);
|
||||||
void mainWindow_clearSearch(GtkWidget *widget, 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);
|
||||||
|
@ -436,7 +436,7 @@ void mdiary_add_entry_to_store(GtkListStore *entryListStore,
|
|||||||
|
|
||||||
gtk_list_store_append(entryListStore, &iter);
|
gtk_list_store_append(entryListStore, &iter);
|
||||||
gtk_list_store_set(entryListStore, &iter,
|
gtk_list_store_set(entryListStore, &iter,
|
||||||
COL_TITLE, g_strdup(title),
|
COL_TITLE, title,
|
||||||
COL_DATE_TEXT, date_text,
|
COL_DATE_TEXT, date_text,
|
||||||
COL_TAGS_TEXT, taglistString,
|
COL_TAGS_TEXT, taglistString,
|
||||||
COL_TIMESTAMP, datetime_copy,
|
COL_TIMESTAMP, datetime_copy,
|
||||||
|
Loading…
Reference in New Issue
Block a user