pidgin.next.minor: 795e93ed: Deprecate pidgin_set_custom_buddy_icon a...
deryni at pidgin.im
deryni at pidgin.im
Sat May 17 16:16:48 EDT 2008
-----------------------------------------------------------------
Revision: 795e93eda97c392c680630d8f8e52f6a9eb50937
Ancestor: 6f95c092ac2551b9a39ac2bf1586e43c3f033a61
Author: deryni at pidgin.im
Date: 2008-05-15T04:00:22
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/795e93eda97c392c680630d8f8e52f6a9eb50937
Modified files:
ChangeLog.API pidgin/gtkconv.c pidgin/gtkutils.c
pidgin/gtkutils.h
ChangeLog:
Deprecate pidgin_set_custom_buddy_icon and update the places that use it to
use purple_buddy_icons_node_set_custom_icon_from_file instead.
-------------- next part --------------
============================================================
--- ChangeLog.API 040faca49a2f792d861d57796a975e08daab3ae1
+++ ChangeLog.API a49297e808fa48a239c2260b00bc55692c5dfe7d
@@ -16,6 +16,7 @@ version 2.5.0:
* purple_buddy_icons_has_custom_icon
* purple_buddy_icons_find_custom_icon
* purple_buddy_icons_set_custom_icon
+ * pidgin_set_custom_buddy_icon
perl:
Added:
============================================================
--- pidgin/gtkconv.c f79a80b17eca3d68c420a64d2da77bc59ef3c795
+++ pidgin/gtkconv.c a4c7e6c3f68446f14f80e94bd2f1a49a490708bb
@@ -2724,10 +2724,22 @@ custom_icon_sel_cb(const char *filename,
custom_icon_sel_cb(const char *filename, gpointer data)
{
if (filename) {
+ const gchar *name;
+ PurpleBuddy *buddy;
+ PurpleContact *contact;
PidginConversation *gtkconv = data;
PurpleConversation *conv = gtkconv->active_conv;
PurpleAccount *account = purple_conversation_get_account(conv);
- pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), filename);
+
+ name = purple_conversation_get_name(conv);
+ buddy = purple_buddy_find(account, name);
+ if (!buddy) {
+ purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n");
+ return;
+ }
+ contact = purple_buddy_get_contact(buddy);
+
+ purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename);
}
}
@@ -2769,12 +2781,21 @@ remove_custom_icon_cb(GtkWidget *widget,
static void
remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv)
{
- PurpleConversation *conv;
+ const gchar *name;
+ PurpleBuddy *buddy;
PurpleAccount *account;
+ PurpleContact *contact;
+ PurpleConversation *conv = gtkconv->active_conv;
- conv = gtkconv->active_conv;
account = purple_conversation_get_account(conv);
- pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), NULL);
+ buddy = purple_buddy_find(account, name);
+ if (!buddy) {
+ return;
+ }
+ contact = purple_buddy_get_contact(buddy);
+ name = purple_conversation_get_name(conv);
+
+ purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, NULL);
}
static void
============================================================
--- pidgin/gtkutils.c 29d7ce72f5aef4a064bfa015392952a26e4da41f
+++ pidgin/gtkutils.c 30fe895e7ba24d90022f842e6980859a5b765ac7
@@ -1436,7 +1436,7 @@ static void dnd_image_ok_callback(_DndDa
static void dnd_image_ok_callback(_DndData *data, int choice)
{
- char *filedata;
+ gchar *filedata;
size_t size;
struct stat st;
GError *err = NULL;
@@ -1444,6 +1444,8 @@ static void dnd_image_ok_callback(_DndDa
PidginConversation *gtkconv;
GtkTextIter iter;
int id;
+ PurpleBuddy *buddy;
+ PurpleContact *contact;
switch (choice) {
case DND_BUDDY_ICON:
if (g_stat(data->filename, &st)) {
@@ -1459,7 +1461,13 @@ static void dnd_image_ok_callback(_DndDa
return;
}
- pidgin_set_custom_buddy_icon(data->account, data->who, data->filename);
+ buddy = purple_buddy_find(account, data->who);
+ if (!buddy) {
+ purple_debug_info("custom-icon", "You can only set custom icons for people on your buddylist.\n");
+ break;
+ }
+ contact = purple_buddy_get_contact(buddy);
+ purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, data->filename);
break;
case DND_FILE_TRANSFER:
serv_send_file(purple_account_get_connection(data->account), data->who, data->filename);
@@ -2869,6 +2877,7 @@ gdk_pixbuf_new_from_file_at_scale(const
}
#endif /* ! Gtk 2.6.0 */
+#ifndef PURPLE_DISABLE_DEPRECATED
void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename)
{
PurpleBuddy *buddy;
@@ -2883,6 +2892,7 @@ void pidgin_set_custom_buddy_icon(Purple
contact = purple_buddy_get_contact(buddy);
purple_buddy_icons_node_set_custom_icon_from_file((PurpleBlistNode*)contact, filename);
}
+#endif
char *pidgin_make_pretty_arrows(const char *str)
{
============================================================
--- pidgin/gtkutils.h d10e5f3c18a50b0fde0d5a1dd5dcadc585734e24
+++ pidgin/gtkutils.h 57417e9bb85ab3bc1ebd6b8b6b3142687fa192c5
@@ -638,6 +638,7 @@ GdkPixbuf *gdk_pixbuf_new_from_file_at_s
GError **error);
#endif
+#ifndef PURPLE_DISABLE_DEPRECATED
/**
* Set or unset a custom buddyicon for a user.
*
@@ -645,8 +646,10 @@ GdkPixbuf *gdk_pixbuf_new_from_file_at_s
* @param who The name of the user.
* @param filename The path of the custom icon. If this is @c NULL, then any
* previously set custom buddy icon for the user is removed.
+ * @deprecated See purple_buddy_icons_node_set_custom_icon_from_file()
*/
void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename);
+#endif
/**
* Converts "->" and "<-" in strings to Unicode arrow characters, for use in referencing
More information about the Commits
mailing list