Created
March 12, 2016 19:37
-
-
Save codebrainz/87bcc7c2eca42480c409 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/project.c b/src/project.c | |
index b235160..6a488e0 100644 | |
--- a/src/project.c | |
+++ b/src/project.c | |
@@ -319,54 +319,59 @@ void project_open(void) | |
if (! project_ask_close()) return; | |
#ifdef G_OS_WIN32 | |
- file = win32_show_project_open_dialog(main_widgets.window, _("Open Project"), dir, FALSE, TRUE); | |
- if (file != NULL) | |
+ if (interface_prefs.use_native_windows_dialogs) | |
{ | |
- /* try to load the config */ | |
- if (! project_load_file_with_session(file)) | |
+ file = win32_show_project_open_dialog(main_widgets.window, _("Open Project"), dir, FALSE, TRUE); | |
+ if (file != NULL) | |
{ | |
- SHOW_ERR1(_("Project file \"%s\" could not be loaded."), file); | |
+ /* try to load the config */ | |
+ if (! project_load_file_with_session(file)) | |
+ { | |
+ SHOW_ERR1(_("Project file \"%s\" could not be loaded."), file); | |
+ } | |
+ g_free(file); | |
} | |
- g_free(file); | |
} | |
+ else | |
#else | |
- | |
- dialog = gtk_file_chooser_dialog_new(_("Open Project"), GTK_WINDOW(main_widgets.window), | |
- GTK_FILE_CHOOSER_ACTION_OPEN, | |
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); | |
- gtk_widget_set_name(dialog, "GeanyDialogProject"); | |
- | |
- /* set default Open, so pressing enter can open multiple files */ | |
- gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
- gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); | |
- gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE); | |
- gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); | |
- gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window)); | |
- gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); | |
- | |
- /* add FileFilters */ | |
- filter = gtk_file_filter_new(); | |
- gtk_file_filter_set_name(filter, _("All files")); | |
- gtk_file_filter_add_pattern(filter, "*"); | |
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); | |
- filter = gtk_file_filter_new(); | |
- gtk_file_filter_set_name(filter, _("Project files")); | |
- gtk_file_filter_add_pattern(filter, "*." GEANY_PROJECT_EXT); | |
- gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); | |
- gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter); | |
- | |
- locale_path = utils_get_locale_from_utf8(dir); | |
- if (g_file_test(locale_path, G_FILE_TEST_EXISTS) && | |
- g_file_test(locale_path, G_FILE_TEST_IS_DIR)) | |
{ | |
- gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path); | |
- } | |
- g_free(locale_path); | |
+ dialog = gtk_file_chooser_dialog_new(_("Open Project"), GTK_WINDOW(main_widgets.window), | |
+ GTK_FILE_CHOOSER_ACTION_OPEN, | |
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); | |
+ gtk_widget_set_name(dialog, "GeanyDialogProject"); | |
+ | |
+ /* set default Open, so pressing enter can open multiple files */ | |
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); | |
+ gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); | |
+ gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE); | |
+ gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); | |
+ gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(main_widgets.window)); | |
+ gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE); | |
+ | |
+ /* add FileFilters */ | |
+ filter = gtk_file_filter_new(); | |
+ gtk_file_filter_set_name(filter, _("All files")); | |
+ gtk_file_filter_add_pattern(filter, "*"); | |
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); | |
+ filter = gtk_file_filter_new(); | |
+ gtk_file_filter_set_name(filter, _("Project files")); | |
+ gtk_file_filter_add_pattern(filter, "*." GEANY_PROJECT_EXT); | |
+ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); | |
+ gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filter); | |
+ | |
+ locale_path = utils_get_locale_from_utf8(dir); | |
+ if (g_file_test(locale_path, G_FILE_TEST_EXISTS) && | |
+ g_file_test(locale_path, G_FILE_TEST_IS_DIR)) | |
+ { | |
+ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path); | |
+ } | |
+ g_free(locale_path); | |
- gtk_widget_show_all(dialog); | |
- run_open_dialog(GTK_DIALOG(dialog)); | |
- gtk_widget_destroy(GTK_WIDGET(dialog)); | |
+ gtk_widget_show_all(dialog); | |
+ run_open_dialog(GTK_DIALOG(dialog)); | |
+ gtk_widget_destroy(GTK_WIDGET(dialog)); | |
+ } | |
#endif | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment