cpw.nader.asynclogging-3: 8932371f: Fixed up the last few compiler bugs/warn..
morshed.nader at gmail.com
morshed.nader at gmail.com
Wed Jan 12 02:48:06 EST 2011
----------------------------------------------------------------------
Revision: 8932371f81a173b349376b1f3f1e86132a7f2209
Parent: c7898c7a1552dafee45b320b0dce5abc03a00c48
Author: morshed.nader at gmail.com
Date: 01/12/11 02:40:28
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/8932371f81a173b349376b1f3f1e86132a7f2209
Changelog:
Fixed up the last few compiler bugs/warnings in log.c and got libpurple compiling (Other things still haven't been updated yet though, and log.c still probably has numerous bugs)
Added oldlog.c to the makefiles
Changes against parent c7898c7a1552dafee45b320b0dce5abc03a00c48
patched libpurple/Makefile.am
patched libpurple/Makefile.mingw
patched libpurple/log.c
patched libpurple/oldlog.c
-------------- next part --------------
============================================================
--- libpurple/log.c 372236f6c30cb002c6734b0ae933924002083cce
+++ libpurple/log.c 4ccbae9983a5ac207fe25d3ced33f1a05dcb91e2
@@ -189,6 +189,11 @@ static gssize purple_log_real_total_size
static void purple_log_real_total_size_async(PurpleLog *, PurpleLogChatType, const gchar *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
static gssize purple_log_real_total_size_finish(PurpleLog *, GAsyncResult *, GError **);
+static void is_removable_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
+static void purple_log_real_is_removable_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
+static gboolean purple_log_real_is_removable_finish(PurpleLog *, GAsyncResult *, GError **);
+
+
static void remove_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
static void purple_log_real_remove_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
static gboolean purple_log_real_remove_finish(PurpleLog *, GAsyncResult *, GError **);
@@ -208,7 +213,6 @@ static void log_total_size_cb(GObject *,
static void log_list_cb(GObject *, GAsyncResult *, gpointer);
static void log_system_list_cb(GObject *, GAsyncResult *, gpointer);
static void log_total_size_cb(GObject *, GAsyncResult *, gpointer);
-static void log_total_size_list_cb(GObject *, GAsyncResult *, gpointer);
static void log_hash_cb(GObject *, GAsyncResult *, gpointer);
@@ -1087,6 +1091,8 @@ purple_log_get_total_size(PurpleLog *log
g_return_val_if_fail(name != NULL, -1);
g_return_val_if_fail(account != NULL, -1); // PURPLE_IS_ACCOUNT(account)
+ class = PURPLE_LOG_GET_CLASS(log);
+
if (class->total_size_fn){
return class->total_size_fn(log, chat_type, name, account, cancellable, error);
} else {
@@ -1500,7 +1506,69 @@ purple_log_is_removable(PurpleLog *log,
return TRUE;
}
+static void
+is_removable_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+{
+ PurpleLog *log = PURPLE_LOG(object);
+ GError *error = NULL;
+ gboolean result;
+
+ result = purple_log_is_removable(log, cancellable, &error);
+
+ if (!result)
+ g_simple_async_result_set_from_error(simple, error);
+ else
+ g_simple_async_result_set_op_res_gboolean(simple, result);
+
+ g_clear_error(&error);
+}
+
+static void
+purple_log_real_is_removable_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_if_fail(PURPLE_IS_LOG(log));
+
+ simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
+ purple_log_real_is_removable_async);
+
+ g_simple_async_result_run_in_thread(simple, is_removable_thread, io_priority, cancellable);
+ g_object_unref(simple);
+}
+
+void
+purple_log_is_removable_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+{
+ g_return_if_fail(PURPLE_IS_LOG(log));
+
+ PURPLE_LOG_GET_CLASS(log)->is_removable_async(log, io_priority,
+ cancellable, cb, userdata);
+}
+
+static gboolean
+purple_log_real_is_removable_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+{
+ return g_simple_async_result_get_op_res_gboolean(G_SIMPLE_ASYNC_RESULT(res));
+}
+
gboolean
+purple_log_is_removable_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+{
+ g_return_val_if_fail(PURPLE_IS_LOG(log), FALSE);
+ g_return_val_if_fail(G_IS_ASYNC_RESULT(res), FALSE);
+
+ if (G_IS_SIMPLE_ASYNC_RESULT(res)) {
+ GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res);
+
+ if (g_simple_async_result_propagate_error(simple, error))
+ return FALSE;
+ }
+
+ return PURPLE_LOG_GET_CLASS(log)->is_removable_finish(log, res, error);
+}
+
+gboolean
purple_log_remove(PurpleLog *log, GCancellable *cancellable, GError **error)
{
PurpleLogClass *class;
@@ -1575,14 +1643,14 @@ purple_log_remove_finish(PurpleLog *log,
gboolean
purple_log_remove_finish(PurpleLog *log, GAsyncResult *res, GError **error)
{
- g_return_val_if_fail(PURPLE_IS_LOG(log), -1);
- g_return_val_if_fail(G_IS_ASYNC_RESULT(res), -1);
+ g_return_val_if_fail(PURPLE_IS_LOG(log), FALSE);
+ g_return_val_if_fail(G_IS_ASYNC_RESULT(res), FALSE);
if (G_IS_SIMPLE_ASYNC_RESULT(res)) {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res);
if (g_simple_async_result_propagate_error(simple, error))
- return -1;
+ return FALSE;
}
return PURPLE_LOG_GET_CLASS(log)->remove_finish(log, res, error);
@@ -2035,7 +2103,7 @@ purple_logs_get_log_sets(GCancellable *c
GType log_type = g_array_index(array, GType, i);
log = g_object_new(log_type, NULL);
- purple_log_get_log_sets(log, cancellable, &err);
+ one_set = purple_log_get_log_sets(log, cancellable, &err);
if (one_set == NULL) {
g_object_unref(log);
@@ -3636,58 +3704,11 @@ log_total_size_cb(GObject *object, GAsyn
g_object_unref(simple);
}
- if (callback_data->cancellable != NULL)
- g_object_unref(callback_data->cancellable);
-
g_free(callback_data);
}
}
static void
-log_total_size_list_cb(GObject *object, GAsyncResult *res, gpointer userdata)
-{
- /* Gets the size for all the logs in the list as part of purple_log_get_total_size_async */
- _purple_log_total_size_callback_data *callback_data = userdata;
- PurpleLog *log = PURPLE_LOG(object);
- GError *err = NULL;
- GList *list, *n;
- GSimpleAsyncResult *simple;
-
- list = purple_log_get_logs_finish(log, res, &err);
-
- if (list == NULL && err != NULL) {
- simple = g_simple_async_result_new(NULL, log_total_size_cb,
- callback_data, purple_log_common_total_sizer_async);
-
- g_simple_async_result_set_from_error(simple, err);
- g_simple_async_result_complete_in_idle(simple);
-
- g_object_unref(simple);
- } else if (g_list_length(list) < 1) {
- simple = g_simple_async_result_new(NULL, log_total_size_cb,
- callback_data, purple_log_common_total_sizer_async);
-
- g_simple_async_result_set_op_res_gssize(simple, 0);
- g_simple_async_result_complete_in_idle(simple);
-
- g_object_unref(simple);
- } else {
- callback_data->counter--;
-
- for (n = list; n != NULL; n = g_list_next(n)) {
- PurpleLog *log = n->data;
-
- callback_data->counter++;
-
- purple_log_get_size_async(log, callback_data->io_priority,
- callback_data->cancellable, log_total_size_cb, callback_data);
- }
- }
-
- g_clear_error(&err);
-}
-
-static void
log_hash_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
_purple_log_sets_callback_data *callback_data = userdata;
============================================================
--- libpurple/Makefile.am 1e30217909679956cd9e2c39368d08d00a98aa19
+++ libpurple/Makefile.am 0dfb28f9e50ab5e788bbab49786fb1ed1240d830
@@ -66,6 +66,7 @@ purple_coresources = \
network.c \
ntlm.c \
notify.c \
+ oldlog.c \
plugin.c \
pluginpref.c \
pounce.c \
@@ -132,6 +133,7 @@ purple_coreheaders = \
network.h \
notify.h \
ntlm.h \
+ oldlog.h \
plugin.h \
pluginpref.h \
pounce.h \
============================================================
--- libpurple/Makefile.mingw dee33a1b0727bdc19f53839d9f495cba8504b0f0
+++ libpurple/Makefile.mingw 9c5823ace4c8012b71275e47dad6090f616f9037
@@ -56,6 +56,7 @@ C_SRC = \
network.c \
notify.c \
ntlm.c \
+ oldlog.c \
plugin.c \
pluginpref.c \
pounce.c \
============================================================
--- libpurple/oldlog.c b4e7ccc34a95ebc34031b35c377037c3dd53d31d
+++ libpurple/oldlog.c 4a3424d189aa7a778a422f79e72b293a7401844e
@@ -77,6 +77,13 @@ purple_old_log_init(PurpleOldLog *old_lo
{
}
+PurpleLog *
+purple_old_log_new(PurpleLogChatType type, const gchar *name, PurpleAccount *account,
+ PurpleConversation *conv, time_t time, const struct tm *tm)
+{
+ return purple_log_new(PURPLE_TYPE_OLD_LOG, type, name, account, conv, time, tm);
+}
+
// Needs testing!!!
static GList *
purple_old_log_list(PurpleLog *log, PurpleLogChatType chat_type, const gchar *sn, PurpleAccount *account, GCancellable *cancellable, GError **error)
More information about the Commits
mailing list