Now saving selected renderer
This commit is contained in:
parent
552b1568e3
commit
869cb20eaf
@ -435,6 +435,21 @@ void mainWindow_renderer_set(struct mainWindow *mainWindow, enum renderer_mode s
|
||||
if (mainWindow->renderer == state)
|
||||
return;
|
||||
|
||||
switch (state) {
|
||||
case RENDERER_TEXT:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "text");
|
||||
break;
|
||||
case RENDERER_BASIC:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "basic");
|
||||
break;
|
||||
case RENDERER_HTML:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "html");
|
||||
break;
|
||||
default:
|
||||
mainWindow_renderer_set(mainWindow, RENDERER_TEXT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (state == RENDERER_HTML) {
|
||||
if (!mainWindow->webkitView) {
|
||||
mainWindow->webkitView = webkit_web_view_new();
|
||||
@ -477,19 +492,6 @@ static gboolean mainWindow_settings_delete_event(GtkWidget *widget, GdkEvent *e
|
||||
|
||||
void mainWindow_settings_show(struct mainWindow *mainWindow)
|
||||
{
|
||||
switch (mainWindow->renderer) {
|
||||
case RENDERER_TEXT:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "text");
|
||||
break;
|
||||
case RENDERER_BASIC:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "basic");
|
||||
break;
|
||||
case RENDERER_HTML:
|
||||
gtk_combo_box_set_active_id(GTK_COMBO_BOX(mainWindow->settingsDialog.comboDisplayMode), "html");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
gtk_widget_show(mainWindow->settingsDialog.settingsDialog);
|
||||
}
|
||||
|
||||
@ -582,7 +584,7 @@ struct mainWindow *mainWindow_new()
|
||||
mainWindow_configure_entry_completion(mainWindow);
|
||||
mainWindow_set_meta_information(mainWindow, 0, 0, TRUE);
|
||||
|
||||
mainWindow_renderer_set(mainWindow, RENDERER_HTML);
|
||||
mainWindow_renderer_set(mainWindow, RENDERER_TEXT);
|
||||
|
||||
return mainWindow;
|
||||
}
|
||||
|
@ -5,14 +5,20 @@ static void mdiary_settings_parse_line(gchar *line, struct mdiary_settings *sett
|
||||
GRegex *regex;
|
||||
GMatchInfo *match_info;
|
||||
|
||||
regex = g_regex_new("workspace = (.*)", G_REGEX_RAW, 0, NULL);
|
||||
|
||||
regex = g_regex_new("^workspace = (.*)", G_REGEX_RAW, 0, NULL);
|
||||
if (g_regex_match(regex, line, 0, &match_info) &&
|
||||
g_regex_get_capture_count(regex) > 0 &&
|
||||
g_match_info_matches(match_info)) {
|
||||
mainWindow_add_recent_workspace(settings->mainWindow, g_match_info_fetch(match_info, 1), TRUE);
|
||||
}
|
||||
g_regex_unref(regex);
|
||||
|
||||
regex = g_regex_new("^renderer = (.*)", G_REGEX_RAW, 0, NULL);
|
||||
if (g_regex_match(regex, line, 0, &match_info) &&
|
||||
g_regex_get_capture_count(regex) > 0 &&
|
||||
g_match_info_matches(match_info)) {
|
||||
mainWindow_renderer_set(settings->mainWindow, atoi(g_match_info_fetch(match_info, 1)));
|
||||
}
|
||||
g_regex_unref(regex);
|
||||
}
|
||||
|
||||
@ -66,6 +72,12 @@ gboolean mdiary_save_settings(gchar *filename, struct mdiary_settings *settings)
|
||||
G_FILE_CREATE_NONE,
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
output_buffer = g_strdup_printf("renderer = %d\n", settings->mainWindow->renderer);
|
||||
g_output_stream_write(G_OUTPUT_STREAM(stream),
|
||||
output_buffer, strlen(output_buffer), NULL, NULL);
|
||||
g_free(output_buffer);
|
||||
|
||||
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(settings->mainWindow->workspaceListStore), &iter)) {
|
||||
do {
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(settings->mainWindow->workspaceListStore), &iter,
|
||||
|
Loading…
Reference in New Issue
Block a user