pidgin/pidgin

Remove the icon from PurpleIMConversation

17 months ago, Gary Kramlich
e2d8eb34ebe7
Parents 4809f699d6c9
Children 139203f90d33
Remove the icon from PurpleIMConversation

The intent is to move this functionality to PurpleConversation once PurpleAvatar
has laned, so this just moves the exist code out of the way.

Testing Done:
Ran the tests and ran with demo and xmmp accounts. Avatars are busted in the info pane at the moment.

Reviewed at https://reviews.imfreedom.org/r/2114/
--- a/libpurple/buddyicon.c Wed Dec 14 03:35:59 2022 -0600
+++ b/libpurple/buddyicon.c Wed Dec 14 03:36:52 2022 -0600
@@ -379,8 +379,6 @@
void
purple_buddy_icon_update(PurpleBuddyIcon *icon)
{
- PurpleConversation *im;
- PurpleConversationManager *manager;
PurpleAccount *account;
const char *username;
PurpleBuddyIcon *icon_to_set;
@@ -442,13 +440,6 @@
buddies = g_slist_delete_link(buddies, buddies);
}
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, account, username);
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- purple_im_conversation_set_icon(PURPLE_IM_CONVERSATION(im),
- icon_to_set);
- }
-
/* icon's refcount was incremented above */
purple_buddy_icon_unref(icon);
}
--- a/libpurple/purpleimconversation.c Wed Dec 14 03:35:59 2022 -0600
+++ b/libpurple/purpleimconversation.c Wed Dec 14 03:36:52 2022 -0600
@@ -35,14 +35,11 @@
guint typing_timeout;
time_t type_again;
guint send_typed_timeout;
-
- PurpleBuddyIcon *icon;
};
enum {
PROP_0 = 0,
PROP_TYPING_STATE,
- PROP_ICON,
N_PROPERTIES,
};
static GParamSpec *properties[N_PROPERTIES];
@@ -126,9 +123,6 @@
g_value_set_enum(value,
purple_im_conversation_get_typing_state(im));
break;
- case PROP_ICON:
- g_value_set_pointer(value, purple_im_conversation_get_icon(im));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
break;
@@ -146,9 +140,6 @@
purple_im_conversation_set_typing_state(im,
g_value_get_enum(value));
break;
- case PROP_ICON:
- purple_im_conversation_set_icon(im, g_value_get_pointer(value));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
break;
@@ -160,39 +151,6 @@
}
static void
-purple_im_conversation_constructed(GObject *object) {
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(object);
- PurpleAccount *account = NULL;
- PurpleBuddyIcon *icon = NULL;
- gchar *name = NULL;
-
- G_OBJECT_CLASS(purple_im_conversation_parent_class)->constructed(object);
-
- g_object_get(object,
- "account", &account,
- "name", &name,
- NULL);
-
- if((icon = purple_buddy_icons_find(account, name))) {
- purple_im_conversation_set_icon(im, icon);
- /* purple_im_conversation_set_icon refs the icon. */
- purple_buddy_icon_unref(icon);
- }
-
- g_object_unref(account);
- g_free(name);
-}
-
-static void
-purple_im_conversation_dispose(GObject *obj) {
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
-
- g_clear_pointer(&im->icon, purple_buddy_icon_unref);
-
- G_OBJECT_CLASS(purple_im_conversation_parent_class)->dispose(obj);
-}
-
-static void
purple_im_conversation_finalize(GObject *obj) {
PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
PurpleConnection *pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
@@ -224,9 +182,7 @@
obj_class->get_property = purple_im_conversation_get_property;
obj_class->set_property = purple_im_conversation_set_property;
- obj_class->dispose = purple_im_conversation_dispose;
obj_class->finalize = purple_im_conversation_finalize;
- obj_class->constructed = purple_im_conversation_constructed;
conv_class->write_message = im_conversation_write_message;
@@ -236,10 +192,6 @@
PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
- properties[PROP_ICON] = g_param_spec_pointer(
- "icon", "Buddy icon", "The buddy icon for the IM.",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
}
@@ -272,31 +224,6 @@
}
void
-purple_im_conversation_set_icon(PurpleIMConversation *im,
- PurpleBuddyIcon *icon)
-{
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- if(im->icon != icon) {
- purple_buddy_icon_unref(im->icon);
-
- im->icon = (icon == NULL) ? NULL : purple_buddy_icon_ref(icon);
-
- g_object_notify_by_pspec(G_OBJECT(im), properties[PROP_ICON]);
- }
-
- purple_conversation_update(PURPLE_CONVERSATION(im),
- PURPLE_CONVERSATION_UPDATE_ICON);
-}
-
-PurpleBuddyIcon *
-purple_im_conversation_get_icon(PurpleIMConversation *im) {
- g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), NULL);
-
- return im->icon;
-}
-
-void
purple_im_conversation_set_typing_state(PurpleIMConversation *im,
PurpleIMTypingState state)
{
--- a/libpurple/purpleimconversation.h Wed Dec 14 03:35:59 2022 -0600
+++ b/libpurple/purpleimconversation.h Wed Dec 14 03:36:52 2022 -0600
@@ -55,7 +55,7 @@
typedef struct _PurpleIMConversation PurpleIMConversation;
typedef struct _PurpleIMConversationClass PurpleIMConversationClass;
-#include "buddyicon.h"
+#include "account.h"
#include <purpleconversation.h>
/**
@@ -98,30 +98,6 @@
PurpleConversation *purple_im_conversation_new(PurpleAccount *account, const gchar *name);
/**
- * purple_im_conversation_set_icon:
- * @im: The IM.
- * @icon: The buddy icon.
- *
- * Sets the IM's buddy icon.
- *
- * This should only be called from within Purple. You probably want to
- * call purple_buddy_icon_set_data().
- *
- * See purple_buddy_icon_set_data().
- */
-void purple_im_conversation_set_icon(PurpleIMConversation *im, PurpleBuddyIcon *icon);
-
-/**
- * purple_im_conversation_get_icon:
- * @im: The IM.
- *
- * Returns the IM's buddy icon.
- *
- * Returns: (transfer none): The buddy icon.
- */
-PurpleBuddyIcon *purple_im_conversation_get_icon(PurpleIMConversation *im);
-
-/**
* purple_im_conversation_set_typing_state:
* @im: The IM.
* @state: The typing state.
--- a/pidgin/pidginaddbuddydialog.c Wed Dec 14 03:35:59 2022 -0600
+++ b/pidgin/pidginaddbuddydialog.c Wed Dec 14 03:36:52 2022 -0600
@@ -96,8 +96,6 @@
if(response_id == GTK_RESPONSE_OK) {
PurpleAccount *account = NULL;
PurpleBuddy *buddy = NULL;
- PurpleConversation *im = NULL;
- PurpleConversationManager *manager = NULL;
PurpleGroup *group = NULL;
const gchar *username = NULL, *alias = NULL, *message = NULL;
gchar *groupname = NULL;
@@ -168,18 +166,6 @@
}
#endif
- /* Finally update the icon for any open im's with this person. */
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, account, username);
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- PurpleBuddyIcon *icon = NULL;
-
- icon = purple_im_conversation_get_icon(PURPLE_IM_CONVERSATION(im));
- if(icon != NULL) {
- purple_buddy_icon_update(icon);
- }
- }
-
g_free(groupname);
}
--- a/pidgin/pidginavatar.c Wed Dec 14 03:35:59 2022 -0600
+++ b/pidgin/pidginavatar.c Wed Dec 14 03:36:52 2022 -0600
@@ -72,7 +72,7 @@
static GdkPixbufAnimation *
pidgin_avatar_find_buddy_icon(PurpleBuddy *buddy,
- PurpleConversation *conversation)
+ G_GNUC_UNUSED PurpleConversation *conversation)
{
GdkPixbufAnimation *ret = NULL;
GInputStream *stream = NULL;
@@ -107,17 +107,6 @@
}
}
- /* Finally if we still don't have icon, we fallback to asking the
- * conversation for one.
- */
- if(!G_IS_INPUT_STREAM(stream) && PURPLE_IS_IM_CONVERSATION(conversation)) {
- PurpleBuddyIcon *icon = purple_im_conversation_get_icon(PURPLE_IM_CONVERSATION(conversation));
-
- if(icon != NULL) {
- stream = purple_buddy_icon_get_stream(icon);
- }
- }
-
if(G_IS_INPUT_STREAM(stream)) {
ret = gdk_pixbuf_animation_new_from_stream(stream, NULL, NULL);
g_clear_object(&stream);