diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-29 02:36:23 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-29 02:36:23 (EDT) |
commit | 515b2cec504abec17b31167a78eee08e2a441e67 (patch) | |
tree | c53f8d2993581ed45a9dcdfc0797f3cea03bf271 /src | |
parent | 3e4a6dba323900c7731598d2696799d16b118edd (diff) | |
download | marquee-515b2cec504abec17b31167a78eee08e2a441e67.zip marquee-515b2cec504abec17b31167a78eee08e2a441e67.tar.gz marquee-515b2cec504abec17b31167a78eee08e2a441e67.tar.bz2 |
MqWebView: Treat "." as part of save file extension
This obviates commit 9dbdc3d.
Diffstat (limited to 'src')
-rw-r--r-- | src/web-view.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/web-view.c b/src/web-view.c index eb48716..c5e76e8 100644 --- a/src/web-view.c +++ b/src/web-view.c @@ -926,7 +926,7 @@ get_extension(const gchar *filename) extension = strrchr(filename, '.'); if (extension) { - return extension + 1; + return extension; } else { return filename + strlen(filename); } @@ -936,26 +936,28 @@ static gboolean extension_is_html(const gchar *extension) { return - extension[0] == 'h' && - extension[1] == 't' && - extension[2] == 'm' && - (extension[3] == '\0' || - (extension[3] == 'l' && - extension[4] == '\0')); + extension[0] == '.' && + extension[1] == 'h' && + extension[2] == 't' && + extension[3] == 'm' && + (extension[4] == '\0' || + (extension[4] == 'l' && + extension[5] == '\0')); } static gboolean extension_is_mhtml(const gchar *extension) { return - extension[0] == 'm' && - extension[1] == 'h' && - extension[2] == 't' && - (extension[3] == '\0' || - (extension[3] == 'm' && - (extension[4] == '\0' || - (extension[4] == 'l' && - extension[5] == '\0')))); + extension[0] == '.' && + extension[1] == 'm' && + extension[2] == 'h' && + extension[3] == 't' && + (extension[4] == '\0' || + (extension[4] == 'm' && + (extension[5] == '\0' || + (extension[5] == 'l' && + extension[6] == '\0')))); } static void @@ -1012,7 +1014,7 @@ save_type_changed_cb(GtkComboBox *combo_box, GtkFileChooser *chooser) if (!extension_is_html(extension)) { /* Extension is not "htm" or "html". */ extension[0] = '\0'; /* Remove extension. */ - new_name = g_strconcat(name, "html", NULL); + new_name = g_strconcat(name, ".html", NULL); gtk_file_chooser_set_current_name(chooser, new_name); g_free(new_name); } @@ -1020,7 +1022,7 @@ save_type_changed_cb(GtkComboBox *combo_box, GtkFileChooser *chooser) if (!extension_is_mhtml(extension)) { /* Extension is not "mht", "mhtm", or "mhtml". */ extension[0] = '\0'; /* Remove extension. */ - new_name = g_strconcat(name, "mhtml", NULL); + new_name = g_strconcat(name, ".mhtml", NULL); gtk_file_chooser_set_current_name(chooser, new_name); g_free(new_name); } |