summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <alexm@gnome.org>2021-11-30 02:19:17 +0500
committerAlexander Mikhaylenko <alexm@gnome.org>2021-12-01 00:43:47 +0500
commit7529e31b41879fbd1a0ced608c9f629dda031888 (patch)
tree9a79f16010569d3ae288fd00e2ea433ec99a484a /lib
parent7683252c59c25dadd843053d30985835c5fe8dbf (diff)
downloadepiphany-7529e31b41879fbd1a0ced608c9f629dda031888.tar.gz
file-chooser: Remove preview
This will stop working in GTK4. Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1035>
Diffstat (limited to 'lib')
-rw-r--r--lib/widgets/ephy-file-chooser.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/widgets/ephy-file-chooser.c b/lib/widgets/ephy-file-chooser.c
index e787242b5..1b6dd213c 100644
--- a/lib/widgets/ephy-file-chooser.c
+++ b/lib/widgets/ephy-file-chooser.c
@@ -36,9 +36,6 @@
#include <sys/stat.h>
#include <sys/types.h>
-#define MAX_PREVIEW_SIZE 180
-#define MAX_PREVIEW_SOURCE_SIZE 4096
-
static GtkFileFilter *
ephy_file_chooser_add_pattern_filter (GtkFileChooser *dialog,
const char *title,
@@ -95,53 +92,6 @@ ephy_file_chooser_add_mime_filter (GtkFileChooser *dialog,
return filth;
}
-static void
-update_preview_cb (GtkFileChooser *file_chooser,
- gpointer data)
-{
- GtkImage *preview = GTK_IMAGE (data);
- g_autofree char *filename = gtk_file_chooser_get_preview_filename (file_chooser);
- gint preview_width = 0;
- gint preview_height = 0;
- struct g_stat st_buf;
- g_autoptr (GdkPixbuf) pixbuf = NULL;
-
- GdkPixbufFormat *preview_format = gdk_pixbuf_get_file_info (filename,
- &preview_width,
- &preview_height);
-
- if (!filename || g_stat (filename, &st_buf) || (!S_ISREG (st_buf.st_mode))) {
- gtk_file_chooser_set_preview_widget_active (file_chooser, FALSE);
- return; /* stat failed or file is not regular */
- }
-
- if (!preview_format ||
- preview_width <= 0 || preview_height <= 0 ||
- preview_width > MAX_PREVIEW_SOURCE_SIZE ||
- preview_height > MAX_PREVIEW_SOURCE_SIZE) {
- gtk_file_chooser_set_preview_widget_active (file_chooser, FALSE);
- return; /* unpreviewable, 0px, or unsafely large */
- }
-
- if (preview_width > MAX_PREVIEW_SIZE || preview_height > MAX_PREVIEW_SIZE) {
- pixbuf = gdk_pixbuf_new_from_file_at_size (filename,
- MAX_PREVIEW_SIZE,
- MAX_PREVIEW_SIZE,
- NULL);
- } else {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- }
-
- pixbuf = gdk_pixbuf_apply_embedded_orientation (pixbuf);
-
- gtk_widget_set_size_request (GTK_WIDGET (preview),
- gdk_pixbuf_get_width (pixbuf) + 6,
- gdk_pixbuf_get_height (pixbuf) + 6);
-
- gtk_image_set_from_pixbuf (preview, pixbuf);
- gtk_file_chooser_set_preview_widget_active (file_chooser, pixbuf != NULL);
-}
-
GtkFileChooser *
ephy_create_file_chooser (const char *title,
GtkWidget *parent,
@@ -152,7 +102,6 @@ ephy_create_file_chooser (const char *title,
GtkFileChooser *dialog;
GtkFileFilter *filter[EPHY_FILE_FILTER_LAST];
g_autofree char *downloads_dir = NULL;
- GtkWidget *preview = gtk_image_new ();
g_assert (GTK_IS_WINDOW (toplevel_window));
g_assert (default_filter >= 0 && default_filter <= EPHY_FILE_FILTER_LAST);
@@ -175,12 +124,6 @@ ephy_create_file_chooser (const char *title,
gtk_file_chooser_native_set_accept_label (GTK_FILE_CHOOSER_NATIVE (dialog), _("_Save"));
}
- gtk_file_chooser_set_preview_widget (dialog, preview);
- gtk_file_chooser_set_use_preview_label (dialog, FALSE);
- g_signal_connect (dialog, "update-preview",
- G_CALLBACK (update_preview_cb),
- preview);
-
if (default_filter != EPHY_FILE_FILTER_NONE) {
filter[EPHY_FILE_FILTER_ALL_SUPPORTED] =
ephy_file_chooser_add_mime_filter