| 118 g_object_set(G_OBJECT(settings), "default-font-family", |
116 g_object_set(G_OBJECT(settings), "default-font-family", |
| 119 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"), |
117 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/custom_font"), |
| 120 NULL); |
118 NULL); |
| 121 |
119 |
| 122 webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); |
120 webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), settings); |
| |
121 g_object_unref(settings); |
| 123 } |
122 } |
| 124 #endif |
123 #endif |
| 125 } |
124 } |
| 126 |
125 |
| 127 static |
126 static |
| 1409 |
1408 |
| 1410 break; |
1409 break; |
| 1411 } |
1410 } |
| 1412 shortname = strrchr(data->filename, G_DIR_SEPARATOR); |
1411 shortname = strrchr(data->filename, G_DIR_SEPARATOR); |
| 1413 shortname = shortname ? shortname + 1 : data->filename; |
1412 shortname = shortname ? shortname + 1 : data->filename; |
| 1414 id = purple_imgstore_add_with_id(filedata, size, shortname); |
1413 id = purple_imgstore_new_with_id(filedata, size, shortname); |
| 1415 |
1414 |
| 1416 gtk_webview_insert_image(GTK_WEBVIEW(gtkconv->entry), id); |
1415 gtk_webview_insert_image(GTK_WEBVIEW(gtkconv->entry), id); |
| 1417 purple_imgstore_unref_by_id(id); |
1416 purple_imgstore_unref_by_id(id); |
| 1418 |
1417 |
| 1419 break; |
1418 break; |
| 2160 |
2159 |
| 2161 |
2160 |
| 2162 static void |
2161 static void |
| 2163 icon_preview_change_cb(GtkFileChooser *widget, struct _icon_chooser *dialog) |
2162 icon_preview_change_cb(GtkFileChooser *widget, struct _icon_chooser *dialog) |
| 2164 { |
2163 { |
| 2165 GdkPixbuf *pixbuf, *scale; |
2164 GdkPixbuf *pixbuf; |
| 2166 int height, width; |
2165 int height, width; |
| 2167 char *basename, *markup, *size; |
2166 char *basename, *markup, *size; |
| 2168 struct stat st; |
2167 struct stat st; |
| 2169 char *filename; |
2168 char *filename; |
| 2170 |
2169 |
| 2171 filename = gtk_file_chooser_get_preview_filename( |
2170 filename = gtk_file_chooser_get_preview_filename( |
| 2172 GTK_FILE_CHOOSER(dialog->icon_filesel)); |
2171 GTK_FILE_CHOOSER(dialog->icon_filesel)); |
| 2173 |
2172 |
| 2174 if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file(filename))) |
2173 if (!filename || g_stat(filename, &st) || !(pixbuf = pidgin_pixbuf_new_from_file_at_size(filename, 128, 128))) |
| 2175 { |
2174 { |
| 2176 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL); |
2175 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), NULL); |
| 2177 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), ""); |
2176 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), ""); |
| 2178 g_free(filename); |
2177 g_free(filename); |
| 2179 return; |
2178 return; |
| 2180 } |
2179 } |
| 2181 |
2180 |
| 2182 width = gdk_pixbuf_get_width(pixbuf); |
2181 gdk_pixbuf_get_file_info(filename, &width, &height); |
| 2183 height = gdk_pixbuf_get_height(pixbuf); |
|
| 2184 basename = g_path_get_basename(filename); |
2182 basename = g_path_get_basename(filename); |
| 2185 size = purple_str_size_to_units(st.st_size); |
2183 size = purple_str_size_to_units(st.st_size); |
| 2186 markup = g_strdup_printf(_("<b>File:</b> %s\n" |
2184 markup = g_strdup_printf(_("<b>File:</b> %s\n" |
| 2187 "<b>File size:</b> %s\n" |
2185 "<b>File size:</b> %s\n" |
| 2188 "<b>Image size:</b> %dx%d"), |
2186 "<b>Image size:</b> %dx%d"), |
| 2189 basename, size, width, height); |
2187 basename, size, width, height); |
| 2190 |
2188 |
| 2191 scale = gdk_pixbuf_scale_simple(pixbuf, width * 50 / height, |
2189 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), pixbuf); |
| 2192 50, GDK_INTERP_BILINEAR); |
|
| 2193 gtk_image_set_from_pixbuf(GTK_IMAGE(dialog->icon_preview), scale); |
|
| 2194 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup); |
2190 gtk_label_set_markup(GTK_LABEL(dialog->icon_text), markup); |
| 2195 |
2191 |
| 2196 g_object_unref(G_OBJECT(pixbuf)); |
2192 g_object_unref(G_OBJECT(pixbuf)); |
| 2197 g_object_unref(G_OBJECT(scale)); |
|
| 2198 g_free(filename); |
2193 g_free(filename); |
| 2199 g_free(basename); |
2194 g_free(basename); |
| 2200 g_free(size); |
2195 g_free(size); |
| 2201 g_free(markup); |
2196 g_free(markup); |
| 2202 } |
2197 } |