[evolution] I#767 - Support for WebP images / photos



commit 0daae20b8fe2bc86289b4505777414a4909cd25a
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 31 08:05:01 2020 +0100

    I#767 - Support for WebP images / photos
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/767

 src/e-util/e-html-editor-actions.c  | 23 ++++++++++++++++++++++-
 src/e-util/e-image-chooser-dialog.c |  7 +++++++
 src/em-format/e-mail-parser-image.c |  1 +
 3 files changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/src/e-util/e-html-editor-actions.c b/src/e-util/e-html-editor-actions.c
index 0c151a72a4..611cd2a67a 100644
--- a/src/e-util/e-html-editor-actions.c
+++ b/src/e-util/e-html-editor-actions.c
@@ -387,10 +387,31 @@ action_insert_image_cb (GtkAction *action,
 
                file_filter = gtk_file_filter_new ();
                gtk_file_filter_add_pixbuf_formats (file_filter);
-               gtk_file_filter_set_name (file_filter, _("Image file"));
+               gtk_file_filter_set_name (file_filter, _("Image files"));
+               gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), file_filter);
+               gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (native), file_filter);
+
+               file_filter = gtk_file_filter_new ();
+               gtk_file_filter_set_name (file_filter, _("All files"));
+               gtk_file_filter_add_pattern (file_filter, "*");
                gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), file_filter);
        } else {
+               GSList *filters, *link;
+
                dialog = e_image_chooser_dialog_new (C_("dialog-title", "Insert Image"), GTK_IS_WINDOW 
(toplevel) ? GTK_WINDOW (toplevel) : NULL);
+
+               filters = gtk_file_chooser_list_filters (GTK_FILE_CHOOSER (dialog));
+
+               for (link = filters; link; link = g_slist_next (link)) {
+                       GtkFileFilter *file_filter = link->data;
+
+                       if (g_strcmp0 (gtk_file_filter_get_name (file_filter), _("Image files")) == 0) {
+                               gtk_file_filter_add_mime_type (file_filter, "image/*");
+                               break;
+                       }
+               }
+
+               g_slist_free (filters);
        }
 
        if (dialog)
diff --git a/src/e-util/e-image-chooser-dialog.c b/src/e-util/e-image-chooser-dialog.c
index f501a473bd..d74836e1be 100644
--- a/src/e-util/e-image-chooser-dialog.c
+++ b/src/e-util/e-image-chooser-dialog.c
@@ -185,8 +185,15 @@ image_chooser_dialog_constructed (GObject *object)
 
        file_filter = gtk_file_filter_new ();
        gtk_file_filter_add_pixbuf_formats (file_filter);
+       gtk_file_filter_set_name (file_filter, _("Image files"));
+       gtk_file_chooser_add_filter (file_chooser, file_filter);
        gtk_file_chooser_set_filter (file_chooser, file_filter);
 
+       file_filter = gtk_file_filter_new ();
+       gtk_file_filter_set_name (file_filter, _("All files"));
+       gtk_file_filter_add_pattern (file_filter, "*");
+       gtk_file_chooser_add_filter (file_chooser, file_filter);
+
        gtk_file_chooser_set_preview_widget (file_chooser, gtk_image_new ());
 }
 
diff --git a/src/em-format/e-mail-parser-image.c b/src/em-format/e-mail-parser-image.c
index 3a0bc993e0..b998f62afb 100644
--- a/src/em-format/e-mail-parser-image.c
+++ b/src/em-format/e-mail-parser-image.c
@@ -52,6 +52,7 @@ static const gchar *parser_mime_types[] = {
        "image/x-xpixmap",
        "image/jpg",
        "image/pjpeg",
+       "image/webp",
        NULL
 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]