comparison audacious/ui_fileinfo.c @ 1299:ead95abdf9bc trunk

[svn] - downsize images larger than 150px
author nenolod
date Sun, 18 Jun 2006 22:14:56 -0700
parents 61b576d80cbb
children a5c4e748d557
comparison
equal deleted inserted replaced
1298:61b576d80cbb 1299:ead95abdf9bc
99 static void 99 static void
100 fileinfo_entry_set_image(const char *entry, const char *text) 100 fileinfo_entry_set_image(const char *entry, const char *text)
101 { 101 {
102 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); 102 GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml");
103 GtkWidget *widget = glade_xml_get_widget(xml, entry); 103 GtkWidget *widget = glade_xml_get_widget(xml, entry);
104 104 GdkPixbuf *pixbuf;
105 if (xml == NULL || widget == NULL) 105
106 return; 106 if (xml == NULL || widget == NULL)
107 107 return;
108 gtk_image_set_from_file(GTK_IMAGE(widget), text); 108
109 pixbuf = gdk_pixbuf_new_from_file(text, NULL);
110
111 if (pixbuf == NULL)
112 return;
113
114 if (gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)) > 150)
115 {
116 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), 150, 150, GDK_INTERP_BILINEAR);
117 g_object_unref(G_OBJECT(pixbuf));
118 pixbuf = pixbuf2;
119 }
120
121 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
109 } 122 }
110 123
111 static void 124 static void
112 filepopup_entry_set_text(const char *entry, const char *text) 125 filepopup_entry_set_text(const char *entry, const char *text)
113 { 126 {
123 static void 136 static void
124 filepopup_entry_set_image(const char *entry, const char *text) 137 filepopup_entry_set_image(const char *entry, const char *text)
125 { 138 {
126 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); 139 GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml");
127 GtkWidget *widget = glade_xml_get_widget(xml, entry); 140 GtkWidget *widget = glade_xml_get_widget(xml, entry);
128 141 GdkPixbuf *pixbuf;
129 if (xml == NULL || widget == NULL) 142
130 return; 143 if (xml == NULL || widget == NULL)
131 144 return;
132 gtk_image_set_from_file(GTK_IMAGE(widget), text); 145
146 pixbuf = gdk_pixbuf_new_from_file(text, NULL);
147
148 if (pixbuf == NULL)
149 return;
150
151 if (gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)) > 150)
152 {
153 GdkPixbuf *pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), 150, 150, GDK_INTERP_BILINEAR);
154 g_object_unref(G_OBJECT(pixbuf));
155 pixbuf = pixbuf2;
156 }
157
158 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
133 } 159 }
134 160
135 static void 161 static void
136 filepopup_entry_set_text_free(const char *entry, char *text) 162 filepopup_entry_set_text_free(const char *entry, char *text)
137 { 163 {