aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-07-17 10:48:30 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2012-07-17 10:48:30 +0000
commitd723c78228e7b22748c19dae0e12c29f70ddc8c0 (patch)
treeb8e4d960cfdc3ff7d12f1ef7d47c0d00f47ab09f
parentc89f656cb9d44fff9ac18288f2a94aaff1c61d52 (diff)
downloadenlightenment-d723c78228e7b22748c19dae0e12c29f70ddc8c0.tar.gz
enlightenment-d723c78228e7b22748c19dae0e12c29f70ddc8c0.tar.xz
enlightenment-d723c78228e7b22748c19dae0e12c29f70ddc8c0.zip
better handling for invalid file extensions (we only support jpg and png) when specified in shot module's save dialog
ticket #1160 SVN revision: 73972
-rw-r--r--src/modules/shot/e_mod_main.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c
index 4790e6463..cce23efe8 100644
--- a/src/modules/shot/e_mod_main.c
+++ b/src/modules/shot/e_mod_main.c
@@ -128,28 +128,6 @@ _save_to(const char *file)
char *extn = strrchr(file, '.');
char opts[256];
- if (!extn)
- {
- e_util_dialog_show
- (_("Error - Unknown format"),
- _("File has an unspecified extension.<br>"
- "Please use '.jpg' or '.png' extensions<br>"
- "only as other formats are not<br>"
- "supported currently."));
- return;
- }
- if (!((!strcasecmp(extn, ".png")) ||
- (!strcasecmp(extn, ".jpg")) ||
- (!strcasecmp(extn, ".jpeg"))))
- {
- e_util_dialog_show
- (_("Error - Unknown format"),
- _("File has an unrecognized extension.<br>"
- "Please use '.jpg' or '.png' extensions<br>"
- "only as other formats are not<br>"
- "supported currently."));
- return;
- }
if (!strcasecmp(extn, ".png"))
snprintf(opts, sizeof(opts), "compress=%i", 9);
else
@@ -200,7 +178,17 @@ _file_select_ok_cb(void *data __UNUSED__, E_Dialog *dia)
const char *file;
file = e_widget_fsel_selection_path_get(o_fsel);
- if (file) _save_to(file);
+ if ((!file) || (!file[0]) || ((!eina_str_has_extension(file, "jpg")) && (!eina_str_has_extension(file, "png"))))
+ {
+ e_util_dialog_show
+ (_("Error - Unknown format"),
+ _("File has an unspecified extension.<br>"
+ "Please use '.jpg' or '.png' extensions<br>"
+ "only as other formats are not<br>"
+ "supported currently."));
+ return;
+ }
+ _save_to(file);
if (dia) e_util_defer_object_del(E_OBJECT(dia));
if (win)
{