pidgin/pidgin

Remove all drag and drop support.

2022-03-17, Gary Kramlich
4a8bdbae8d8b
Parents 6d816e02fd76
Children fa932768f319
Remove all drag and drop support.

Since Drag and Drop changed completely in GTK4 it'll be much easier if we
reimplement it after converting the widgets that should have it.

Testing Done:
Ran and verified everything basically worked.

Reviewed at https://reviews.imfreedom.org/r/1329/
--- a/ChangeLog.API Mon Mar 14 01:18:18 2022 -0500
+++ b/ChangeLog.API Thu Mar 17 21:41:10 2022 -0500
@@ -767,6 +767,7 @@
* PidginWindow renamed to PidginConvWindow
Removed:
+ * conversation-dragging (gtkconv signal)
* conversation-timestamp (gtkconv signal)
* conversation-hiding (gtkconv signal)
* GtkIMHtml.clipboard_html_string
--- a/pidgin/gtkaccount.c Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/gtkaccount.c Thu Mar 17 21:41:10 2022 -0500
@@ -74,7 +74,6 @@
GtkWidget *delete_button;
GtkListStore *model;
- GtkTreeIter drag_iter;
GtkTreeViewColumn *username_col;
@@ -349,42 +348,6 @@
}
static void
-account_dnd_recv(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
- GtkSelectionData *sd, guint info, guint t, AccountPrefsDialog *dialog)
-{
- const gchar *name = (gchar *)gtk_selection_data_get_data(sd);
- gint length = gtk_selection_data_get_length(sd);
- gint format = gtk_selection_data_get_format(sd);
-
- if ((length >= 0) && (format == 8)) {
- /* Well, it looks like the drag event was cool.
- * Let's do something with it */
- if (!g_ascii_strncasecmp(name, "file://", 7)) {
- GError *converr = NULL;
- gchar *tmp, *rtmp;
- gpointer data;
- size_t len = 0;
-
- /* It looks like we're dealing with a local file. */
- if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
- purple_debug_error("buddyicon", "%s",
- converr ? converr->message :
- "g_filename_from_uri error");
- return;
- }
- if ((rtmp = strchr(tmp, '\r')) || (rtmp = strchr(tmp, '\n')))
- *rtmp = '\0';
-
- data = pidgin_convert_buddy_icon(dialog->protocol, tmp, &len);
- /* This takes ownership of tmp */
- set_dialog_icon(dialog, data, len, tmp);
- }
- gtk_drag_finish(dc, TRUE, FALSE, t);
- }
- gtk_drag_finish(dc, FALSE, FALSE, t);
-}
-
-static void
update_editable(PurpleConnection *gc, AccountPrefsDialog *dialog)
{
GtkStyleContext *style;
@@ -1514,12 +1477,6 @@
}
}
-static const GtkTargetEntry dnd_targets[] = {
- {"text/plain", 0, 0},
- {"text/uri-list", 0, 1},
- {"STRING", 0, 2}
-};
-
static void
pidgin_account_dialog_show_continue(PidginAccountDialogType type,
PurpleAccount *account,
@@ -1625,17 +1582,6 @@
gtk_widget_set_sensitive(dialog->ok_button, FALSE);
}
- /* Set up DND */
- gtk_drag_dest_set(dialog->window,
- GTK_DEST_DEFAULT_MOTION |
- GTK_DEST_DEFAULT_DROP,
- dnd_targets,
- sizeof(dnd_targets) / sizeof(GtkTargetEntry),
- GDK_ACTION_COPY);
-
- g_signal_connect(G_OBJECT(dialog->window), "drag_data_received",
- G_CALLBACK(account_dnd_recv), dialog);
-
/* Show the window. */
gtk_widget_show(win);
if (!account)
@@ -1801,141 +1747,6 @@
-1);
}
-static void
-drag_data_get_cb(GtkWidget *widget, GdkDragContext *ctx,
- GtkSelectionData *data, guint info, guint time,
- AccountsWindow *dialog)
-{
- GdkAtom target = gtk_selection_data_get_target(data);
-
- if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE)) {
- GtkTreeRowReference *ref;
- GtkTreePath *source_row;
- GtkTreeIter iter;
- PurpleAccount *account = NULL;
- GValue val;
-
- ref = g_object_get_data(G_OBJECT(ctx), "gtk-tree-view-source-row");
- source_row = gtk_tree_row_reference_get_path(ref);
-
- if (source_row == NULL)
- return;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter,
- source_row);
- val.g_type = 0;
- gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
- COLUMN_DATA, &val);
-
- dialog->drag_iter = iter;
-
- account = g_value_get_pointer(&val);
-
- gtk_selection_data_set(data, gdk_atom_intern("PURPLE_ACCOUNT", FALSE),
- 8, (void *)&account, sizeof(account));
-
- gtk_tree_path_free(source_row);
- }
-}
-
-static void
-move_account_after(GtkListStore *store, GtkTreeIter *iter,
- GtkTreeIter *position)
-{
- GtkTreeIter new_iter;
- PurpleAccount *account;
-
- gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
- COLUMN_DATA, &account,
- -1);
-
- gtk_list_store_insert_after(store, &new_iter, position);
-
- set_account(store, &new_iter, account, NULL);
-
- gtk_list_store_remove(store, iter);
-}
-
-static void
-move_account_before(GtkListStore *store, GtkTreeIter *iter,
- GtkTreeIter *position)
-{
- GtkTreeIter new_iter;
- PurpleAccount *account;
-
- gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
- COLUMN_DATA, &account,
- -1);
-
- gtk_list_store_insert_before(store, &new_iter, position);
-
- set_account(store, &new_iter, account, NULL);
-
- gtk_list_store_remove(store, iter);
-}
-
-static void
-drag_data_received_cb(GtkWidget *widget, GdkDragContext *ctx,
- guint x, guint y, GtkSelectionData *sd,
- guint info, guint t, AccountsWindow *dialog)
-{
- GdkAtom target = gtk_selection_data_get_target(sd);
- const guchar *data = gtk_selection_data_get_data(sd);
-
- if (target == gdk_atom_intern("PURPLE_ACCOUNT", FALSE) && data) {
- gint dest_index;
- PurpleAccount *a = NULL;
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition position;
-
- memcpy(&a, data, sizeof(a));
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y,
- &path, &position))
- {
- GtkTreeIter iter;
- PurpleAccount *account;
- PurpleAccountManager *manager = NULL;
- GValue val;
- GList *accounts = NULL;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
- val.g_type = 0;
- gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), &iter,
- COLUMN_DATA, &val);
-
- account = g_value_get_pointer(&val);
-
- manager = purple_account_manager_get_default();
- accounts = purple_account_manager_get_all(manager);
-
- switch (position) {
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- move_account_after(dialog->model, &dialog->drag_iter,
- &iter);
- dest_index = g_list_index(accounts, account) + 1;
- break;
-
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- dest_index = g_list_index(accounts, account);
-
- move_account_before(dialog->model, &dialog->drag_iter,
- &iter);
- break;
-
- default:
- return;
- }
-
- if (dest_index >= 0) {
- purple_account_manager_reorder(manager, a, dest_index);
- }
- }
- }
-}
-
static gboolean
accedit_win_destroy_cb(GtkWidget *w, GdkEvent *event, AccountsWindow *dialog)
{
@@ -2271,7 +2082,6 @@
GtkWidget *frame;
GtkWidget *treeview;
GtkTreeSelection *sel;
- GtkTargetEntry gte[] = {{"PURPLE_ACCOUNT", GTK_TARGET_SAME_APP, 0}};
frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
@@ -2308,19 +2118,6 @@
populate_accounts_list(dialog);
- /* Setup DND. I wanna be an orc! */
- gtk_tree_view_enable_model_drag_source(
- GTK_TREE_VIEW(treeview), GDK_BUTTON1_MASK, gte,
- 1, GDK_ACTION_COPY);
- gtk_tree_view_enable_model_drag_dest(
- GTK_TREE_VIEW(treeview), gte, 1,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- g_signal_connect(G_OBJECT(treeview), "drag-data-received",
- G_CALLBACK(drag_data_received_cb), dialog);
- g_signal_connect(G_OBJECT(treeview), "drag-data-get",
- G_CALLBACK(drag_data_get_cb), dialog);
-
gtk_widget_show_all(frame);
return frame;
}
--- a/pidgin/gtkblist.c Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/gtkblist.c Thu Mar 17 21:41:10 2022 -0500
@@ -46,7 +46,6 @@
#include "pidgin/pidgincontactlist.h"
#include "pidgin/pidgincore.h"
#include "pidgin/pidgindebug.h"
-#include "pidgin/pidgindnd.h"
#include "pidgin/pidgingdkpixbuf.h"
#include "pidgin/pidginmooddialog.h"
#include "pidgin/pidginplugininfo.h"
@@ -1909,495 +1908,6 @@
return handled;
}
-static void
-add_buddies_from_vcard(const char *protocol_id, PurpleGroup *group, GList *list,
- const char *alias)
-{
- GList *l;
- PurpleAccount *account = NULL;
- PurpleConnection *gc;
-
- if (list == NULL)
- return;
-
- for (l = purple_connections_get_all(); l != NULL; l = l->next)
- {
- gc = (PurpleConnection *)l->data;
- account = purple_connection_get_account(gc);
-
- if (purple_strequal(purple_account_get_protocol_id(account), protocol_id))
- break;
-
- account = NULL;
- }
-
- if (account != NULL)
- {
- for (l = list; l != NULL; l = l->next)
- {
- purple_blist_request_add_buddy(account, l->data,
- (group ? purple_group_get_name(group) : NULL),
- alias);
- }
- }
-
- g_list_free_full(list, g_free);
-}
-
-static gboolean
-parse_vcard(const char *vcard, PurpleGroup *group)
-{
- char *temp_vcard;
- char *s, *c;
- char *alias = NULL;
- GList *jabbers = NULL;
-
- s = temp_vcard = g_strdup(vcard);
-
- while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
- {
- char *field, *value;
-
- field = s;
-
- /* Grab the field */
- while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
- s++;
-
- if (*s == '\r') s++;
- if (*s == '\n')
- {
- s++;
- continue;
- }
-
- if (*s != '\0') *s++ = '\0';
-
- if ((c = strchr(field, ';')) != NULL)
- *c = '\0';
-
- /* Proceed to the end of the line */
- value = s;
-
- while (*s != '\r' && *s != '\n' && *s != '\0')
- s++;
-
- if (*s == '\r') *s++ = '\0';
- if (*s == '\n') *s++ = '\0';
-
- /* We only want to worry about a few fields here. */
- if (purple_strequal(field, "FN"))
- alias = g_strdup(value);
- else if (purple_strequal(field, "X-JABBER"))
- {
- char **values = g_strsplit(value, ":", 0);
- char **im;
-
- for (im = values; *im != NULL; im++)
- {
- jabbers = g_list_append(jabbers, g_strdup(*im));
- }
-
- g_strfreev(values);
- }
- }
-
- g_free(temp_vcard);
-
- if (jabbers == NULL)
- {
- g_free(alias);
-
- return FALSE;
- }
-
- add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
-
- g_free(alias);
-
- return TRUE;
-}
-
-static void pidgin_blist_drag_data_get_cb(GtkWidget *widget,
- GdkDragContext *dc,
- GtkSelectionData *data,
- guint info,
- guint time,
- gpointer null)
-{
- GdkAtom target = gtk_selection_data_get_target(data);
-
- if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) {
- GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
- GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
- GtkTreeIter iter;
- PurpleBlistNode *node = NULL;
- if(!sourcerow)
- return;
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
- gtk_selection_data_set (data,
- gdk_atom_intern ("PURPLE_BLIST_NODE", FALSE),
- 8, /* bits */
- (void*)&node,
- sizeof (node));
-
- gtk_tree_path_free(sourcerow);
- } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) {
- GtkTreeRowReference *ref;
- GtkTreePath *sourcerow;
- GtkTreeIter iter;
- PurpleBlistNode *node = NULL;
- PurpleBuddy *buddy;
- PurpleConnection *gc;
- GString *str;
- const char *protocol;
-
- ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
- sourcerow = gtk_tree_row_reference_get_path(ref);
-
- if (!sourcerow)
- return;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
- sourcerow);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
-
- if (PURPLE_IS_CONTACT(node))
- {
- buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
- }
- else if (!PURPLE_IS_BUDDY(node))
- {
- gtk_tree_path_free(sourcerow);
- return;
- }
- else
- {
- buddy = (PurpleBuddy *)node;
- }
-
- gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-
- if (gc == NULL)
- {
- gtk_tree_path_free(sourcerow);
- return;
- }
-
- protocol =
- purple_protocol_get_list_icon(purple_connection_get_protocol(gc),
- purple_buddy_get_account(buddy), buddy);
-
- str = g_string_new(NULL);
- g_string_printf(str,
- "MIME-Version: 1.0\r\n"
- "Content-Type: application/x-im-contact\r\n"
- "X-IM-Protocol: %s\r\n"
- "X-IM-Username: %s\r\n",
- protocol,
- purple_buddy_get_name(buddy));
-
- if (purple_buddy_get_local_alias(buddy) != NULL)
- {
- g_string_append_printf(str,
- "X-IM-Alias: %s\r\n",
- purple_buddy_get_local_alias(buddy));
- }
-
- g_string_append(str, "\r\n");
-
- gtk_selection_data_set(data,
- gdk_atom_intern("application/x-im-contact", FALSE),
- 8, /* bits */
- (const guchar *)str->str,
- strlen(str->str) + 1);
-
- g_string_free(str, TRUE);
- gtk_tree_path_free(sourcerow);
- }
-}
-
-static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
- GtkSelectionData *sd, guint info, guint t)
-{
- GdkAtom target = gtk_selection_data_get_target(sd);
- const guchar *data = gtk_selection_data_get_data(sd);
-
- if (gtkblist->drag_timeout) {
- g_source_remove(gtkblist->drag_timeout);
- gtkblist->drag_timeout = 0;
- }
-
- if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && data) {
- PurpleBlistNode *n = NULL;
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition position;
- memcpy(&n, data, sizeof(n));
- if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
- /* if we're here, I think it means the drop is ok */
- GtkTreeIter iter;
- PurpleBlistNode *node;
- PidginBlistNode *gtknode;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, NODE_COLUMN, &node, -1);
- gtknode = g_object_get_data(G_OBJECT(node), UI_DATA);
-
- if (PURPLE_IS_CONTACT(n)) {
- PurpleContact *c = (PurpleContact*)n;
- if (PURPLE_IS_CONTACT(node) && gtknode->contact_expanded) {
- purple_contact_merge(c, node);
- } else if (PURPLE_IS_CONTACT(node) ||
- PURPLE_IS_CHAT(node)) {
- switch(position) {
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- purple_blist_add_contact(c, (PurpleGroup*)node->parent,
- node);
- break;
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- purple_blist_add_contact(c, (PurpleGroup*)node->parent,
- node->prev);
- break;
- }
- } else if(PURPLE_IS_GROUP(node)) {
- purple_blist_add_contact(c, (PurpleGroup*)node, NULL);
- } else if(PURPLE_IS_BUDDY(node)) {
- purple_contact_merge(c, node);
- }
- } else if (PURPLE_IS_BUDDY(n)) {
- PurpleBuddy *b = (PurpleBuddy*)n;
- if (PURPLE_IS_BUDDY(node)) {
- switch(position) {
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- purple_blist_add_buddy(b, (PurpleContact*)node->parent,
- (PurpleGroup*)node->parent->parent, node);
- break;
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- purple_blist_add_buddy(b, (PurpleContact*)node->parent,
- (PurpleGroup*)node->parent->parent,
- node->prev);
- break;
- }
- } else if(PURPLE_IS_CHAT(node)) {
- purple_blist_add_buddy(b, NULL, (PurpleGroup*)node->parent,
- NULL);
- } else if (PURPLE_IS_GROUP(node)) {
- purple_blist_add_buddy(b, NULL, (PurpleGroup*)node, NULL);
- } else if (PURPLE_IS_CONTACT(node)) {
- if(gtknode->contact_expanded) {
- switch(position) {
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- purple_blist_add_buddy(b, (PurpleContact*)node,
- (PurpleGroup*)node->parent, NULL);
- break;
- case GTK_TREE_VIEW_DROP_BEFORE:
- purple_blist_add_buddy(b, NULL,
- (PurpleGroup*)node->parent, node->prev);
- break;
- }
- } else {
- switch(position) {
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- case GTK_TREE_VIEW_DROP_AFTER:
- purple_blist_add_buddy(b, NULL,
- (PurpleGroup*)node->parent, NULL);
- break;
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- case GTK_TREE_VIEW_DROP_BEFORE:
- purple_blist_add_buddy(b, NULL,
- (PurpleGroup*)node->parent, node->prev);
- break;
- }
- }
- }
- } else if (PURPLE_IS_CHAT(n)) {
- PurpleChat *chat = (PurpleChat *)n;
- if (PURPLE_IS_BUDDY(node)) {
- switch(position) {
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- purple_blist_add_chat(chat,
- (PurpleGroup*)node->parent->parent,
- node->parent);
- break;
- }
- } else if(PURPLE_IS_CONTACT(node) ||
- PURPLE_IS_CHAT(node)) {
- switch(position) {
- case GTK_TREE_VIEW_DROP_AFTER:
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node);
- break;
- case GTK_TREE_VIEW_DROP_BEFORE:
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node->prev);
- break;
- }
- } else if (PURPLE_IS_GROUP(node)) {
- purple_blist_add_chat(chat, (PurpleGroup*)node, NULL);
- }
- } else if (PURPLE_IS_GROUP(n)) {
- PurpleGroup *g = (PurpleGroup*)n;
- if (PURPLE_IS_GROUP(node)) {
- switch (position) {
- case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
- case GTK_TREE_VIEW_DROP_AFTER:
- purple_blist_add_group(g, node);
- break;
- case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
- case GTK_TREE_VIEW_DROP_BEFORE:
- purple_blist_add_group(g, node->prev);
- break;
- }
- } else if(PURPLE_IS_BUDDY(node)) {
- purple_blist_add_group(g, node->parent->parent);
- } else if(PURPLE_IS_CONTACT(node) ||
- PURPLE_IS_CHAT(node)) {
- purple_blist_add_group(g, node->parent);
- }
- }
-
- gtk_tree_path_free(path);
- gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t);
- }
- } else if (target == gdk_atom_intern("application/x-im-contact",
- FALSE) && data) {
- PurpleGroup *group = NULL;
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition position;
- PurpleAccount *account;
- char *protocol = NULL;
- char *username = NULL;
- char *alias = NULL;
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
- x, y, &path, &position))
- {
- GtkTreeIter iter;
- PurpleBlistNode *node;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, NODE_COLUMN, &node, -1);
-
- if (PURPLE_IS_BUDDY(node))
- {
- group = (PurpleGroup *)node->parent->parent;
- }
- else if (PURPLE_IS_CHAT(node) ||
- PURPLE_IS_CONTACT(node))
- {
- group = (PurpleGroup *)node->parent;
- }
- else if (PURPLE_IS_GROUP(node))
- {
- group = (PurpleGroup *)node;
- }
- }
-
- if (pidgin_parse_x_im_contact((const char *)data, FALSE, &account,
- &protocol, &username, &alias))
- {
- if (account == NULL)
- {
- purple_notify_error(NULL, NULL,
- _("You are not currently signed on with an account that "
- "can add that buddy."), NULL, NULL);
- }
- else
- {
- purple_blist_request_add_buddy(account, username,
- (group ? purple_group_get_name(group) : NULL),
- alias);
- }
- }
-
- g_free(username);
- g_free(protocol);
- g_free(alias);
-
- if (path != NULL)
- gtk_tree_path_free(path);
-
- gtk_drag_finish(dc, TRUE,
- gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t);
- }
- else if (target == gdk_atom_intern("text/x-vcard", FALSE) && data)
- {
- gboolean result;
- PurpleGroup *group = NULL;
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition position;
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
- x, y, &path, &position))
- {
- GtkTreeIter iter;
- PurpleBlistNode *node;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, NODE_COLUMN, &node, -1);
-
- if (PURPLE_IS_BUDDY(node))
- {
- group = (PurpleGroup *)node->parent->parent;
- }
- else if (PURPLE_IS_CHAT(node) ||
- PURPLE_IS_CONTACT(node))
- {
- group = (PurpleGroup *)node->parent;
- }
- else if (PURPLE_IS_GROUP(node))
- {
- group = (PurpleGroup *)node;
- }
- }
-
- result = parse_vcard((const gchar *)data, group);
-
- gtk_drag_finish(dc, result,
- gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t);
- } else if (target == gdk_atom_intern("text/uri-list", FALSE) && data) {
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition position;
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
- x, y, &path, &position))
- {
- GtkTreeIter iter;
- PurpleBlistNode *node;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
- &iter, NODE_COLUMN, &node, -1);
-
- if (PURPLE_IS_BUDDY(node) || PURPLE_IS_CONTACT(node)) {
- PurpleBuddy *b = PURPLE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node));
- pidgin_dnd_file_manage(sd, purple_buddy_get_account(b), purple_buddy_get_name(b));
- gtk_drag_finish(dc, TRUE,
- gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t);
- } else {
- gtk_drag_finish(dc, FALSE, FALSE, t);
- }
- }
- }
-}
-
/* Altered from do_colorshift in gnome-panel */
static void
do_alphashift(GdkPixbuf *pixbuf, int shift)
@@ -2580,52 +2090,6 @@
return ret;
}
-static gboolean pidgin_blist_expand_timeout(GtkWidget *tv)
-{
- GtkTreePath *path;
- GtkTreeIter iter;
- PurpleBlistNode *node;
- PidginBlistNode *gtknode;
-
- if (!gtk_tree_view_get_path_at_pos(
- GTK_TREE_VIEW(tv),
- gtkblist->drag_rect.x,
- gtkblist->drag_rect.y + (gtkblist->drag_rect.height/2),
- &path, NULL, NULL, NULL))
- {
- return FALSE;
- }
- gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
-
- if(!PURPLE_IS_CONTACT(node)) {
- gtk_tree_path_free(path);
- return FALSE;
- }
-
- gtknode = g_object_get_data(G_OBJECT(node), UI_DATA);
-
- if (!gtknode->contact_expanded) {
- GtkTreeIter i;
-
- pidgin_blist_expand_contact_cb(NULL, node);
-
- gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->contact_rect);
- gtkblist->contact_rect.width =
- gdk_window_get_width(gtk_widget_get_window(tv));
- gtkblist->mouseover_contact = node;
- gtk_tree_path_down (path);
- while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) {
- GdkRectangle rect;
- gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
- gtkblist->contact_rect.height += rect.height;
- gtk_tree_path_next(path);
- }
- }
- gtk_tree_path_free(path);
- return FALSE;
-}
-
static gboolean buddy_is_displayable(PurpleBuddy *buddy)
{
PidginBlistNode *gtknode;
@@ -2642,56 +2106,6 @@
purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), "show_offline")));
}
-static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context,
- gint x, gint y, guint time, gpointer user_data)
-{
- GtkTreePath *path;
- int delay;
- GdkRectangle rect;
-
- /*
- * When dragging a buddy into a contact, this is the delay before
- * the contact auto-expands.
- */
- delay = 900;
-
- if (gtkblist->drag_timeout) {
- if (y > gtkblist->drag_rect.y &&
- (y - gtkblist->drag_rect.height) < gtkblist->drag_rect.y)
- {
- return FALSE;
- }
- /* We've left the cell. Remove the timeout and create a new one below */
- g_source_remove(gtkblist->drag_timeout);
- }
-
- gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), x, y, &path, NULL, NULL, NULL);
- gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
-
- if (path)
- gtk_tree_path_free(path);
-
- /* Only autoexpand when in the middle of the cell to avoid annoying un-intended expands */
- if (y < rect.y + (rect.height / 3) ||
- y > rect.y + (2 * (rect.height /3)))
- return FALSE;
-
- rect.height = rect.height / 3;
- rect.y += rect.height;
-
- gtkblist->drag_rect = rect;
- gtkblist->drag_timeout = g_timeout_add(delay, (GSourceFunc)pidgin_blist_expand_timeout, tv);
-
- if (gtkblist->mouseover_contact) {
- if ((y < gtkblist->contact_rect.y) || ((y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
- pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
- gtkblist->mouseover_contact = NULL;
- }
- }
-
- return FALSE;
-}
-
/* # - Status Icon
* P - Protocol Icon
* A - Buddy Icon
@@ -2941,34 +2355,6 @@
}
}
-static gboolean pidgin_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null)
-{
- if (gtkblist->mouseover_contact) {
- if ((event->y < gtkblist->contact_rect.y) || ((event->y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
- pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
- gtkblist->mouseover_contact = NULL;
- }
- }
-
- return FALSE;
-}
-
-static gboolean pidgin_blist_leave_cb (GtkWidget *w, GdkEventCrossing *e, gpointer n)
-{
- if (gtkblist->drag_timeout) {
- g_source_remove(gtkblist->drag_timeout);
- gtkblist->drag_timeout = 0;
- }
-
- if (gtkblist->mouseover_contact &&
- !((e->x > gtkblist->contact_rect.x) && (e->x < (gtkblist->contact_rect.x + gtkblist->contact_rect.width)) &&
- (e->y > gtkblist->contact_rect.y) && (e->y < (gtkblist->contact_rect.y + gtkblist->contact_rect.height)))) {
- pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
- gtkblist->mouseover_contact = NULL;
- }
- return FALSE;
-}
-
/*********************************************************
* Private Utility functions *
*********************************************************/
@@ -3787,15 +3173,6 @@
return pidgin_node->contact_expanded;
}
-enum {
- DRAG_BUDDY,
- DRAG_ROW,
- DRAG_VCARD,
- DRAG_TEXT,
- DRAG_URI,
- NUM_TARGETS
-};
-
void pidgin_blist_setup_sort_methods()
{
const char *id;
@@ -4520,14 +3897,7 @@
GtkTreeViewColumn *column;
GtkWidget *sep;
GtkTreeSelection *selection;
- GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
- {"application/x-im-contact", 0, DRAG_BUDDY},
- {"text/x-vcard", 0, DRAG_VCARD },
- {"text/uri-list", 0, DRAG_URI},
- {"text/plain", 0, DRAG_TEXT}};
- GtkTargetEntry ste[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
- {"application/x-im-contact", 0, DRAG_BUDDY},
- {"text/x-vcard", 0, DRAG_VCARD }};
+
if (gtkblist && gtkblist->window) {
purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible"));
return;
@@ -4588,20 +3958,6 @@
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(pidgin_blist_selection_changed), NULL);
- /* Set up dnd */
- gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
- GDK_BUTTON1_MASK, ste, 3,
- GDK_ACTION_COPY);
- gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
- dte, 5,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-received", G_CALLBACK(pidgin_blist_drag_data_rcv_cb), NULL);
- g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(pidgin_blist_drag_data_get_cb), NULL);
- g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-motion", G_CALLBACK(pidgin_blist_drag_motion_cb), NULL);
- g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(pidgin_blist_motion_cb), NULL);
- g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(pidgin_blist_leave_cb), NULL);
-
/* Tooltips */
gtk_widget_set_has_tooltip(gtkblist->treeview, TRUE);
g_signal_connect(G_OBJECT(gtkblist->treeview), "query-tooltip",
@@ -5910,10 +5266,6 @@
g_source_remove(gtkblist->refresh_timer);
gtkblist->refresh_timer = 0;
}
- if (gtkblist->drag_timeout) {
- g_source_remove(gtkblist->drag_timeout);
- gtkblist->drag_timeout = 0;
- }
gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
g_clear_object(&gtkblist->treemodel);
--- a/pidgin/gtkblist.h Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/gtkblist.h Thu Mar 17 21:41:10 2022 -0500
@@ -55,9 +55,6 @@
* @treemodel: This is the treemodel.
* @text_column: Column
* @refresh_timer: The timer for refreshing every 30 seconds
- * @drag_timeout: The timeout for expanding contacts on drags
- * @drag_rect: This is the bounding rectangle of the cell we're
- * currently hovering over. This is used for drag'n'drop.
* @contact_rect: This is the bounding rectangle of the contact node and
* its children. This is used for auto-expand on mouseover.
* @mouseover_contact: This is the contact currently mouse-over expanded
@@ -91,8 +88,6 @@
guint refresh_timer;
- guint drag_timeout;
- GdkRectangle drag_rect;
GdkRectangle contact_rect;
PurpleBlistNode *mouseover_contact;
--- a/pidgin/gtkconv.c Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/gtkconv.c Thu Mar 17 21:41:10 2022 -0500
@@ -3298,11 +3298,6 @@
/**********************************************************************
* Register signals
**********************************************************************/
- purple_signal_register(handle, "conversation-dragging",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- G_TYPE_POINTER, /* pointer to a (PidginConvWindow *) */
- G_TYPE_POINTER); /* pointer to a (PidginConvWindow *) */
-
purple_signal_register(handle, "displaying-im-msg",
purple_marshal_BOOLEAN__POINTER_POINTER,
G_TYPE_BOOLEAN, 2, PURPLE_TYPE_CONVERSATION, PURPLE_TYPE_MESSAGE);
--- a/pidgin/meson.build Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/meson.build Thu Mar 17 21:41:10 2022 -0500
@@ -39,7 +39,6 @@
'pidgincontactlist.c',
'pidgindebug.c',
'pidgindialog.c',
- 'pidgindnd.c',
'pidgingdkpixbuf.c',
'pidginiconname.c',
'pidgininfopane.c',
@@ -102,7 +101,6 @@
'pidgincore.h',
'pidgindialog.h',
'pidgindebug.h',
- 'pidgindnd.h',
'pidgingdkpixbuf.h',
'pidginiconname.h',
'pidgininfopane.h',
--- a/pidgin/pidgindnd.c Mon Mar 14 01:18:18 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,365 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#include <glib/gi18n-lib.h>
-#include <glib/gstdio.h>
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include <talkatu.h>
-
-#include "pidgindnd.h"
-
-#include "gtkconv.h"
-#include "pidgincore.h"
-#include "pidgingdkpixbuf.h"
-
-enum {
- DND_FILE_TRANSFER,
- DND_IM_IMAGE,
- DND_BUDDY_ICON
-};
-
-typedef struct {
- char *filename;
- PurpleAccount *account;
- char *who;
-} _DndData;
-
-static void dnd_image_ok_callback(_DndData *data, int choice)
-{
- const gchar *shortname;
- gchar *filedata;
- size_t size;
- GStatBuf st;
- GError *err = NULL;
- PurpleBuddy *buddy;
- PurpleContact *contact;
- PurpleImage *img;
-
- switch (choice) {
- case DND_BUDDY_ICON:
- if (g_stat(data->filename, &st)) {
- char *str;
-
- str = g_strdup_printf(_("The following error has occurred loading %s: %s"),
- data->filename, g_strerror(errno));
- purple_notify_error(NULL, NULL,
- _("Failed to load image"), str, NULL);
- g_free(str);
-
- break;
- }
-
- buddy = purple_blist_find_buddy(data->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:
- purple_serv_send_file(purple_account_get_connection(data->account), data->who, data->filename);
- break;
- case DND_IM_IMAGE:
- if (!g_file_get_contents(data->filename, &filedata, &size,
- &err)) {
- char *str;
-
- str = g_strdup_printf(_("The following error has occurred loading %s: %s"), data->filename, err->message);
- purple_notify_error(NULL, NULL,
- _("Failed to load image"), str, NULL);
-
- g_error_free(err);
- g_free(str);
-
- break;
- }
- shortname = strrchr(data->filename, G_DIR_SEPARATOR);
- shortname = shortname ? shortname + 1 : data->filename;
- img = purple_image_new_from_data((guint8 *)filedata, size);
- purple_image_set_friendly_filename(img, shortname);
-
-# warning fix this when talkatu has a way to programmatically insert an image
- // pidgin_webview_insert_image(PIDGIN_WEBVIEW(gtkconv->entry), img);
- g_object_unref(img);
-
- break;
- }
- g_free(data->filename);
- g_free(data->who);
- g_free(data);
-}
-
-static void dnd_image_cancel_callback(_DndData *data, int choice)
-{
- g_free(data->filename);
- g_free(data->who);
- g_free(data);
-}
-
-static void dnd_set_icon_ok_cb(_DndData *data)
-{
- dnd_image_ok_callback(data, DND_BUDDY_ICON);
-}
-
-static void dnd_set_icon_cancel_cb(_DndData *data)
-{
- g_free(data->filename);
- g_free(data->who);
- g_free(data);
-}
-
-static void
-pidgin_dnd_file_send_image(PurpleAccount *account, const gchar *who,
- const gchar *filename)
-{
- PurpleConnection *gc = purple_account_get_connection(account);
- PurpleProtocol *protocol = NULL;
- _DndData *data = g_new0(_DndData, 1);
- gboolean ft = FALSE, im = FALSE;
-
- data->who = g_strdup(who);
- data->filename = g_strdup(filename);
- data->account = account;
-
- if (gc)
- protocol = purple_connection_get_protocol(gc);
-
- if (!(purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_NO_IMAGES))
- im = TRUE;
-
- if (protocol && PURPLE_IS_PROTOCOL_XFER(protocol)) {
- PurpleProtocolXferInterface *iface =
- PURPLE_PROTOCOL_XFER_GET_IFACE(protocol);
-
- if(iface->can_receive) {
- ft = purple_protocol_xfer_can_receive(
- PURPLE_PROTOCOL_XFER(protocol),
- gc, who);
- } else {
- ft = (iface->send_file) ? TRUE : FALSE;
- }
- }
-
- if (im && ft) {
- purple_request_choice(NULL, NULL,
- _("You have dragged an image"),
- _("You can send this image as a file "
- "transfer, embed it into this message, "
- "or use it as the buddy icon for this user."),
- (gpointer)DND_FILE_TRANSFER, _("OK"),
- (GCallback)dnd_image_ok_callback, _("Cancel"),
- (GCallback)dnd_image_cancel_callback,
- purple_request_cpar_from_account(account), data,
- _("Set as buddy icon"), DND_BUDDY_ICON,
- _("Send image file"), DND_FILE_TRANSFER,
- _("Insert in message"), DND_IM_IMAGE,
- NULL);
- } else if (!(im || ft)) {
- purple_request_yes_no(NULL, NULL, _("You have dragged an image"),
- _("Would you like to set it as the buddy icon for this user?"),
- PURPLE_DEFAULT_ACTION_NONE,
- purple_request_cpar_from_account(account),
- data, (GCallback)dnd_set_icon_ok_cb, (GCallback)dnd_set_icon_cancel_cb);
- } else {
- purple_request_choice(NULL, NULL,
- _("You have dragged an image"),
- (ft ? _("You can send this image as a file transfer, or use it as the buddy icon for this user.") :
- _("You can insert this image into this message, or use it as the buddy icon for this user")),
- GINT_TO_POINTER(ft ? DND_FILE_TRANSFER : DND_IM_IMAGE),
- _("OK"), (GCallback)dnd_image_ok_callback,
- _("Cancel"), (GCallback)dnd_image_cancel_callback,
- purple_request_cpar_from_account(account),
- data,
- _("Set as buddy icon"), DND_BUDDY_ICON,
- (ft ? _("Send image file") : _("Insert in message")), (ft ? DND_FILE_TRANSFER : DND_IM_IMAGE),
- NULL);
- }
-
-}
-
-#ifndef _WIN32
-static void
-pidgin_dnd_file_send_desktop(PurpleAccount *account, const gchar *who,
- const gchar *filename)
-{
- gchar *name;
- gchar *type;
- gchar *url;
- GKeyFile *desktop_file;
- PurpleConversation *conv;
- PidginConversation *gtkconv;
- GError *error = NULL;
-
- desktop_file = g_key_file_new();
-
- if (!g_key_file_load_from_file(desktop_file, filename, G_KEY_FILE_NONE, &error)) {
- if (error) {
- purple_debug_warning("D&D", "Failed to load %s: %s\n",
- filename, error->message);
- g_error_free(error);
- }
- return;
- }
-
- name = g_key_file_get_string(desktop_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_NAME, &error);
- if (error) {
- purple_debug_warning("D&D", "Failed to read the Name from a desktop file: %s\n",
- error->message);
- g_error_free(error);
-
- }
-
- type = g_key_file_get_string(desktop_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_TYPE, &error);
- if (error) {
- purple_debug_warning("D&D", "Failed to read the Type from a desktop file: %s\n",
- error->message);
- g_error_free(error);
-
- }
-
- url = g_key_file_get_string(desktop_file, G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_URL, &error);
- if (error) {
- purple_debug_warning("D&D", "Failed to read the Type from a desktop file: %s\n",
- error->message);
- g_error_free(error);
-
- }
-
-
- /* If any of this is null, do nothing. */
- if (!name || !type || !url) {
- g_free(type);
- g_free(name);
- g_free(url);
-
- return;
- }
-
- /* I don't know if we really want to do anything here. Most of
- * the desktop item types are crap like "MIME Type" (I have no
- * clue how that would be a desktop item) and "Comment"...
- * nothing we can really send. The only logical one is
- * "Application," but do we really want to send a binary and
- * nothing else? Probably not. I'll just give an error and
- * return. */
- /* The original patch sent the icon used by the launcher. That's probably wrong */
- if (purple_strequal(type, "Link")) {
- purple_notify_error(NULL, NULL, _("Cannot send launcher"),
- _("You dragged a desktop launcher. Most "
- "likely you wanted to send the target "
- "of this launcher instead of this "
- "launcher itself."), NULL);
-
- } else {
- GtkTextBuffer *buffer = NULL;
- GtkTextMark *mark = NULL;
- GtkTextIter iter;
-
- conv = PURPLE_CONVERSATION(purple_im_conversation_new(account, who));
- gtkconv = PIDGIN_CONVERSATION(conv);
-
- buffer = talkatu_editor_get_buffer(TALKATU_EDITOR(gtkconv->editor));
- mark = gtk_text_buffer_get_insert(buffer);
-
- gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
-
- talkatu_buffer_insert_link(TALKATU_BUFFER(buffer), &iter, name, url);
- }
-
- g_free(type);
- g_free(name);
- g_free(url);
-}
-#endif /* _WIN32 */
-
-void
-pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who)
-{
- GdkPixbuf *pb;
- GList *files = purple_uri_list_extract_filenames((const gchar *) gtk_selection_data_get_data(sd));
- PurpleConnection *gc = purple_account_get_connection(account);
- gchar *filename = NULL;
- gchar *basename = NULL;
-
- g_return_if_fail(account != NULL);
- g_return_if_fail(who != NULL);
-
- for ( ; files; files = g_list_delete_link(files, files)) {
- g_free(filename);
- g_free(basename);
-
- filename = files->data;
- basename = g_path_get_basename(filename);
-
- /* XXX - Make ft API support creating a transfer with more than one file */
- if (!g_file_test(filename, G_FILE_TEST_EXISTS)) {
- continue;
- }
-
- /* XXX - make ft api suupport sending a directory */
- /* Are we dealing with a directory? */
- if (g_file_test(filename, G_FILE_TEST_IS_DIR)) {
- char *str, *str2;
-
- str = g_strdup_printf(_("Cannot send folder %s."), basename);
- str2 = g_strdup_printf(_("%s cannot transfer a folder. You will need to send the files within individually."), PIDGIN_NAME);
-
- purple_notify_error(NULL, NULL, str, str2,
- purple_request_cpar_from_connection(gc));
-
- g_free(str);
- g_free(str2);
- continue;
- }
-
- /* Are we dealing with an image? */
- pb = pidgin_pixbuf_new_from_file(filename);
- if (pb) {
- pidgin_dnd_file_send_image(account, who, filename);
-
- g_object_unref(G_OBJECT(pb));
-
- continue;
- }
-
-#ifndef _WIN32
- /* Are we trying to send a .desktop file? */
- else if (g_str_has_suffix(basename, ".desktop")) {
- pidgin_dnd_file_send_desktop(account, who, filename);
-
- continue;
- }
-#endif /* _WIN32 */
-
- /* Everything is fine, let's send */
- purple_serv_send_file(gc, who, filename);
- }
-
- g_free(filename);
- g_free(basename);
-}
--- a/pidgin/pidgindnd.h Mon Mar 14 01:18:18 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Pidgin - Internet Messenger
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_DND_H
-#define PIDGIN_DND_H
-
-#include <glib.h>
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-G_BEGIN_DECLS
-
-/**
- * pidgin_dnd_file_manage:
- * @sd: GtkSelectionData for managing drag'n'drop
- * @account: Account to be used (may be NULL if conv is not NULL)
- * @who: Buddy name (may be NULL if conv is not NULL)
- *
- * Manages drag'n'drop of files.
- */
-void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who);
-
-G_END_DECLS
-
-#endif /* PIDGIN_DND_H */
--- a/pidgin/plugins/notify.c Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/plugins/notify.c Thu Mar 17 21:41:10 2022 -0500
@@ -448,55 +448,6 @@
#endif
}
-#if 0
-static void
-conversation_dragging(PurpleConversation *active_conv,
- PidginConvWindow *old_purplewin,
- PidginConvWindow *new_purplewin)
-{
- if (old_purplewin != new_purplewin) {
- if (old_purplewin == NULL) {
- /*
- purple_conversation_autoset_title(active_conv);
- handle_urgent(new_purplewin, FALSE);
- */
-
- if (count_messages(new_purplewin))
- notify_win(new_purplewin);
- } else {
- printf("if else count = %d\n", count_messages(new_purplewin));
- printf("if else count = %d\n", count_messages(old_purplewin));
- /*
- PurpleConversation *old_active_conv = NULL;
- old_active_conv = purple_conversation_window_get_active_conversation(new_purplewin);
-
- purple_conversation_autoset_title(old_active_conv);
- handle_urgent(old_purplewin, FALSE);
-
- if (count_messages(old_purplewin))
- notify_win(old_purplewin);
-
- purple_conversation_autoset_title(active_conv);
- handle_urgent(new_purplewin, FALSE);
-
- if (count_messages(new_purplewin))
- notify_win(new_purplewin);
- */
- }
- } else {
- printf("else count = %d\n", count_messages(new_purplewin));
- printf("else count = %d\n", count_messages(old_purplewin));
- /*
- purple_conversation_autoset_title(active_conv);
- handle_urgent(old_purplewin, FALSE);
-
- if (count_messages(old_purplewin))
- notify_win(old_purplewin);
- */
- }
-}
-#endif
-
static void
handle_string(PidginConvWindow *purplewin)
{
@@ -933,10 +884,6 @@
PURPLE_CALLBACK(conv_created), NULL);
purple_signal_connect(conv_handle, "deleting-conversation", plugin,
PURPLE_CALLBACK(deleting_conv), NULL);
-#if 0
- purple_signal_connect(gtk_conv_handle, "conversation-dragging", plugin,
- PURPLE_CALLBACK(conversation_dragging), NULL);
-#endif
while (convs) {
PurpleConversation *conv = (PurpleConversation *)convs->data;
--- a/pidgin/plugins/transparency.c Mon Mar 14 01:18:18 2022 -0500
+++ b/pidgin/plugins/transparency.c Thu Mar 17 21:41:10 2022 -0500
@@ -612,9 +612,6 @@
purple_signal_connect(conv_handle, "deleting-conversation", plugin,
PURPLE_CALLBACK(conversation_delete_cb), NULL);
- purple_signal_connect(conv_handle, "conversation-dragging", plugin,
- PURPLE_CALLBACK(set_conv_window_trans), NULL);
-
purple_signal_connect(conv_handle, "conversation-updated", plugin,
PURPLE_CALLBACK(conv_updated_cb), NULL);