Compare commits

..

No commits in common. "f8d3bb8730986045db84adaf64e63c9e9147aaf7" and "b7e98db42bc1efd69001c19dee6cb5df1cdac4d5" have entirely different histories.

4 changed files with 15 additions and 191 deletions

View File

@ -2,72 +2,7 @@
<!-- 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>
@ -197,6 +132,7 @@
<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>
@ -223,6 +159,7 @@
<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>
@ -402,42 +339,12 @@
<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="GtkMenuButton"> <object class="GtkButton" id="buttonChooseWorkspace">
<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>
<property name="popover">popoverWorkspace</property> <signal name="clicked" handler="mainWindow_chooseWorkspaceClicked" swapped="no"/>
<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>

View File

@ -102,45 +102,6 @@ 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 *
@ -284,15 +245,6 @@ 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);
} }
/** /**
@ -320,6 +272,7 @@ 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"));
@ -336,13 +289,6 @@ 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;
@ -354,8 +300,9 @@ 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;
@ -376,14 +323,15 @@ void mainWindow_set_meta_information(struct mainWindow *mainWindow, guint time_e
} }
/** /**
* @brief mainWindow_otherWorkspaceClicked is called when the user clicks the Other Workspace button. * @brief mainWindow_chooseWorkspaceClicked is called when the user clicks the Choose 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_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data) void mainWindow_chooseWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data)
{ {
g_print("TODO: Show directory browser dialog.\n"); printf("Choose workspace.\n");
fflush(stdout);
} }
/** /**
@ -490,9 +438,6 @@ 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(
@ -501,9 +446,6 @@ 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(
@ -564,8 +506,6 @@ 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) {
@ -574,8 +514,6 @@ 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, "");
} }
} }
@ -583,14 +521,3 @@ 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");
}

View File

@ -8,6 +8,7 @@
struct mainWindow { struct mainWindow {
GtkWidget *mainWindow; GtkWidget *mainWindow;
GtkWidget *buttonChooseWorkspace;
GtkWidget *searchEntry; GtkWidget *searchEntry;
GtkWidget *dateStart; GtkWidget *dateStart;
GtkWidget *dateEnd; GtkWidget *dateEnd;
@ -39,13 +40,6 @@ 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();
@ -53,11 +47,7 @@ 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_otherWorkspaceClicked(GtkWidget *widget, gint event, gpointer user_data); void mainWindow_chooseWorkspaceClicked(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);

View File

@ -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, title, COL_TITLE, g_strdup(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,