summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c36
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);
}