/pidgin/main: aba982dbb801: Fix sizing for the file-chooser imag...
Elliott Sales de Andrade
qulogic at pidgin.im
Tue Aug 28 03:43:24 EDT 2012
Changeset: aba982dbb8018b3de0d6bfca62f4307db9f8dde1
Author: Elliott Sales de Andrade <qulogic at pidgin.im>
Date: 2012-08-28 03:39 -0400
Branch: release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/aba982dbb801
Description:
Fix sizing for the file-chooser image preview.
Fixes #15282.
diffstat:
pidgin/gtkutils.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diffs (46 lines):
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -2256,7 +2256,7 @@ icon_filesel_choose_cb(GtkWidget *widget
static void
icon_preview_change_cb(GtkFileChooser *widget, struct _icon_chooser *dialog)
{
- GdkPixbuf *pixbuf, *scale;
+ GdkPixbuf *pixbuf;
int height, width;
char *basename, *markup, *size;
struct stat st;
@@ -2265,7 +2265,7 @@ icon_preview_change_cb(GtkFileChooser *w
filename = gtk_file_chooser_get_preview_filename(
GTK_FILE_CHOOSER(dialog->icon_filesel));
- if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file(filename)))
+ if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file_at_size(filename, 128, 128)))
{
gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL);
gtk_label_set_markup(GTK_LABEL(dialog->icon_text), "");
@@ -2273,8 +2273,7 @@ icon_preview_change_cb(GtkFileChooser *w
return;
}
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
+ gdk_pixbuf_get_file_info(filename, &width, &height);
basename = g_path_get_basename(filename);
size = purple_str_size_to_units(st.st_size);
markup = g_strdup_printf(_("<b>File:</b> %s\n"
@@ -2282,13 +2281,10 @@ icon_preview_change_cb(GtkFileChooser *w
"<b>Image size:</b> %dx%d"),
basename, size, width, height);
- scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height,
- 50, GDK_INTERP_BILINEAR);
- gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), scale);
+ gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), pixbuf);
gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup);
g_object_unref(G_OBJECT(pixbuf));
- g_object_unref(G_OBJECT(scale));
g_free(filename);
g_free(basename);
g_free(size);
More information about the Commits
mailing list