diff options
Diffstat (limited to 'src/Fl_Native_File_Chooser_GTK.cxx')
| -rw-r--r-- | src/Fl_Native_File_Chooser_GTK.cxx | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/src/Fl_Native_File_Chooser_GTK.cxx b/src/Fl_Native_File_Chooser_GTK.cxx index 263acfad7..49b99f623 100644 --- a/src/Fl_Native_File_Chooser_GTK.cxx +++ b/src/Fl_Native_File_Chooser_GTK.cxx @@ -929,38 +929,36 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) { // otherwise, use FLTK file chooser. platform_fnfc = NULL; fl_open_display(); - if (Fl::option(Fl::OPTION_FNFC_USES_ZENITY)&& val != BROWSE_MULTI_DIRECTORY) { - if (!Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity) { - // First Time here, try to find zenity - FILE *pipe = popen("zenity --version 2> /dev/null", "r"); - if (pipe) { - char *p, line[100] = ""; - p = fgets(line, sizeof(line), pipe); - if (p && strlen(line) > 0) Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity = true; - pclose(pipe); - } - Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity = true; + if (Fl::option(Fl::OPTION_FNFC_USES_ZENITY)&& val != BROWSE_MULTI_DIRECTORY) { + if (!Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity) { + // First Time here, try to find zenity + FILE *pipe = popen("zenity --version 2> /dev/null", "r"); + if (pipe) { + char *p, line[100] = ""; + p = fgets(line, sizeof(line), pipe); + if (p && strlen(line) > 0) Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity = true; + pclose(pipe); } - // if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver - if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val); + Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity = true; } - const char *desktop = getenv("XDG_CURRENT_DESKTOP"); - if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && desktop && - strcmp(desktop, "KDE") == 0 && val != BROWSE_MULTI_DIRECTORY) { - if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) { - // First Time here, try to find kdialog - FILE *pipe = popen("kdialog -v 2> /dev/null", "r"); - if (pipe) { - char *p, line[100] = ""; - p = fgets(line, sizeof(line), pipe); - if (p && strlen(line) > 0) Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog = true; - pclose(pipe); - } - Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog = true; + // if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver + if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val); + } + if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && val != BROWSE_MULTI_DIRECTORY) { + if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) { + // First Time here, try to find kdialog + FILE *pipe = popen("kdialog -v 2> /dev/null", "r"); + if (pipe) { + char *p, line[100] = ""; + p = fgets(line, sizeof(line), pipe); + if (p && strlen(line) > 0) Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog = true; + pclose(pipe); } - // if we found kdialog, we will use the Fl_Kdialog_Native_File_Chooser_Driver - if (Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog) platform_fnfc = new Fl_Kdialog_Native_File_Chooser_Driver(val); + Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog = true; } + // if we found kdialog, we will use the Fl_Kdialog_Native_File_Chooser_Driver + if (Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog) platform_fnfc = new Fl_Kdialog_Native_File_Chooser_Driver(val); + } #if HAVE_DLSYM && HAVE_DLFCN_H if (!platform_fnfc) { if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) { |
