im.pidgin.pidgin: 1314c686e3e02d3e53344d942dcd42afce582014
sadrul at pidgin.im
sadrul at pidgin.im
Sat Jan 26 17:00:48 EST 2008
-----------------------------------------------------------------
Revision: 1314c686e3e02d3e53344d942dcd42afce582014
Ancestor: 060da60b29e46c9444ca537353c9a87c53711276
Author: sadrul at pidgin.im
Date: 2008-01-26T21:58:51
Branch: im.pidgin.pidgin
Modified files:
ChangeLog.API finch/gntft.c libpurple/ft.c libpurple/ft.h
ChangeLog:
Add accessor and update finch to not touch the internals of PurpleXfer.
-------------- next part --------------
============================================================
--- ChangeLog.API cb770c07447f3542bc8c531175ab00daaaf41544
+++ ChangeLog.API 3853d8305a45524968da02bba23f91a3b7064a4a
@@ -40,6 +40,8 @@ version 2.4.0 (??/??/????):
* Added some more accessor functions:
* purple_chat_get_account
* purple_connection_get_prpl
+ * purple_xfer_get_start_time
+ * purple_xfer_get_end_time
Pidgin:
Added:
============================================================
--- finch/gntft.c 70cec96e99fe94259adc318b068f5976d4584f1f
+++ finch/gntft.c 66dfd3d28e03eb1434e7723e46da6eaa0c9315b6
@@ -168,9 +168,15 @@ stop_button_cb(GntButton *button)
stop_button_cb(GntButton *button)
{
PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree));
- if (selected_xfer && selected_xfer->status != PURPLE_XFER_STATUS_CANCEL_LOCAL &&
- selected_xfer->status != PURPLE_XFER_STATUS_CANCEL_REMOTE &&
- selected_xfer->status != PURPLE_XFER_STATUS_DONE)
+ PurpleXferStatusType status;
+
+ if (!selected_xfer)
+ return;
+
+ status = purple_xfer_get_status(selected_xfer);
+ if (status != PURPLE_XFER_STATUS_CANCEL_LOCAL &&
+ status != PURPLE_XFER_STATUS_CANCEL_REMOTE &&
+ status != PURPLE_XFER_STATUS_DONE)
purple_xfer_cancel_local(selected_xfer);
}
@@ -397,14 +403,12 @@ finch_xfer_dialog_update_xfer(PurpleXfer
time_t elapsed, now;
char *kbsec;
- if (xfer->end_time != 0)
- now = xfer->end_time;
- else
+ if ((now = purple_xfer_get_end_time(xfer)) == 0)
now = time(NULL);
kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0;
kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0;
- elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0);
+ elapsed = (purple_xfer_get_start_time(xfer) > 0 ? now - purple_xfer_get_start_time(xfer) : 0);
kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0);
g_return_if_fail(xfer_dialog != NULL);
============================================================
--- libpurple/ft.c 1686a4e5385e2f194f4cc7f0d68082293b47a0dd
+++ libpurple/ft.c dea1aae8598f1a74b50ee71418fc27e028f36c9a
@@ -669,6 +669,22 @@ purple_xfer_get_remote_port(const Purple
return xfer->remote_port;
}
+time_t
+purple_xfer_get_start_time(const PurpleXfer *xfer)
+{
+ g_return_val_if_fail(xfer != NULL, 0);
+
+ return xfer->start_time;
+}
+
+time_t
+purple_xfer_get_end_time(const PurpleXfer *xfer)
+{
+ g_return_val_if_fail(xfer != NULL, 0);
+
+ return xfer->end_time;
+}
+
void
purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed)
{
============================================================
--- libpurple/ft.h 076778320ebe2da6e2e9dac3634d0941fe6a3236
+++ libpurple/ft.h 3aa2704a0d52f381185179f08bd2dfab218e1d33
@@ -358,6 +358,26 @@ unsigned int purple_xfer_get_remote_port
unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer);
/**
+ * Returns the time the transfer of a file started.
+ *
+ * @param xfer The file transfer.
+ *
+ * @return The time when the transfer started.
+ * @since 2.4.0
+ */
+time_t purple_xfer_get_start_time(const PurpleXfer *xfer);
+
+/**
+ * Returns the time the transfer of a file ended.
+ *
+ * @param xfer The file transfer.
+ *
+ * @return The time when the transfer ended.
+ * @since 2.4.0
+ */
+time_t purple_xfer_get_end_time(const PurpleXfer *xfer);
+
+/**
* Sets the completed state for the file transfer.
*
* @param xfer The file transfer.
More information about the Commits
mailing list