pidgin.custom_smiley: 1949dfef: Add a utility function to create a pixbu...
sadrul at pidgin.im
sadrul at pidgin.im
Mon Apr 28 02:38:38 EDT 2008
-----------------------------------------------------------------
Revision: 1949dfef928706d1bdb9fb6217e9895c30f20903
Ancestor: 29b52264b7fca69f8bdbddd69a072ac6da9be76d
Author: sadrul at pidgin.im
Date: 2008-04-28T06:24:01
Branch: im.pidgin.pidgin.custom_smiley
URL: http://d.pidgin.im/viewmtn/revision/info/1949dfef928706d1bdb9fb6217e9895c30f20903
Modified files:
ChangeLog.API pidgin/gtkaccount.c pidgin/gtkutils.c
pidgin/gtkutils.h
ChangeLog:
Add a utility function to create a pixbuf from a stored image.
-------------- next part --------------
============================================================
--- ChangeLog.API 70243d3d55da6e0852af6709f46238c4a79fa712
+++ ChangeLog.API d198085e139ff002884ea5ad13772718caadfaa4
@@ -5,6 +5,8 @@ version 2.5.0 (??/??/2008):
Added:
* gtk_imhtml_smiley_create, gtk_imhtml_smiley_reload and
gtk_imhtml_smiley_destroy to deal with GtkIMHtmlSmiley's.
+ * pidgin_pixbuf_from_imgstore to create a GdkPixbuf from a
+ PurpleStoredImage.
version 2.x.x:
perl:
============================================================
--- pidgin/gtkaccount.c eab593e665e6425c44421c59170ecfbc811cdcfb
+++ pidgin/gtkaccount.c 14fd872c731f92925f99aad520823736faf186ea
@@ -176,14 +176,7 @@ set_dialog_icon(AccountPrefsDialog *dial
}
if (dialog->icon_img != NULL) {
- GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(dialog->icon_img),
- purple_imgstore_get_size(dialog->icon_img), NULL);
- gdk_pixbuf_loader_close(loader, NULL);
- pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
- if (pixbuf)
- g_object_ref(pixbuf);
- g_object_unref(loader);
+ pixbuf = pidgin_pixbuf_from_imgstore(dialog->icon_img);
}
if (pixbuf && dialog->prpl_info &&
@@ -1975,21 +1968,14 @@ set_account(GtkListStore *store, GtkTree
}
if (img != NULL) {
- GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
GdkPixbuf *buddyicon_pixbuf;
-
- gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(img),
- purple_imgstore_get_size(img), NULL);
- gdk_pixbuf_loader_close(loader, NULL);
- buddyicon_pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
-
+ buddyicon_pixbuf = pidgin_pixbuf_from_imgstore(img);
purple_imgstore_unref(img);
if (buddyicon_pixbuf != NULL) {
buddyicon = gdk_pixbuf_scale_simple(buddyicon_pixbuf, 22, 22, GDK_INTERP_HYPER);
+ g_object_unref(G_OBJECT(buddyicon_pixbuf));
}
-
- g_object_unref(loader);
}
gtk_list_store_set(store, iter,
============================================================
--- pidgin/gtkutils.c 96e7360d76e67c6ceb5e31f681a0214540c4d64b
+++ pidgin/gtkutils.c 9fb8e9f9aade08b4330d2f30f65f42ddc91fb95f
@@ -3467,3 +3467,17 @@ gboolean pidgin_auto_parent_window(GtkWi
#endif
}
+GdkPixbuf * pidgin_pixbuf_from_imgstore(PurpleStoredImage *image)
+{
+ GdkPixbuf *pixbuf;
+ GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
+ gdk_pixbuf_loader_write(loader, purple_imgstore_get_data(image),
+ purple_imgstore_get_size(image), NULL);
+ gdk_pixbuf_loader_close(loader, NULL);
+ pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
+ if (pixbuf)
+ g_object_ref(pixbuf);
+ g_object_unref(loader);
+ return pixbuf;
+}
+
============================================================
--- pidgin/gtkutils.h d10e5f3c18a50b0fde0d5a1dd5dcadc585734e24
+++ pidgin/gtkutils.h 49f69f73201d37c82228baabb135cf765c46e9fe
@@ -689,7 +689,7 @@ GtkWidget *pidgin_make_mini_dialog(Purpl
*/
GtkWidget *pidgin_make_mini_dialog(PurpleConnection *handle,
const char* stock_id, const char *primary, const char *secondary,
- void *user_data, ...);
+ void *user_data, ...) G_GNUC_NULL_TERMINATED;
/**
* This is a callback function to be used for Ctrl+F searching in treeviews.
@@ -809,5 +809,15 @@ GtkWidget *pidgin_add_widget_to_vbox(Gtk
*/
GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label);
+/**
+ * Create a GdkPixbuf from a PurpleStoredImage.
+ *
+ * @param image A PurpleStoredImage.
+ *
+ * @return A GdkPixbuf created from the stored image.
+ * @since 2.5.0
+ */
+GdkPixbuf * pidgin_pixbuf_from_imgstore(PurpleStoredImage *image);
+
#endif /* _PIDGINUTILS_H_ */
More information about the Commits
mailing list