Coding style

This commit is contained in:
Markus Koch 2017-02-15 19:25:42 +01:00
parent ce137185ad
commit 31eb9fd406
5 changed files with 13 additions and 13 deletions

View File

@ -22,7 +22,7 @@ int main(int argc, char *argv[])
gtk_widget_show(mainWindow->mainWindow); gtk_widget_show(mainWindow->mainWindow);
gtk_main(); 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);

View File

@ -715,7 +715,7 @@ static void mainWindow_show_error(struct mainWindow *mainWindow, gchar *text)
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
"Error: %s", "Error: %s",
text); text);
gtk_dialog_run(GTK_DIALOG (dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} }
@ -779,13 +779,14 @@ void mainWindow_otherWorkspaceClicked(GtkWidget *widget, gpointer user_data)
GtkWidget *dialog; GtkWidget *dialog;
gint res; gint res;
dialog = gtk_file_chooser_dialog_new("Choose Workspace", GTK_WINDOW(mainWindow->mainWindow), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, dialog = gtk_file_chooser_dialog_new("Choose Workspace", GTK_WINDOW(mainWindow->mainWindow),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
"Cancel", GTK_RESPONSE_CANCEL, "Cancel", GTK_RESPONSE_CANCEL,
"Select", GTK_RESPONSE_ACCEPT, "Select", GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE);
res = gtk_dialog_run (GTK_DIALOG (dialog)); res = gtk_dialog_run(GTK_DIALOG(dialog));
if (res == GTK_RESPONSE_ACCEPT) { if (res == GTK_RESPONSE_ACCEPT) {
char *directory; char *directory;
@ -794,7 +795,7 @@ void mainWindow_otherWorkspaceClicked(GtkWidget *widget, gpointer user_data)
g_free(directory); g_free(directory);
} }
gtk_widget_destroy (dialog); gtk_widget_destroy(dialog);
} }
void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data) void mainWindow_decrypt_gpg_clicked(GtkWidget *widget, gpointer user_data)

View File

@ -97,7 +97,7 @@ GDateTime *mdiary_get_date_from_string_ext(gchar *string, gchar *prefix, gchar *
minute = atoi(g_match_info_fetch(match_info, dateFormats->index_minute)); minute = atoi(g_match_info_fetch(match_info, dateFormats->index_minute));
if (year >= 0 && if (year >= 0 &&
month >=1 && month <=12 && month >= 1 && month <= 12 &&
day >= 1 && day <= 31 && day >= 1 && day <= 31 &&
hour >= 0 && hour <= 23 && hour >= 0 && hour <= 23 &&
minute >= 0 && minute <= 59) { minute >= 0 && minute <= 59) {
@ -230,9 +230,8 @@ static gchar *mdiary_get_line_from_string(gchar **str_ptr)
str = *str_ptr; str = *str_ptr;
start = str; start = str;
while (*str != '\n' && *str != '\0') { while (*str != '\n' && *str != '\0')
str++; str++;
}
*str = '\0'; *str = '\0';
*str_ptr = ++str; *str_ptr = ++str;
@ -599,7 +598,8 @@ void mdiary_add_entry_to_store(GtkListStore *entryListStore,
* @param data * @param data
* @return FALSE * @return FALSE
*/ */
gboolean mdiary_free_entry_elements(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { gboolean mdiary_free_entry_elements(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
gpointer ptr; gpointer ptr;
gtk_tree_model_get(model, iter, COL_TAGLIST, &ptr, -1); gtk_tree_model_get(model, iter, COL_TAGLIST, &ptr, -1);

View File

@ -36,9 +36,8 @@ gboolean mdiary_load_settings(gchar *filename, struct mdiary_settings *settings)
} }
dstream = g_data_input_stream_new(G_INPUT_STREAM(stream)); dstream = g_data_input_stream_new(G_INPUT_STREAM(stream));
while (line = g_data_input_stream_read_line(G_DATA_INPUT_STREAM(dstream), NULL, NULL, NULL)) { while (line = g_data_input_stream_read_line(G_DATA_INPUT_STREAM(dstream), NULL, NULL, NULL))
mdiary_settings_parse_line(line, settings); mdiary_settings_parse_line(line, settings);
}
g_input_stream_close(G_INPUT_STREAM(dstream), NULL, NULL); g_input_stream_close(G_INPUT_STREAM(dstream), NULL, NULL);
g_input_stream_close(G_INPUT_STREAM(stream), NULL, NULL); g_input_stream_close(G_INPUT_STREAM(stream), NULL, NULL);
@ -82,7 +81,7 @@ gboolean mdiary_save_settings(gchar *filename, struct mdiary_settings *settings)
} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(settings->mainWindow->workspaceListStore), &iter)); } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(settings->mainWindow->workspaceListStore), &iter));
} }
g_output_stream_close(G_OUTPUT_STREAM(stream),NULL,NULL); g_output_stream_close(G_OUTPUT_STREAM(stream), NULL, NULL);
g_object_unref(stream); g_object_unref(stream);
g_object_unref(file); g_object_unref(file);
} }

View File

@ -15,4 +15,4 @@ gboolean mdiary_save_settings(gchar *filename, struct mdiary_settings *settings)
struct mdiary_settings *mdiary_settings_new(struct mainWindow *mainWindow); struct mdiary_settings *mdiary_settings_new(struct mainWindow *mainWindow);
void mdiary_settings_free(struct mdiary_settings *settings); void mdiary_settings_free(struct mdiary_settings *settings);
#endif // SETTINGS_H #endif /* SETTINGS_H */