cpw.nader.asynclogging-3: db044fe3: Added install_shallow to the base packag...
morshed.nader at gmail.com
morshed.nader at gmail.com
Thu Jan 13 01:25:54 EST 2011
----------------------------------------------------------------------
Revision: db044fe3fde1bee3f11dc0ca5eca82d3856f59f3
Parent: a35bb181b8d7a56fa347d18afbe6bfa256e9b523
Author: morshed.nader at gmail.com
Date: 01/13/11 01:20:44
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/db044fe3fde1bee3f11dc0ca5eca82d3856f59f3
Changelog:
Added install_shallow to the base package's Makefile.mingw
Fixed up a number of runtime errors
Fixed purple_log_new always failing
Added _finish functions for the purple_logs_*_async functions
Code cleanup
Changes against parent a35bb181b8d7a56fa347d18afbe6bfa256e9b523
patched Makefile.mingw
patched libpurple/commonlog.c
patched libpurple/log.c
patched libpurple/log.h
patched libpurple/oldlog.c
patched pidgin/gtklog.c
-------------- next part --------------
============================================================
--- Makefile.mingw 278b7927f9db6f3ca164fc359d0670cab097d1bb
+++ Makefile.mingw 745b5307a51ca27e3eeb6ce96b0c4876bb9181e2
@@ -77,7 +77,7 @@ include $(PIDGIN_COMMON_RULES)
include $(PIDGIN_COMMON_RULES)
-.PHONY: all docs install installer installer_offline installer_zip debug_symbols_zip installers clean uninstall create_release_install_dir generate_installer_includes $(PIDGIN_REVISION_H) $(PIDGIN_REVISION_RAW_TXT)
+.PHONY: all docs install install_shallow installer installer_offline installer_zip debug_symbols_zip installers clean uninstall create_release_install_dir generate_installer_includes $(PIDGIN_REVISION_H) $(PIDGIN_REVISION_RAW_TXT)
all: $(PIDGIN_CONFIG_H) $(PIDGIN_REVISION_H)
$(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE)
@@ -100,6 +100,10 @@ endif
cp -R $(ENCHANT_TOP)/lib $(PIDGIN_INSTALL_DIR)/spellcheck
cp $(WIN32_DEV_TOP)/pidgin-inst-deps-20100315/exchndl.dll $(PIDGIN_INSTALL_DIR)
+install_shallow: all $(PIDGIN_INSTALL_DIR)
+ $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) install_shallow
+ $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE) install_shallow
+
pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip:
pidgin/win32/nsis/generate_gtk_zip.sh `pwd`
============================================================
--- libpurple/log.c e26ceb2392532e8a56857213df6e387bc6c2f44e
+++ libpurple/log.c c0aff6a06fad778099f59dd4d58806e52ab0a61e
@@ -136,7 +136,6 @@ typedef struct {
typedef struct {
GAsyncReadyCallback cb;
GHashTable *sets;
- GMutex *mutex;
gpointer userdata;
guint counter;
} _purple_log_sets_callback_data;
@@ -508,13 +507,13 @@ purple_log_new(GType log_type, PurpleLog
g_return_val_if_fail(log_type == G_TYPE_INVALID || g_type_is_a(log_type, PURPLE_TYPE_LOG), NULL);
g_return_val_if_fail(name != NULL, NULL);
- g_return_val_if_fail(account != NULL, NULL);
+ g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
if (log_type == G_TYPE_INVALID)
log_type = current_logger;
log = g_object_new(log_type,
- "type", chat_type,
+ "chat-type", chat_type,
"name", g_strdup(purple_normalize(account, name)),
"account", account,
"conv", conv,
@@ -1067,7 +1066,6 @@ purple_logs_get_total_size(PurpleLogChat
if (result) {
total = GPOINTER_TO_INT(ptrsize);
- // purple_debug_info("log", "HASH(purple_log_get_total_size): using size from hash %i {name = \"%s\"\n}", size, name);
g_free(lu->name);
g_free(lu);
@@ -1090,8 +1088,6 @@ purple_logs_get_total_size(PurpleLogChat
total += size;
}
- // purple_debug_info("log", "HASH(purple_log_get_total_size): write size to hash %i {name = \"%s\"\n}", total, name);
-
G_LOCK(logsize_users);
g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(total));
G_LOCK(logsize_users);
@@ -1156,8 +1152,10 @@ total_size_thread(GSimpleAsyncResult *si
g_simple_async_result_set_op_res_gssize(simple, total);
} else {
- g_simple_async_result_set_error(simple, G_IO_ERROR,
- G_IO_ERROR_NOT_SUPPORTED, _("Operation not supported"));
+ g_simple_async_result_set_error(simple,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("Operation not supported"));
return;
}
@@ -1206,7 +1204,7 @@ purple_logs_get_total_size_async(PurpleL
guint i;
g_return_if_fail(name != NULL);
- g_return_if_fail(account != NULL);
+ g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
lu = g_new(_purple_logsize_user, 1);
lu->name = g_strdup(purple_normalize(account, name));
@@ -1252,8 +1250,9 @@ purple_logs_get_total_size_async(PurpleL
GType log_type = g_array_index(array, GType, i);
log = g_object_new(log_type, NULL);
-
- PURPLE_LOG_GET_CLASS(log)->total_size_async(log, chat_type, name, account, io_priority, cancellable, log_total_size_cb, callback_data);
+ PURPLE_LOG_GET_CLASS(log)->total_size_async(log, chat_type, name,
+ account, io_priority, cancellable, log_total_size_cb, callback_data);
+ g_object_unref(log);
}
}
@@ -1280,6 +1279,21 @@ gssize
}
gssize
+purple_logs_get_total_size_finish(GAsyncResult *res, GError **error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail(G_IS_SIMPLE_ASYNC_RESULT(res), -1);
+
+ simple = G_SIMPLE_ASYNC_RESULT(res);
+
+ if (g_simple_async_result_propagate_error(simple, error))
+ return -1;
+
+ return g_simple_async_result_get_op_res_gssize(simple);
+}
+
+gssize
purple_log_get_activity_score(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
{
_purple_logsize_user *lu;
@@ -1289,7 +1303,7 @@ purple_log_get_activity_score(PurpleLogC
gint score;
g_return_val_if_fail(name != NULL, -1);
- g_return_val_if_fail(account != NULL, -1); //PURPLE_IS_ACCOUNT(account)
+ g_return_val_if_fail(account != NULL, -1); // PURPLE_IS_ACCOUNT(account)
time(&now);
@@ -1589,7 +1603,7 @@ purple_log_get_log_dir(PurpleLogChatType
gchar *acct_name, *dir, *temp;
g_return_val_if_fail(name != NULL, NULL);
- g_return_val_if_fail(account != NULL, NULL);
+ g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
prpl = purple_find_prpl(purple_account_get_protocol_id(account));
@@ -1826,7 +1840,7 @@ get_logs_thread(GSimpleAsyncResult *simp
{
_thread_callback_data *callback_data =
g_simple_async_result_get_op_res_gpointer(simple);
- PurpleAccount *account = callback_data->account; // g_object_unref
+ PurpleAccount *account = callback_data->account;
PurpleLog *log = PURPLE_LOG(object);
PurpleLogChatType chat_type = callback_data->chat_type;
GError *error = NULL;
@@ -1922,6 +1936,21 @@ purple_log_get_logs_finish(PurpleLog *lo
return PURPLE_LOG_GET_CLASS(log)->list_finish(log, res, error);
}
+GList *
+purple_logs_get_logs_finish(GAsyncResult *res, GError **error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail(G_IS_SIMPLE_ASYNC_RESULT(res), NULL);
+
+ simple = G_SIMPLE_ASYNC_RESULT(res);
+
+ if (g_simple_async_result_propagate_error(simple, error))
+ return NULL;
+
+ return g_simple_async_result_get_op_res_gpointer(simple);
+}
+
gint
purple_log_set_compare(gconstpointer y, gconstpointer z)
{
@@ -2208,8 +2237,7 @@ purple_logs_get_system_logs(PurpleAccoun
GList *logs = NULL;
guint i;
- // PURPLE_IS_ACCOUNT(account)
- g_return_val_if_fail(account != NULL, NULL);
+ g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
array = purple_log_logger_get_all();
@@ -2222,11 +2250,10 @@ purple_logs_get_system_logs(PurpleAccoun
list = purple_log_get_system_logs(log, account, cancellable, error);
if (list == NULL) {
+ g_object_unref(log);
g_list_foreach(logs, (GFunc) g_object_unref, NULL);
g_list_free(logs);
- g_object_unref(log);
-
return NULL;
}
@@ -2332,6 +2359,22 @@ purple_log_get_system_logs_finish(Purple
return PURPLE_LOG_GET_CLASS(log)->list_syslog_finish(log, res, error);
}
+GList *
+purple_logs_get_system_logs_finish(GAsyncResult *res, GError **error)
+{
+ GSimpleAsyncResult *simple;
+
+ g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
+ g_return_val_if_fail(G_IS_SIMPLE_ASYNC_RESULT(res), NULL);
+
+ simple = G_SIMPLE_ASYNC_RESULT(res);
+
+ if (g_simple_async_result_propagate_error(simple, error))
+ return NULL;
+
+ return g_simple_async_result_get_op_res_gpointer(simple);
+}
+
/****************************************************************************
* LOG SUBSYSTEM ************************************************************
****************************************************************************/
@@ -2805,8 +2848,7 @@ purple_log_finalize(GObject *object)
static void
purple_log_finalize(GObject *object)
{
- PurpleLog *log = PURPLE_LOG(object);
- PurpleLogPrivate *priv = PURPLE_LOG_GET_PRIVATE(log);
+ PurpleLogPrivate *priv = PURPLE_LOG_GET_PRIVATE(object);
g_free(priv->name);
@@ -2828,28 +2870,34 @@ log_list_cb(GObject *object, GAsyncResul
{
_get_logs_callback_data *callback_data = userdata;
PurpleLog *log = PURPLE_LOG(object);
+ GError *error = NULL;
+ GList *list;
GSimpleAsyncResult *simple;
- GList *list, *n;
- list = purple_log_get_logs_finish(log, res, NULL);
+ list = purple_log_get_logs_finish(log, res, &error);
+ if (list == NULL && error != NULL)
+ purple_debug_error("log", "Error listing %s logs: %s\n",
+ PURPLE_LOG_GET_CLASS(log)->logger_name, error->message);
+
+ g_clear_error(&error);
+
callback_data->logs = g_list_concat(callback_data->logs, list);
callback_data->counter--;
if (callback_data->counter < 1) {
/* Let the caller know we're done. */
if (callback_data->cb) {
- simple = g_simple_async_result_new(object, callback_data->cb,
- callback_data->userdata, NULL);//purple_log_common_lister_async);
+ simple = g_simple_async_result_new(NULL, callback_data->cb,
+ callback_data->userdata, purple_logs_get_logs_async);
+ // g_simple_async_result_set_op_res_gpointer(simple, NULL, NULL);
g_simple_async_result_set_op_res_gpointer(simple, callback_data->logs, NULL);
g_simple_async_result_complete_in_idle(simple);
g_object_unref(simple);
} else {
- for (n = callback_data->logs; n != NULL; n = g_list_next(n))
- g_object_unref(n->data);
-
+ g_list_foreach(callback_data->logs, (GFunc) g_object_unref, NULL);
g_list_free(callback_data->logs);
}
@@ -2862,28 +2910,33 @@ log_system_list_cb(GObject *object, GAsy
{
_get_logs_callback_data *callback_data = userdata;
PurpleLog *log = PURPLE_LOG(object);
+ GError *error = NULL;
+ GList *list;
GSimpleAsyncResult *simple;
- GList *list, *n;
- list = purple_log_get_system_logs_finish(log, res, NULL);
+ list = purple_log_get_system_logs_finish(log, res, &error);
+ if (list == NULL && error != NULL)
+ purple_debug_error("log", "Error listing %s system logs: %s\n",
+ PURPLE_LOG_GET_CLASS(log)->logger_name, error->message);
+
+ g_clear_error(&error);
+
callback_data->logs = g_list_concat(callback_data->logs, list);
callback_data->counter--;
if (callback_data->counter < 1) {
/* Let the caller know we're done. */
if (callback_data->cb) {
- simple = g_simple_async_result_new(object, callback_data->cb,
- callback_data->userdata, NULL);//purple_log_common_lister_async);
+ simple = g_simple_async_result_new(NULL, callback_data->cb,
+ callback_data->userdata, purple_logs_get_system_logs_async);
g_simple_async_result_set_op_res_gpointer(simple, callback_data->logs, NULL);
g_simple_async_result_complete_in_idle(simple);
g_object_unref(simple);
} else {
- for (n = callback_data->logs; n != NULL; n = g_list_next(n))
- g_object_unref(n->data);
-
+ g_list_foreach(callback_data->logs, (GFunc) g_object_unref, NULL);
g_list_free(callback_data->logs);
}
@@ -2896,19 +2949,19 @@ log_total_size_cb(GObject *object, GAsyn
{
_purple_log_total_size_callback_data *callback_data = userdata;
PurpleLog *log = PURPLE_LOG(object);
- GError *err = NULL;
+ GError *error = NULL;
gssize size;
- size = purple_log_get_total_size_finish(log, res, &err);
+ size = purple_log_get_total_size_finish(log, res, &error);
/* It's hard to pass all the errors up, so just log them :( */
- if (size < 0 && err != NULL)
- purple_debug_error("log", "Error getting total size for logs: %s\n",
- err->message);
+ if (size < 0 && error != NULL)
+ purple_debug_error("log", "Error getting total size for %s logs: %s\n",
+ PURPLE_LOG_GET_CLASS(log)->logger_name, error->message);
else if (size > 0)
callback_data->total += size;
- g_clear_error(&err);
+ g_clear_error(&error);
callback_data->counter--;
if (callback_data->counter < 1) {
@@ -2916,7 +2969,7 @@ log_total_size_cb(GObject *object, GAsyn
GSimpleAsyncResult *simple;
simple = g_simple_async_result_new(NULL, callback_data->cb,
- callback_data->userdata, NULL); // purple_log_common_total_sizer_async);
+ callback_data->userdata, purple_logs_get_total_size_async);
g_simple_async_result_set_op_res_gssize(simple, callback_data->total);
g_simple_async_result_complete_in_idle(simple);
@@ -2950,7 +3003,6 @@ log_hash_cb(GObject *object, GAsyncResul
} else
g_hash_table_unref(callback_data->sets);
- g_mutex_free(callback_data->mutex);
g_free(callback_data);
}
}
============================================================
--- libpurple/log.h 03673b32ba5145644f989fc6100eeb0bd0ad1fd9
+++ libpurple/log.h 78d3847d34d9645be44819ad6df5a01f4e460dec
@@ -404,6 +404,7 @@ GList *purple_log_get_logs_finish(Purple
* @since 2.8.0
*/
GList *purple_log_get_logs_finish(PurpleLog *log, GAsyncResult *res, GError **error);
+GList *purple_logs_get_logs_finish(GAsyncResult *res, GError **error);
/**
* Returns a GHashTable of #PurpleLogSet<!-- -->s.
@@ -490,6 +491,7 @@ GList *purple_log_get_system_logs_finish
* @since 2.8.0
*/
GList *purple_log_get_system_logs_finish(PurpleLog *log, GAsyncResult *res, GError **error);
+GList *purple_logs_get_system_logs_finish(GAsyncResult *res, GError **error);
/**
* Returns the size of a log
@@ -565,6 +567,8 @@ gssize purple_log_get_total_size_finish(
*/
gssize purple_log_get_total_size_finish(PurpleLog *log, GAsyncResult *res, GError **error);
+gssize purple_logs_get_total_size_finish(GAsyncResult *res, GError **error);
+
/**
* Returns the activity score of a log, based on total size in bytes,
* which is then decayed based on age
============================================================
--- pidgin/gtklog.c 5e3349ce68abea6a455b1ffa4c431f66b8da55f7
+++ pidgin/gtklog.c b40a2dda2726bdcb9c0fb71dd995c55840c23256
@@ -964,7 +964,7 @@ display_log_viewer_nonblocking(log_viewe
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_paned_add1(GTK_PANED(pane), sw);
- lv->treestore = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_POINTER, PURPLE_TYPE_STRUCT_TM);
+ lv->treestore = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_OBJECT, PURPLE_TYPE_STRUCT_TM);
lv->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(lv->treestore));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(lv->treeview), FALSE);
pidgin_set_accessible_label(lv->treeview, lv->label);
@@ -1067,6 +1067,10 @@ insert_log_viewer_log(PidginLogViewerEx
struct tm *tm;
time_t log_time;
+ //g_return_if_fail(PURPLE_IS_LOG(log));
+ purple_debug_info("gtklog", "%u's refcount: %u", log, G_OBJECT(log)->ref_count);
+ return;
+
store = lv_ex->lv->treestore;
model = GTK_TREE_MODEL(store);
log_tm = purple_log_get_tm(log);
@@ -1224,7 +1228,7 @@ pidgin_log_size_cb(GObject *object, GAsy
GError *err = NULL;
gssize log_size;
- log_size = purple_log_get_total_size_finish(PURPLE_LOG(object), res, &err);
+ log_size = purple_logs_get_total_size_finish(res, &err);
pidgin_log_data->count--;
if (log_size < 0) {
@@ -1265,7 +1269,7 @@ pidgin_log_list_cb(GObject *object, GAsy
GError *err = NULL;
GList *list;
- list = purple_log_get_logs_finish(PURPLE_LOG(object), res, &err);
+ list = purple_logs_get_logs_finish(res, &err);
pidgin_log_data->count--;
if (list == NULL) {
============================================================
--- libpurple/oldlog.c 3ec6220eb53ead6d1b7e3ab25731e783ac35aba9
+++ libpurple/oldlog.c 5b3cef684d4c6174e28f23aca6b373e02425c8e2
@@ -331,11 +331,6 @@ purple_old_log_list(PurpleLog *log, Purp
if (index != NULL) {
fclose(index);
- if (index_tmp == NULL) {
- g_free(pathstr);
- g_return_val_if_reached(list);
- }
-
if (g_rename(index_tmp, pathstr)) {
// purple_debug_warning("log", "Failed to rename index temp file \"%s\" to \"%s\": %s\n",
// index_tmp, pathstr, g_strerror(errno));
============================================================
--- libpurple/commonlog.c 5daa011cca009d214792769696269580a94233ee
+++ libpurple/commonlog.c e7ef5189abf96d7aa89078df2ca85ce28de6748b
@@ -54,20 +54,12 @@ typedef struct {
typedef struct {
PurpleAccount *account;
PurpleLogChatType chat_type;
- gchar *name;
- gchar *ext;
-} _common_total_size_callback_data;
-
-typedef struct {
- PurpleAccount *account;
- PurpleLogChatType chat_type;
GType log_type;
gchar *name;
gchar *ext;
-} _common_lister_callback_data;
+} _common_thread_callback_data;
-static void common_total_size_callback_data_free(gpointer);
-static void common_lister_callback_data_free(gpointer);
+static void common_thread_callback_data_free(gpointer);
// static gboolean purple_log_common_create(PurpleLog *, GCancellable *, GError **);
static gboolean purple_log_common_remove(PurpleLog *, GCancellable *, GError **);
@@ -87,7 +79,6 @@ purple_common_log_class_init(PurpleCommo
log_class->logger_name = _("Common");
log_class->logger_id = "common";
- // log_class->create_fn = purple_common_log_create;
log_class->remove_fn = purple_log_common_remove;
log_class->is_removable_fn = purple_log_common_is_removable;
log_class->size_fn = purple_log_common_size;
@@ -199,7 +190,7 @@ purple_common_log_set_file(PurpleCommonL
g_return_if_fail(PURPLE_IS_COMMON_LOG(common_log));
g_return_if_fail(file == NULL || G_IS_FILE(file));
- priv = PURPLE_COMMON_LOG_GET_PRIVATE(log);
+ priv = PURPLE_COMMON_LOG_GET_PRIVATE(common_log);
if (priv->file != NULL)
g_object_unref(priv->file);
@@ -253,25 +244,15 @@ static void
}
static void
-common_total_size_callback_data_free(gpointer userdata)
+common_thread_callback_data_free(gpointer userdata)
{
- _common_total_size_callback_data *callback_data = userdata;
+ _common_thread_callback_data *callback_data = userdata;
g_free(callback_data->name);
g_free(callback_data->ext);
g_free(callback_data);
}
-static void
-common_lister_callback_data_free(gpointer userdata)
-{
- _common_lister_callback_data *callback_data = userdata;
-
- g_free(callback_data->name);
- g_free(callback_data->ext);
- g_free(callback_data);
-}
-
static gboolean
purple_log_common_remove(PurpleLog *log, GCancellable *cancellable, GError **error)
{
@@ -339,7 +320,9 @@ purple_log_common_writer(PurpleLog *log,
time_t log_time;
/* This log is new */
- dir = purple_log_get_log_dir(purple_log_get_chat_type(log), purple_log_get_name(log), purple_log_get_account(log));
+ dir = purple_log_get_log_dir(purple_log_get_chat_type(log),
+ purple_log_get_name(log),
+ purple_log_get_account(log));
if (dir == NULL) {
g_set_error_literal(error,
@@ -491,8 +474,8 @@ purple_log_common_lister(PurpleLogChatTy
if (purple_str_has_suffix(filename, ext) &&
strlen(filename) >= (17 + strlen(ext)))
{
- PurpleCommonLogPrivate *priv;
PurpleLog *log;
+ GFile *file;
gchar *tmp;
struct tm tm;
#if defined (HAVE_TM_GMTOFF) && defined (HAVE_STRUCT_TM_TM_ZONE)
@@ -507,9 +490,10 @@ purple_log_common_lister(PurpleLogChatTy
if (tz_off != PURPLE_NO_TZ_OFF)
tm.tm_gmtoff = tz_off - tm.tm_gmtoff;
- if (stamp == 0 || rest == NULL || (end = strchr(rest, '.')) == NULL || strchr(rest, ' ') != NULL) {
+ if (stamp == 0 || rest == NULL || (end = strchr(rest, '.')) == NULL ||
+ strchr(rest, ' ') != NULL)
log = purple_log_new(log_type, chat_type, name, account, NULL, stamp, NULL);
- } else {
+ else {
gchar *tmp = g_strndup(rest, end - rest);
tm.tm_zone = tmp;
log = purple_log_new(log_type, chat_type, name, account, NULL, stamp, &tm);
@@ -521,9 +505,10 @@ purple_log_common_lister(PurpleLogChatTy
log = purple_log_new(log_type, chat_type, name, account, NULL, stamp, (stamp != 0) ? &tm : NULL);
#endif
- priv = PURPLE_COMMON_LOG_GET_PRIVATE(log);
tmp = g_build_filename(path, filename, NULL);
- priv->file = g_file_new_for_path(tmp);
+ file = g_file_new_for_path(tmp);
+ purple_common_log_set_file(PURPLE_COMMON_LOG(log), file);
+ g_object_unref(file);
g_free(tmp);
list = g_list_prepend(list, log);
@@ -539,7 +524,7 @@ common_lister_thread(GSimpleAsyncResult
static void
common_lister_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
{
- _common_lister_callback_data *callback_data =
+ _common_thread_callback_data *callback_data =
g_simple_async_result_get_op_res_gpointer(simple);
PurpleAccount *account = callback_data->account;
PurpleLogChatType chat_type = callback_data->chat_type;
@@ -563,24 +548,24 @@ purple_log_common_lister_async(PurpleLog
const gchar *ext, GType log_type, gint io_priority, GCancellable *cancellable,
GAsyncReadyCallback cb, gpointer userdata)
{
- _common_lister_callback_data *callback_data;
+ _common_thread_callback_data *callback_data;
GSimpleAsyncResult *simple;
g_return_if_fail(name != NULL);
g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
g_return_if_fail(ext != NULL);
- callback_data = g_new0(_common_lister_callback_data, 1);
+ callback_data = g_new0(_common_thread_callback_data, 1);
callback_data->chat_type = chat_type;
callback_data->name = g_strdup(name);
- callback_data->account = account;
+ callback_data->account = account; // g_object_ref
callback_data->ext = g_strdup(ext);
callback_data->log_type = log_type;
simple = g_simple_async_result_new(NULL, cb, userdata, purple_log_common_lister_async);
g_simple_async_result_set_op_res_gpointer(simple, callback_data,
- common_lister_callback_data_free);
+ common_thread_callback_data_free);
g_simple_async_result_run_in_thread(simple, common_lister_thread, io_priority,
cancellable);
@@ -637,20 +622,9 @@ purple_log_common_total_sizer(PurpleLogC
g_free(path);
/* If the directory doesn't exist, we just don't have logs for them */
- if (err->code == G_FILE_ERROR_NOENT) {
- // G_LOCK(logsize_users);
-
- // lu = g_new(_purple_logsize_user, 1);
- // lu->name = g_strdup(purple_normalize(account, name));
- // lu->account = account; //g_object_ref?
-
- // if (!g_hash_table_lookup_extended(logsize_users, lu, NULL, NULL))
- // g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(size));
-
- // G_UNLOCK(logsize_users);
-
+ if (err->code == G_FILE_ERROR_NOENT)
return 0;
- } else {
+ else {
g_propagate_error(error, err);
return -1;
}
@@ -695,20 +669,6 @@ purple_log_common_total_sizer(PurpleLogC
}
}
-
- // G_LOCK(logsize_users);
- // lu = g_new(_purple_logsize_user, 1);
- // lu->name = g_strdup(purple_normalize(account, name));
- // lu->account = account; //g_object_ref?
-
- // total = size;
-
- // if (g_hash_table_lookup_extended(logsize_users, lu, NULL, &ptrsize))
- // total += GPOINTER_TO_INT(ptrsize);
-
- // g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(total));
- // G_UNLOCK(logsize_users);
-
g_dir_close(dir);
g_free(path);
@@ -718,7 +678,7 @@ common_total_sizer_thread(GSimpleAsyncRe
static void
common_total_sizer_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
{
- _common_total_size_callback_data *callback_data =
+ _common_thread_callback_data *callback_data =
g_simple_async_result_get_op_res_gpointer(simple);
PurpleAccount *account = callback_data->account;
PurpleLogChatType chat_type = callback_data->chat_type;
@@ -741,14 +701,14 @@ purple_log_common_total_sizer_async(Purp
PurpleAccount *account, const gchar *ext, gint io_priority, GCancellable *cancellable,
GAsyncReadyCallback cb, gpointer userdata)
{
- _common_total_size_callback_data *callback_data;
+ _common_thread_callback_data *callback_data;
GSimpleAsyncResult *simple;
g_return_if_fail(name != NULL);
g_return_if_fail(account != NULL);
g_return_if_fail(ext != NULL);
- callback_data = g_new0(_common_total_size_callback_data, 1);
+ callback_data = g_new0(_common_thread_callback_data, 1);
callback_data->chat_type = chat_type;
callback_data->name = g_strdup(name);
callback_data->account = account;
@@ -757,7 +717,7 @@ purple_log_common_total_sizer_async(Purp
simple = g_simple_async_result_new(NULL, cb, userdata, purple_log_common_total_sizer_async);
g_simple_async_result_set_op_res_gpointer(simple, callback_data,
- common_total_size_callback_data_free);
+ common_thread_callback_data_free);
g_simple_async_result_run_in_thread(simple, common_total_sizer_thread, io_priority, cancellable);
g_object_unref(simple);
More information about the Commits
mailing list