Compare commits
No commits in common. "2d8d86781c127b466614592699ef97371d1a9387" and "0a6beb710ca4dd592bdbba038c290e2fa2977852" have entirely different histories.
2d8d86781c
...
0a6beb710c
@ -7,12 +7,11 @@ find_package(PkgConfig REQUIRED)
|
|||||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
|
pkg_check_modules(GLIB2 REQUIRED glib-2.0)
|
||||||
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
|
pkg_check_modules(GOBJECT2 REQUIRED gobject-2.0)
|
||||||
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
|
||||||
pkg_check_modules(WEBKIT REQUIRED webkit2gtk-4.0)
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} ${WEBKIT_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES (${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIRS} ${GTK3_INCLUDE_DIRS} )
|
||||||
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS})
|
LINK_DIRECTORIES (${GLIB2_LIBRARY_DIRS} ${GOBJECT2_LIBRARY_DIRS} ${GTK3_LIBRARY_DIRS})
|
||||||
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER})
|
add_definitions(${GLIB2_CFLAGS_OTHER} ${GOBJECT2_CFLAGS_OTHER} ${GTK3_CFLAGS_OTHER})
|
||||||
|
|
||||||
aux_source_directory(./src SRC_LIST)
|
aux_source_directory(./src SRC_LIST)
|
||||||
add_executable(${PROJECT_NAME} ${SRC_LIST})
|
add_executable(${PROJECT_NAME} ${SRC_LIST})
|
||||||
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} ${GTK3_LIBRARIES} ${PC_LIBSOUP_LIBRARIES})
|
||||||
|
@ -78,6 +78,7 @@
|
|||||||
<property name="width_request">720</property>
|
<property name="width_request">720</property>
|
||||||
<property name="height_request">405</property>
|
<property name="height_request">405</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkPaned" id="mainPane">
|
<object class="GtkPaned" id="mainPane">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -356,32 +357,22 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stackRenderMode">
|
<object class="GtkScrolledWindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">True</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="entryTextScrollArea">
|
<object class="GtkTextView" id="entryText">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="shadow_type">in</property>
|
<property name="editable">False</property>
|
||||||
<child>
|
<property name="wrap_mode">word-char</property>
|
||||||
<object class="GtkTextView" id="entryText">
|
<property name="left_margin">4</property>
|
||||||
<property name="visible">True</property>
|
<property name="right_margin">4</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="top_margin">4</property>
|
||||||
<property name="editable">False</property>
|
<property name="bottom_margin">4</property>
|
||||||
<property name="wrap_mode">word-char</property>
|
<property name="buffer">entryTextBuffer</property>
|
||||||
<property name="left_margin">4</property>
|
|
||||||
<property name="right_margin">4</property>
|
|
||||||
<property name="top_margin">4</property>
|
|
||||||
<property name="bottom_margin">4</property>
|
|
||||||
<property name="buffer">entryTextBuffer</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="name">page0</property>
|
|
||||||
<property name="title" translatable="yes">page0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
60
src/main.c
60
src/main.c
@ -5,72 +5,26 @@
|
|||||||
#include "mdiary.h"
|
#include "mdiary.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
static void quit_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
|
struct mainWindow *mainWindow;
|
||||||
|
|
||||||
gtk_window_close(GTK_WINDOW(mainWindow->mainWindow));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void settings_cb(GSimpleAction *action, GVariant *parameter, gpointer user_data)
|
|
||||||
{
|
|
||||||
struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
|
|
||||||
|
|
||||||
g_print("nTODO\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
const GActionEntry app_actions[] = {
|
|
||||||
{ "quit", quit_cb },
|
|
||||||
{ "settings", settings_cb }
|
|
||||||
};
|
|
||||||
|
|
||||||
static void activate(GApplication *app, gpointer user_data)
|
|
||||||
{
|
|
||||||
struct mainWindow *mainWindow = *((struct mainWindow **) user_data);
|
|
||||||
struct mdiary_settings *settings;
|
struct mdiary_settings *settings;
|
||||||
gchar *settings_path;
|
gchar *settings_path;
|
||||||
|
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
mainWindow = mainWindow_new();
|
mainWindow = mainWindow_new();
|
||||||
gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(mainWindow->mainWindow));
|
|
||||||
|
|
||||||
settings_path = g_strdup_printf("%s/.mdiary.conf", g_get_home_dir());
|
settings_path = g_strdup_printf("%s/.mdiary.conf", g_get_home_dir());
|
||||||
settings = mdiary_settings_new(mainWindow);
|
settings = mdiary_settings_new(mainWindow);
|
||||||
mdiary_load_settings(settings_path, settings);
|
mdiary_load_settings(settings_path, settings);
|
||||||
|
|
||||||
gtk_widget_show(mainWindow->mainWindow);
|
gtk_widget_show(mainWindow->mainWindow);
|
||||||
|
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);
|
||||||
}
|
|
||||||
|
return 0;
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
struct mainWindow *mainWindow;
|
|
||||||
GtkApplication *app;
|
|
||||||
GMenu *app_menu;
|
|
||||||
GMenu *p1;
|
|
||||||
GMenu *p2;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
app = gtk_application_new("net.notsyncing.mdiary", G_APPLICATION_FLAGS_NONE);
|
|
||||||
g_application_register(G_APPLICATION(app), NULL, NULL);
|
|
||||||
g_signal_connect(app, "activate", G_CALLBACK(activate), &mainWindow);
|
|
||||||
|
|
||||||
app_menu = g_menu_new();
|
|
||||||
p1 = g_menu_new();
|
|
||||||
p2 = g_menu_new();
|
|
||||||
g_menu_append(p1, "Settings", "app.settings");
|
|
||||||
g_menu_append(p2, "Quit", "app.quit");
|
|
||||||
g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p1));
|
|
||||||
g_menu_append_section(app_menu, NULL, G_MENU_MODEL(p2));
|
|
||||||
gtk_application_set_app_menu(app, G_MENU_MODEL(app_menu));
|
|
||||||
g_action_map_add_action_entries(G_ACTION_MAP(app), app_actions, G_N_ELEMENTS(app_actions), &mainWindow);
|
|
||||||
gtk_application_set_app_menu(GTK_APPLICATION(app), G_MENU_MODEL(app_menu));
|
|
||||||
g_object_unref(p1);
|
|
||||||
g_object_unref(p2);
|
|
||||||
g_object_unref(app_menu);
|
|
||||||
|
|
||||||
status = g_application_run(G_APPLICATION(app), argc, argv);
|
|
||||||
g_object_unref(app);
|
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,6 @@ static void mainWindow_configure_treeView(struct mainWindow *mainWindow)
|
|||||||
G_TYPE_POINTER,
|
G_TYPE_POINTER,
|
||||||
G_TYPE_POINTER,
|
G_TYPE_POINTER,
|
||||||
G_TYPE_STRING,
|
G_TYPE_STRING,
|
||||||
G_TYPE_STRING,
|
|
||||||
G_TYPE_STRING);
|
G_TYPE_STRING);
|
||||||
mainWindow->entryListFiltered = GTK_TREE_MODEL_FILTER(gtk_tree_model_filter_new(
|
mainWindow->entryListFiltered = GTK_TREE_MODEL_FILTER(gtk_tree_model_filter_new(
|
||||||
GTK_TREE_MODEL(mainWindow->entryListStore),
|
GTK_TREE_MODEL(mainWindow->entryListStore),
|
||||||
@ -425,33 +424,6 @@ static void mainWindow_init_to_default(struct mainWindow *mainWindow)
|
|||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainWindow->checkSearchText), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief mainWindow_webkit_set_enabled sets the active text renderer.
|
|
||||||
* @param mainWindow the mainWindow
|
|
||||||
* @param state
|
|
||||||
*/
|
|
||||||
void mainWindow_webkit_set_enabled(struct mainWindow *mainWindow, gboolean state)
|
|
||||||
{
|
|
||||||
if (state) {
|
|
||||||
if (!mainWindow->webkitView) {
|
|
||||||
mainWindow->webkitView = webkit_web_view_new();
|
|
||||||
webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(mainWindow->webkitView), "", "");
|
|
||||||
gtk_widget_show(mainWindow->webkitView);
|
|
||||||
|
|
||||||
mainWindow->webkitScrollArea = gtk_scrolled_window_new(NULL, NULL);
|
|
||||||
gtk_container_add(GTK_CONTAINER(mainWindow->webkitScrollArea), mainWindow->webkitView);
|
|
||||||
gtk_stack_add_titled(GTK_STACK(mainWindow->stackRenderMode), mainWindow->webkitScrollArea,
|
|
||||||
"webkit", "webkit");
|
|
||||||
gtk_widget_show(mainWindow->webkitScrollArea);
|
|
||||||
}
|
|
||||||
gtk_stack_set_visible_child(GTK_STACK(mainWindow->stackRenderMode),
|
|
||||||
mainWindow->webkitScrollArea);
|
|
||||||
} else {
|
|
||||||
gtk_stack_set_visible_child(GTK_STACK(mainWindow->stackRenderMode),
|
|
||||||
mainWindow->entryTextScrollArea);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mainWindow_new creates a new mainWindow.
|
* @brief mainWindow_new creates a new mainWindow.
|
||||||
* @return Returns struct mainWindow *
|
* @return Returns struct mainWindow *
|
||||||
@ -470,7 +442,6 @@ struct mainWindow *mainWindow_new()
|
|||||||
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"));
|
||||||
mainWindow->entryText = GTK_WIDGET(gtk_builder_get_object(builder, "entryText"));
|
mainWindow->entryText = GTK_WIDGET(gtk_builder_get_object(builder, "entryText"));
|
||||||
mainWindow->entryTextScrollArea = GTK_WIDGET(gtk_builder_get_object(builder, "entryTextScrollArea"));
|
|
||||||
mainWindow->popoverDate = GTK_WIDGET(gtk_builder_get_object(builder, "popoverDate"));
|
mainWindow->popoverDate = GTK_WIDGET(gtk_builder_get_object(builder, "popoverDate"));
|
||||||
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
|
mainWindow->calendarRange = GTK_WIDGET(gtk_builder_get_object(builder, "calendarRange"));
|
||||||
mainWindow->checkSearchTitle = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTitle"));
|
mainWindow->checkSearchTitle = GTK_WIDGET(gtk_builder_get_object(builder, "checkSearchTitle"));
|
||||||
@ -482,7 +453,6 @@ struct mainWindow *mainWindow_new()
|
|||||||
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->labelDateToDate = GTK_WIDGET(gtk_builder_get_object(builder, "label_date_to_date"));
|
||||||
mainWindow->buttonDecrypt = GTK_WIDGET(gtk_builder_get_object(builder, "buttonDecrypt"));
|
mainWindow->buttonDecrypt = GTK_WIDGET(gtk_builder_get_object(builder, "buttonDecrypt"));
|
||||||
mainWindow->stackRenderMode = GTK_WIDGET(gtk_builder_get_object(builder, "stackRenderMode"));
|
|
||||||
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"));
|
||||||
@ -506,8 +476,6 @@ struct mainWindow *mainWindow_new()
|
|||||||
g_object_unref(G_OBJECT(builder));
|
g_object_unref(G_OBJECT(builder));
|
||||||
|
|
||||||
mainWindow_configure_treeView(mainWindow);
|
mainWindow_configure_treeView(mainWindow);
|
||||||
mainWindow->webkitView = NULL;
|
|
||||||
mainWindow->webkitScrollArea = NULL;
|
|
||||||
mainWindow_connect_signals(mainWindow);
|
mainWindow_connect_signals(mainWindow);
|
||||||
mainWindow_configure_workspaceTreeView(mainWindow);
|
mainWindow_configure_workspaceTreeView(mainWindow);
|
||||||
mainWindow_init_to_default(mainWindow);
|
mainWindow_init_to_default(mainWindow);
|
||||||
@ -515,8 +483,6 @@ struct mainWindow *mainWindow_new()
|
|||||||
mainWindow_configure_entry_completion(mainWindow);
|
mainWindow_configure_entry_completion(mainWindow);
|
||||||
mainWindow_set_meta_information(mainWindow, 0, 0, TRUE);
|
mainWindow_set_meta_information(mainWindow, 0, 0, TRUE);
|
||||||
|
|
||||||
mainWindow_webkit_set_enabled(mainWindow, TRUE);
|
|
||||||
|
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,57 +559,6 @@ void mainWindow_calendarSelected(GtkWidget *widget, gpointer user_data)
|
|||||||
g_free(text);
|
g_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mainWindow_set_text(struct mainWindow *mainWindow, gchar *text, gchar *file_url)
|
|
||||||
{
|
|
||||||
gchar *tempfile_path = "/tmp/mdiary.tmp.md";
|
|
||||||
gchar *cmd = NULL;
|
|
||||||
gchar *cmd_stdout = NULL;
|
|
||||||
gchar *cmd_stderr = NULL;
|
|
||||||
gint exit_status = 0;
|
|
||||||
gchar *base_url = NULL;
|
|
||||||
GFileOutputStream *stream;
|
|
||||||
GFile *file;
|
|
||||||
|
|
||||||
if (mainWindow->webkitView &&
|
|
||||||
gtk_stack_get_visible_child(GTK_STACK(mainWindow->stackRenderMode)) == mainWindow->webkitScrollArea) {
|
|
||||||
if (text[0] != '\0') {
|
|
||||||
base_url = g_strdup_printf("file://%s", file_url);
|
|
||||||
file = g_file_new_for_path(tempfile_path);
|
|
||||||
stream = g_file_replace(
|
|
||||||
file, NULL, FALSE,
|
|
||||||
G_FILE_CREATE_NONE,
|
|
||||||
NULL, NULL);
|
|
||||||
g_output_stream_write(G_OUTPUT_STREAM(stream), text, strlen(text), NULL, NULL);
|
|
||||||
g_output_stream_flush(G_OUTPUT_STREAM(stream), NULL, NULL);
|
|
||||||
|
|
||||||
cmd = g_strdup_printf("markdown %s", tempfile_path);
|
|
||||||
if (g_spawn_command_line_sync(cmd, &cmd_stdout, &cmd_stderr, &exit_status, NULL) &&
|
|
||||||
exit_status == 0) {
|
|
||||||
webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(mainWindow->webkitView),
|
|
||||||
cmd_stdout, base_url);
|
|
||||||
} else {
|
|
||||||
g_warning("Could not render markdown for file. Showing plain text instead.\n");
|
|
||||||
webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(mainWindow->webkitView),
|
|
||||||
text, "");
|
|
||||||
}
|
|
||||||
g_free(base_url);
|
|
||||||
} else {
|
|
||||||
webkit_web_view_load_html_string(WEBKIT_WEB_VIEW(mainWindow->webkitView),
|
|
||||||
text, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
g_output_stream_close(G_OUTPUT_STREAM(stream), NULL, NULL);
|
|
||||||
g_file_delete(file, NULL, NULL);
|
|
||||||
g_object_unref(stream);
|
|
||||||
g_object_unref(file);
|
|
||||||
g_free(cmd);
|
|
||||||
g_free(cmd_stdout);
|
|
||||||
g_free(cmd_stderr);
|
|
||||||
} else {
|
|
||||||
gtk_text_buffer_set_text(mainWindow->textBuffer, text, strlen(text));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mainWindow_entrySelected is the callback when the user selects a diary entry.
|
* @brief mainWindow_entrySelected is the callback when the user selects a diary entry.
|
||||||
* @param widget N/A
|
* @param widget N/A
|
||||||
@ -655,7 +570,6 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
|||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
gchar *file_url;
|
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gchar *title;
|
gchar *title;
|
||||||
gchar *summary;
|
gchar *summary;
|
||||||
@ -664,21 +578,18 @@ void mainWindow_entrySelected(GtkWidget *widget, gpointer user_data)
|
|||||||
selection = gtk_tree_view_get_selection(mainWindow->entryListView);
|
selection = gtk_tree_view_get_selection(mainWindow->entryListView);
|
||||||
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
|
||||||
gtk_tree_model_get(model, &iter, COL_TEXT, &text, -1);
|
gtk_tree_model_get(model, &iter, COL_TEXT, &text, -1);
|
||||||
gtk_tree_model_get(model, &iter, COL_URL, &file_url, -1);
|
gtk_text_buffer_set_text(mainWindow->textBuffer, text, strlen(text));
|
||||||
mainWindow_set_text(mainWindow, text, file_url);
|
|
||||||
g_free(text);
|
g_free(text);
|
||||||
g_free(file_url);
|
|
||||||
|
|
||||||
gtk_tree_model_get(model, &iter, COL_SUMMARY, &summary, -1);
|
gtk_tree_model_get(model, &iter, COL_SUMMARY, &summary, -1);
|
||||||
gtk_tree_model_get(model, &iter, COL_TITLE, &title, -1);
|
gtk_tree_model_get(model, &iter, COL_TITLE, &title, -1);
|
||||||
temp = g_strdup_printf("<b>%s</b>: %s", title, summary);
|
temp = g_strdup_printf("<b>%s</b>: %s", title, summary);
|
||||||
gtk_label_set_markup(GTK_LABEL(mainWindow->labelSummary), temp);
|
gtk_label_set_markup(GTK_LABEL(mainWindow->labelSummary), temp);
|
||||||
|
|
||||||
g_free(title);
|
g_free(title);
|
||||||
g_free(summary);
|
g_free(summary);
|
||||||
g_free(temp);
|
g_free(temp);
|
||||||
} else {
|
} else {
|
||||||
mainWindow_set_text(mainWindow, "", "");
|
gtk_text_buffer_set_text(mainWindow->textBuffer, "", 0);
|
||||||
gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "Please select an entry in the list above.");
|
gtk_label_set_text(GTK_LABEL(mainWindow->labelSummary), "Please select an entry in the list above.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include <webkit2/webkit2.h>
|
|
||||||
#include "mdiary.h"
|
#include "mdiary.h"
|
||||||
|
|
||||||
#define FILE_LIST_MAX_LEN 5
|
#define FILE_LIST_MAX_LEN 5
|
||||||
@ -22,7 +21,6 @@ struct mainWindow {
|
|||||||
GtkWidget *dateStart;
|
GtkWidget *dateStart;
|
||||||
GtkWidget *dateEnd;
|
GtkWidget *dateEnd;
|
||||||
GtkWidget *entryText;
|
GtkWidget *entryText;
|
||||||
GtkWidget *entryTextScrollArea;
|
|
||||||
GtkWidget *popoverDate;
|
GtkWidget *popoverDate;
|
||||||
GtkWidget *calendarRange;
|
GtkWidget *calendarRange;
|
||||||
GtkWidget *checkSearchTitle;
|
GtkWidget *checkSearchTitle;
|
||||||
@ -34,9 +32,6 @@ struct mainWindow {
|
|||||||
GtkWidget *headerBar;
|
GtkWidget *headerBar;
|
||||||
GtkWidget *labelDateToDate;
|
GtkWidget *labelDateToDate;
|
||||||
GtkWidget *buttonDecrypt;
|
GtkWidget *buttonDecrypt;
|
||||||
GtkWidget *webkitView;
|
|
||||||
GtkWidget *webkitScrollArea;
|
|
||||||
GtkWidget *stackRenderMode;
|
|
||||||
GtkTreeView *entryListView;
|
GtkTreeView *entryListView;
|
||||||
GtkTreeSelection *entryListSelection;
|
GtkTreeSelection *entryListSelection;
|
||||||
GtkTextBuffer *textBuffer;
|
GtkTextBuffer *textBuffer;
|
||||||
@ -90,6 +85,5 @@ void mainWindow_dateIconPress(GtkWidget *widget, gint icon_pos, gint event, gpoi
|
|||||||
void mainWindow_add_recent_workspace(struct mainWindow *mainWindow, gchar *path, gboolean append);
|
void mainWindow_add_recent_workspace(struct mainWindow *mainWindow, gchar *path, gboolean append);
|
||||||
void mainWindow_switch_workspace(struct mainWindow *mainWindow, gchar *path, gboolean gpg_enabled);
|
void mainWindow_switch_workspace(struct mainWindow *mainWindow, gchar *path, gboolean gpg_enabled);
|
||||||
void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data);
|
void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data);
|
||||||
void mainWindow_webkit_set_enabled(struct mainWindow *mainWindow, gboolean state);
|
|
||||||
|
|
||||||
#endif /* MAINWINDOW_H */
|
#endif /* MAINWINDOW_H */
|
||||||
|
@ -346,8 +346,7 @@ static void mdiary_add_file_to_store(struct mdiary_scanner *mdiary_scanner,
|
|||||||
datetime,
|
datetime,
|
||||||
tagList,
|
tagList,
|
||||||
summary,
|
summary,
|
||||||
text->str,
|
text->str);
|
||||||
filename);
|
|
||||||
|
|
||||||
if (g_date_time_to_unix(datetime) > mdiary_scanner->time_latest)
|
if (g_date_time_to_unix(datetime) > mdiary_scanner->time_latest)
|
||||||
mdiary_scanner->time_latest = g_date_time_to_unix(datetime);
|
mdiary_scanner->time_latest = g_date_time_to_unix(datetime);
|
||||||
@ -543,8 +542,7 @@ void mdiary_add_entry_to_store(GtkListStore *entryListStore,
|
|||||||
GDateTime *datetime,
|
GDateTime *datetime,
|
||||||
GList *tags,
|
GList *tags,
|
||||||
gchar *summary,
|
gchar *summary,
|
||||||
gchar *text,
|
gchar *text)
|
||||||
gchar *file_url)
|
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GDateTime *datetime_copy;
|
GDateTime *datetime_copy;
|
||||||
@ -569,7 +567,6 @@ void mdiary_add_entry_to_store(GtkListStore *entryListStore,
|
|||||||
COL_TAGLIST, taglist_copy, /* TODO: Verify that the duplication worked! */
|
COL_TAGLIST, taglist_copy, /* TODO: Verify that the duplication worked! */
|
||||||
COL_SUMMARY, summary, /* Automatically strdupd */
|
COL_SUMMARY, summary, /* Automatically strdupd */
|
||||||
COL_TEXT, text, /* Automatically strdupd */
|
COL_TEXT, text, /* Automatically strdupd */
|
||||||
COL_URL, file_url, /* Automatically strdupd */
|
|
||||||
-1);
|
-1);
|
||||||
g_free(date_text);
|
g_free(date_text);
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ enum {
|
|||||||
COL_TAGLIST, /* GList<gchar *> of the tags */
|
COL_TAGLIST, /* GList<gchar *> of the tags */
|
||||||
COL_SUMMARY, /* Summary of the entry */
|
COL_SUMMARY, /* Summary of the entry */
|
||||||
COL_TEXT, /* Raw text from the file */
|
COL_TEXT, /* Raw text from the file */
|
||||||
COL_URL, /* Path to the file */
|
|
||||||
COL_COUNT
|
COL_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,8 +36,7 @@ void mdiary_add_entry_to_store(GtkListStore *entryListStore,
|
|||||||
GDateTime *datetime,
|
GDateTime *datetime,
|
||||||
GList *tags,
|
GList *tags,
|
||||||
gchar *summary,
|
gchar *summary,
|
||||||
gchar *text,
|
gchar *text);
|
||||||
gchar *file_url);
|
|
||||||
GDateTime *mdiary_get_date_from_string_ext(gchar *string, gchar *prefix, gchar *suffix);
|
GDateTime *mdiary_get_date_from_string_ext(gchar *string, gchar *prefix, gchar *suffix);
|
||||||
GDateTime *mdiary_get_date_from_string(gchar *string);
|
GDateTime *mdiary_get_date_from_string(gchar *string);
|
||||||
void mdiary_reset_store(GtkListStore *entryListStore, GtkListStore *autoCompletion);
|
void mdiary_reset_store(GtkListStore *entryListStore, GtkListStore *autoCompletion);
|
||||||
|
Loading…
Reference in New Issue
Block a user