pidgin: 75a466dd: Allow adding received animated custom sm...
sadrul at pidgin.im
sadrul at pidgin.im
Fri Jun 5 04:20:37 EDT 2009
-----------------------------------------------------------------
Revision: 75a466dd96590961d154c6e5d131d85bcae642c6
Ancestor: 4bc859814dd505949045282148a1dc8b22b24b9c
Author: Andrea Piccinelli <frasten at gmail.com>
Date: 2009-06-05T08:23:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/75a466dd96590961d154c6e5d131d85bcae642c6
Modified files:
COPYRIGHT ChangeLog ChangeLog.API pidgin/gtkimhtml.c
pidgin/gtksmiley.c pidgin/gtksmiley.h
ChangeLog:
Allow adding received animated custom smileys to locale custom smiley
collection. Closes #9066.
-------------- next part --------------
============================================================
--- COPYRIGHT 107ceebb15f4890d92680e414555317d5755b2d9
+++ COPYRIGHT d809801373767fe1e915a3289d95b740ec5ddc0b
@@ -333,6 +333,7 @@ Sebasti?n E. Peyrott
Diego Petten
Nathan Peterson
Sebasti?n E. Peyrott
+Andrea Piccinelli
Celso Pinto
Joao Lu?s Marques Pinto
Aleksander Piotrowski
============================================================
--- ChangeLog 711deeecd87b2a066a1efa1c5ebfd61b06507fbb
+++ ChangeLog 17c5345111810fcd034e595bf4b5070c4d3f5a75
@@ -87,6 +87,8 @@ version 2.6.0 (??/??/2009):
* Fix a bug in 'Conversation Colors' plugin for RTL messages.
* Pressing the Left and Right arrow keys in the buddy list will expand and
collapse buddy groups or contacts. (Peter Ruibal)
+ * Support saving animated custom smileys as animated images or animated
+ custom smileys. (Andrea Piccinelli)
Finch:
* The hardware cursor is updated correctly. This will be useful
============================================================
--- ChangeLog.API 9d3dd0399c2293767704bd32ed03fc28edc4270f
+++ ChangeLog.API d830549bb581057b20cd31910695ec02ef13efe8
@@ -94,6 +94,7 @@ version 2.6.0 (??/??/2009):
* pidgin_blist_set_theme
* pidgin_blist_get_theme
* pidgin_prefs_labeled_password
+ * pidgin_smiley_editor_set_data
* pidgin_sound_is_customized
* pidgin_utils_init, pidgin_utils_uninit
* pidgin_notify_pounce_add
============================================================
--- pidgin/gtkimhtml.c a2b15240fc9c6d228b99707b6b548cfc26cb1718
+++ pidgin/gtkimhtml.c dbac774b62d76fbe1371ea71c3ef06ad47d947f2
@@ -3867,12 +3867,15 @@ static void
}
static void
-gtk_imhtml_custom_smiley_save(GtkWidget *w, GtkIMHtmlImage *image)
+gtk_imhtml_custom_smiley_save(GtkWidget *w, GtkIMHtmlImageSave *save)
{
+ GtkIMHtmlImage *image = (GtkIMHtmlImage *)save->image;
+
/* Create an add dialog */
PidginSmiley *editor = pidgin_smiley_edit(NULL, NULL);
pidgin_smiley_editor_set_shortcut(editor, image->filename);
pidgin_smiley_editor_set_image(editor, image->pixbuf);
+ pidgin_smiley_editor_set_data(editor, save->data, save->datasize);
}
/*
@@ -3907,7 +3910,7 @@ static gboolean gtk_imhtml_image_clicked
item = gtk_image_menu_item_new_with_mnemonic(_("_Add Custom Smiley..."));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), img);
g_signal_connect(G_OBJECT(item), "activate",
- G_CALLBACK(gtk_imhtml_custom_smiley_save), image);
+ G_CALLBACK(gtk_imhtml_custom_smiley_save), save);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
}
============================================================
--- pidgin/gtksmiley.c a942afe215c036667a01ec770970ac37e288b0b5
+++ pidgin/gtksmiley.c 615f98ea6e40fa5facb3d9143fb601f73822ca73
@@ -47,6 +47,8 @@ struct _PidginSmiley
GtkWidget *smiley_image;
gchar *filename;
GdkPixbuf *custom_pixbuf;
+ gpointer data; /** @since 2.6.0 */
+ gsize datasize; /** @since 2.6.0 */
};
typedef struct
@@ -277,7 +279,6 @@ static void do_add(GtkWidget *widget, Pi
purple_debug_info("gtksmiley", "adding a new smiley\n");
if (s->filename == NULL) {
- /* Get the smiley from the custom pixbuf */
gchar *buffer = NULL;
gsize size = 0;
gchar *filename;
@@ -296,8 +297,16 @@ static void do_add(GtkWidget *widget, Pi
}
}
- gdk_pixbuf_save_to_buffer(s->custom_pixbuf, &buffer, &size,
- "png", NULL, "compression", "9", NULL, NULL);
+ if (s->data && s->datasize) {
+ /* Cached data & size in memory */
+ buffer = s->data;
+ size = s->datasize;
+ }
+ else {
+ /* Get the smiley from the custom pixbuf */
+ gdk_pixbuf_save_to_buffer(s->custom_pixbuf, &buffer, &size,
+ "png", NULL, "compression", "9", NULL, NULL);
+ }
filename = purple_util_get_image_filename(buffer, size);
s->filename = g_build_filename(dirname, filename, NULL);
purple_util_write_data_to_file_absolute(s->filename, buffer, size);
@@ -465,6 +474,13 @@ pidgin_smiley_editor_set_image(PidginSmi
gtk_image_set_from_pixbuf(GTK_IMAGE(editor->smiley_image), image);
}
+void
+pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer *data, gsize datasize)
+{
+ editor->data = data;
+ editor->datasize = datasize;
+}
+
/******************************************************************************
* Delete smiley
*****************************************************************************/
============================================================
--- pidgin/gtksmiley.h a76d7590c1a4ff856badead1903f04baa10fc452
+++ pidgin/gtksmiley.h 447fd2e0e30f069b365e6e39de31fa876f1fd95b
@@ -100,4 +100,15 @@ void pidgin_smiley_editor_set_image(Pidg
*/
void pidgin_smiley_editor_set_image(PidginSmiley *editor, GdkPixbuf *image);
+/**
+ * Sets the image data in a smiley add dialog
+ *
+ * @param editor A smiley editor dialog
+ * @param data A pointer to smiley's data
+ * @param datasize The size of smiley's data
+ *
+ * @since 2.6.0
+ */
+void pidgin_smiley_editor_set_data(PidginSmiley *editor, gpointer *data, gsize datasize);
+
#endif /* PIDGIN_GTKSMILEY_H */
More information about the Commits
mailing list