pidgin/pidgin

Remove PurpleXferUiOps.cancel_* UI ops.

16 months ago, Elliott Sales de Andrade
39eb6d1b71ff
Parents 42922708e18e
Children e6692de3b4de
Remove PurpleXferUiOps.cancel_* UI ops.

UIs can connect to notify::status on PurpleXfer instances instead.
--- a/ChangeLog.API Sat Dec 21 20:44:34 2019 -0500
+++ b/ChangeLog.API Sat Dec 21 21:09:12 2019 -0500
@@ -480,6 +480,9 @@
* PurplePluginProtocolInfo.add_buddies_with_invite
* PurplePluginProtocolInfo.get_cb_away
* PurpleValue, use GValue instead.
+ * PurpleXferUiOps.cancel_local and
+ PurpleXferUiOps.cancel_remote. Use notify::status on
+ #PurpleXfer objects instead.
* PurpleXferUiOps.data_not_sent. Use PurpleXfer::data-not-sent
instead.
* PurpleXferUiOps.ui_read. Use PurpleXfer::read-local instead.
--- a/finch/gntxfer.c Sat Dec 21 20:44:34 2019 -0500
+++ b/finch/gntxfer.c Sat Dec 21 21:09:12 2019 -0500
@@ -497,6 +497,17 @@
}
static void
+finch_xfer_status_notify(PurpleXfer *xfer, G_GNUC_UNUSED GParamSpec *pspec,
+ G_GNUC_UNUSED gpointer data)
+{
+ if (xfer_dialog) {
+ if (purple_xfer_is_cancelled(xfer)) {
+ finch_xfer_dialog_cancel_xfer(xfer);
+ }
+ }
+}
+
+static void
finch_xfer_add_xfer(PurpleXfer *xfer)
{
if (!xfer_dialog)
@@ -507,20 +518,8 @@
g_signal_connect(xfer, "notify::progress",
G_CALLBACK(finch_xfer_progress_notify), NULL);
-}
-
-static void
-finch_xfer_cancel_local(PurpleXfer *xfer)
-{
- if (xfer_dialog)
- finch_xfer_dialog_cancel_xfer(xfer);
-}
-
-static void
-finch_xfer_cancel_remote(PurpleXfer *xfer)
-{
- if (xfer_dialog)
- finch_xfer_dialog_cancel_xfer(xfer);
+ g_signal_connect(xfer, "notify::status",
+ G_CALLBACK(finch_xfer_status_notify), NULL);
}
static PurpleXferUiOps ops =
@@ -528,8 +527,6 @@
finch_xfer_new_xfer,
finch_xfer_destroy,
finch_xfer_add_xfer,
- finch_xfer_cancel_local,
- finch_xfer_cancel_remote,
NULL /* add_thumbnail */
};
--- a/libpurple/xfer.c Sat Dec 21 20:44:34 2019 -0500
+++ b/libpurple/xfer.c Sat Dec 21 21:09:12 2019 -0500
@@ -1706,7 +1706,6 @@
{
PurpleXferClass *klass = NULL;
PurpleXferPrivate *priv = NULL;
- PurpleXferUiOps *ui_ops;
char *msg = NULL;
g_return_if_fail(PURPLE_IS_XFER(xfer));
@@ -1770,12 +1769,6 @@
priv->dest_fp = NULL;
}
- ui_ops = purple_xfer_get_ui_ops(xfer);
-
- if (ui_ops != NULL && ui_ops->cancel_local != NULL) {
- ui_ops->cancel_local(xfer);
- }
-
g_object_unref(xfer);
}
@@ -1784,7 +1777,6 @@
{
PurpleXferClass *klass = NULL;
PurpleXferPrivate *priv = NULL;
- PurpleXferUiOps *ui_ops;
gchar *msg;
PurpleAccount *account;
PurpleBuddy *buddy;
@@ -1840,11 +1832,6 @@
priv->dest_fp = NULL;
}
- ui_ops = purple_xfer_get_ui_ops(xfer);
-
- if (ui_ops != NULL && ui_ops->cancel_remote != NULL)
- ui_ops->cancel_remote(xfer);
-
g_object_unref(xfer);
}
--- a/libpurple/xfer.h Sat Dec 21 20:44:34 2019 -0500
+++ b/libpurple/xfer.h Sat Dec 21 21:09:12 2019 -0500
@@ -101,10 +101,6 @@
* @new_xfer: UI op that's called after a new transfer is created.
* @destroy: UI op that's called when a transfer is being destroyed.
* @add_xfer: UI op that's called when a transfer should be added to the UI.
- * @cancel_local: UI op that's called when a transfer has been cancelled on the
- * local end.
- * @cancel_remote: UI op that's called when a transfer has been cancelled on
- * the remote end.
* @add_thumbnail: Op to create a thumbnail image for a file transfer
*
* File transfer UI operations.
@@ -117,8 +113,6 @@
void (*new_xfer)(PurpleXfer *xfer);
void (*destroy)(PurpleXfer *xfer);
void (*add_xfer)(PurpleXfer *xfer);
- void (*cancel_local)(PurpleXfer *xfer);
- void (*cancel_remote)(PurpleXfer *xfer);
void (*add_thumbnail)(PurpleXfer *xfer, const gchar *formats);
};
--- a/pidgin/gtkxfer.c Sat Dec 21 20:44:34 2019 -0500
+++ b/pidgin/gtkxfer.c Sat Dec 21 21:09:12 2019 -0500
@@ -931,6 +931,17 @@
}
static void
+pidgin_xfer_status_notify(PurpleXfer *xfer, G_GNUC_UNUSED GParamSpec *pspec,
+ G_GNUC_UNUSED gpointer data)
+{
+ if (xfer_dialog) {
+ if (purple_xfer_is_cancelled(xfer)) {
+ pidgin_xfer_dialog_cancel_xfer(xfer_dialog, xfer);
+ }
+ }
+}
+
+static void
pidgin_xfer_add_xfer(PurpleXfer *xfer)
{
if (xfer_dialog == NULL)
@@ -940,20 +951,8 @@
g_signal_connect(xfer, "notify::progress",
G_CALLBACK(pidgin_xfer_progress_notify), NULL);
-}
-
-static void
-pidgin_xfer_cancel_local(PurpleXfer *xfer)
-{
- if (xfer_dialog)
- pidgin_xfer_dialog_cancel_xfer(xfer_dialog, xfer);
-}
-
-static void
-pidgin_xfer_cancel_remote(PurpleXfer *xfer)
-{
- if (xfer_dialog)
- pidgin_xfer_dialog_cancel_xfer(xfer_dialog, xfer);
+ g_signal_connect(xfer, "notify::status",
+ G_CALLBACK(pidgin_xfer_status_notify), NULL);
}
static void
@@ -1022,8 +1021,6 @@
pidgin_xfer_new_xfer,
pidgin_xfer_destroy,
pidgin_xfer_add_xfer,
- pidgin_xfer_cancel_local,
- pidgin_xfer_cancel_remote,
pidgin_xfer_add_thumbnail
};