cpw.nader.asynclogging-3: 90692479: Fixed up issues preventing finch and the...
morshed.nader at gmail.com
morshed.nader at gmail.com
Sun Jan 8 01:21:28 EST 2012
----------------------------------------------------------------------
Revision: 9069247967495c487054ab7bf69932cb453eca33
Parent: d620dbe77b5011dbc39bae7eb347ef4f5c998f43
Author: morshed.nader at gmail.com
Date: 01/07/12 14:08:06
Branch: im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/9069247967495c487054ab7bf69932cb453eca33
Changelog:
Fixed up issues preventing finch and the gnthistory plugin from compiling
Cleaned up gntlog.c a little
Changes against parent d620dbe77b5011dbc39bae7eb347ef4f5c998f43
patched finch/gntblist.c
patched finch/gntlog.c
patched finch/plugins/gnthistory.c
-------------- next part --------------
============================================================
--- finch/gntblist.c 15c92030286c0f678dcb5922834ba783e87b8e62
+++ finch/gntblist.c 23a3b3312eeb5c25c9deeb16a51b333b7185db7e
@@ -2472,7 +2472,7 @@ get_contact_log_size(PurpleBlistNode *c)
for (node = purple_blist_node_get_first_child(c); node; node = purple_blist_node_get_sibling_next(node)) {
PurpleBuddy *b = (PurpleBuddy*)node;
- log += purple_logs_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b),
+ log += purple_logs_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b),
purple_buddy_get_account(b), NULL, NULL);
}
@@ -2492,10 +2492,12 @@ blist_node_compare_log(PurpleBlistNode *
case PURPLE_BLIST_BUDDY_NODE:
b1 = (PurpleBuddy*)n1;
b2 = (PurpleBuddy*)n2;
- ret = purple_logs_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b2),
+
+ ret = purple_logs_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b2),
purple_buddy_get_account(b2), NULL, NULL) -
- purple_logs_get_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b1),
+ purple_logs_total_size(PURPLE_LOG_IM, purple_buddy_get_name(b1),
purple_buddy_get_account(b1), NULL, NULL);
+
if (ret != 0)
return ret;
break;
============================================================
--- finch/plugins/gnthistory.c 82d82cc5645f9596923258411b10fbf7f001a872
+++ finch/plugins/gnthistory.c f67abc80df1701b95f9cd896380362aa3aa9aa27
@@ -48,27 +48,28 @@ typedef struct {
const gchar *alias;
guint count;
gulong delete_handle;
-} _historize_callback_data;
+} historize_callback_data;
static void historize(PurpleConversation *);
static gboolean _scroll_gnt_text_view_to_end(gpointer);
static PurpleLog *get_last_log(GList *, PurpleLog *);
static void historize_log_read_cb(GObject *, GAsyncResult *, gpointer);
static void historize_log_list_cb(GObject *, GAsyncResult *, gpointer);
-static void historize_log_list_cb_done(_historize_callback_data *);
+static void historize_log_list_cb_done(historize_callback_data *);
static void historize_log_collector_cb(GObject *, GAsyncResult *, gpointer);
-static void historize_log_collector_cb_done(_historize_callback_data *);
+static void historize_log_collector_cb_done(historize_callback_data *);
static void historize_stop(PurpleConversation *, gpointer);
-static void historize_log_free(_historize_callback_data *);
+static void historize_log_free(historize_callback_data *);
static void history_prefs_check(PurplePlugin *);
-static void history_prefs_cb(const gchar *, PurplePrefType, gconstpointer, gpointer);
+static void history_prefs_cb(const gchar *, PurplePrefType, gconstpointer,
+ gpointer);
static gboolean plugin_load(PurplePlugin *);
static void init_plugin(PurplePlugin *);
static void
historize(PurpleConversation *c)
{
- _historize_callback_data *callback_data;
+ historize_callback_data *data;
PurpleAccount *account = purple_conversation_get_account(c);
PurpleConversationType convtype = purple_conversation_get_type(c);
FinchConv *fc = FINCH_CONV(c);
@@ -77,12 +78,12 @@ historize(PurpleConversation *c)
g_return_if_fail(fc != NULL);
g_return_if_fail(fc->list != NULL);
- callback_data = g_new0(_historize_callback_data, 1);
- callback_data->conv = c;
- callback_data->alias = alias;
- callback_data->name = name;
- callback_data->account = account;
- callback_data->cancel = g_cancellable_new();
+ data = g_new0(historize_callback_data, 1);
+ data->conv = c;
+ data->alias = alias;
+ data->name = name;
+ data->account = account;
+ data->cancel = g_cancellable_new();
if (convtype == PURPLE_CONV_TYPE_IM && fc->list->next == NULL) {
GSList *buddies, *cur;
@@ -90,8 +91,8 @@ historize(PurpleConversation *c)
/* If we're not logging, don't show anything.
* Otherwise, we might show a very old log. */
if (!purple_prefs_get_bool("/purple/logging/log_ims")) {
- g_object_unref(callback_data->cancel);
- g_free(callback_data);
+ g_object_unref(data->cancel);
+ g_free(data);
return;
}
@@ -119,15 +120,21 @@ historize(PurpleConversation *c)
/* We've found a buddy that matches this conversation. It's part of a
* PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies
* in the contact and get all the logs. */
- for (node2 = child; node2 != NULL; node2 = purple_blist_node_get_sibling_next(node2))
+ for (node2 = child;
+ node2 != NULL;
+ node2 = purple_blist_node_get_sibling_next(node2))
{
PurpleBuddy *buddy = PURPLE_BUDDY(node2);
- callback_data->count++;
+ data->count++;
- purple_logs_list_logs_async(PURPLE_LOG_IM, purple_buddy_get_name(buddy),
- purple_buddy_get_account(buddy), G_PRIORITY_DEFAULT,
- callback_data->cancel, historize_log_collector_cb, callback_data);
+ purple_logs_list_async(PURPLE_LOG_IM,
+ purple_buddy_get_name(buddy),
+ purple_buddy_get_account(buddy),
+ G_PRIORITY_DEFAULT,
+ data->cancel,
+ historize_log_collector_cb,
+ data);
}
break;
@@ -139,20 +146,25 @@ historize(PurpleConversation *c)
/* If we're not logging, don't show anything.
* Otherwise, we might show a very old log. */
if (!purple_prefs_get_bool("/purple/logging/log_chats")) {
- g_object_unref(callback_data->cancel);
- g_free(callback_data);
+ g_object_unref(data->cancel);
+ g_free(data);
return;
}
- callback_data->count = 1;
+ data->count = 1;
- purple_logs_list_logs_async(PURPLE_LOG_CHAT, name, account, G_PRIORITY_DEFAULT,
- callback_data->cancel, historize_log_list_cb, callback_data);
+ purple_logs_list_async(PURPLE_LOG_CHAT,
+ name,
+ account,
+ G_PRIORITY_DEFAULT,
+ data->cancel,
+ historize_log_list_cb,
+ data);
}
- callback_data->delete_handle = purple_signal_connect(purple_conversations_get_handle(),
- "deleting-conversation", c, PURPLE_CALLBACK(historize_stop), callback_data);
+ data->delete_handle = purple_signal_connect(purple_conversations_get_handle(),
+ "deleting-conversation", c, PURPLE_CALLBACK(historize_stop), data);
}
static gboolean
@@ -192,12 +204,12 @@ historize_log_read_cb(GObject *object, G
static void
historize_log_read_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _historize_callback_data *callback_data = userdata;
- PurpleConversation *c = callback_data->conv;
- PurpleLog *log = callback_data->log;
+ historize_callback_data *data = userdata;
+ PurpleConversation *c = data->conv;
+ PurpleLog *log = data->log;
PurpleLogReadFlags flags;
PurpleMessageFlags options;
- FinchConv *fc = FINCH_CONV(callback_data->conv);
+ FinchConv *fc = FINCH_CONV(data->conv);
GntTextView *view = GNT_TEXT_VIEW(fc->tv);
GError *err = NULL;
GString *buffer = view->string;
@@ -206,10 +218,10 @@ historize_log_read_cb(GObject *object, G
const struct tm *tm;
if (res == NULL) {
- callback_data->count--;
+ data->count--;
- if (callback_data->count < 1)
- historize_log_free(callback_data);
+ if (data->count < 1)
+ historize_log_free(data);
return;
}
@@ -234,8 +246,9 @@ historize_log_read_cb(GObject *object, G
header_date = purple_date_format_full(localtime(&log_time));
}
- escaped_alias = g_markup_escape_text(callback_data->alias, -1);
- full_header = g_strdup_printf(_("Conversation with %s on %s"), escaped_alias, header_date);
+ escaped_alias = g_markup_escape_text(data->alias, -1);
+ full_header = g_strdup_printf(_("Conversation with %s on %s"),
+ escaped_alias, header_date);
header = g_strdup_printf("<b>%s:</b><br>", full_header);
purple_conversation_write(c, "", header, options, time(NULL));
@@ -258,7 +271,8 @@ historize_log_read_cb(GObject *object, G
purple_conversation_write(c, "", "<hr>", options, time(NULL));
if (text_backup != NULL) {
- purple_conversation_write(c, "", text_backup, PURPLE_MESSAGE_NO_LOG, time(NULL));
+ purple_conversation_write(c, "", text_backup, PURPLE_MESSAGE_NO_LOG,
+ time(NULL));
g_free(text_backup);
}
@@ -266,116 +280,121 @@ historize_log_read_cb(GObject *object, G
g_clear_error(&err);
- callback_data->count--;
+ data->count--;
- if (callback_data->count < 1)
- historize_log_free(callback_data);
+ if (data->count < 1)
+ historize_log_free(data);
}
static void
historize_log_list_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _historize_callback_data *callback_data = userdata;
+ historize_callback_data *data = userdata;
GList *list;
GError *err = NULL;
if (res == NULL) {
- callback_data->count--;
+ data->count--;
- if (callback_data->count < 1)
- historize_log_list_cb_done(callback_data);
+ if (data->count < 1)
+ historize_log_list_cb_done(data);
return;
}
- list = purple_logs_list_logs_finish(res, &err);
+ list = purple_logs_list_finish(res, &err);
if (list != NULL)
- callback_data->log = get_last_log(list, callback_data->log);
+ data->log = get_last_log(list, data->log);
else if (err != NULL && err->code != G_IO_ERROR_CANCELLED)
purple_debug_error("gnthistory", "%s\n", err->message);
g_clear_error(&err);
- callback_data->count--;
+ data->count--;
- if (callback_data->count < 1)
- historize_log_list_cb_done(callback_data);
+ if (data->count < 1)
+ historize_log_list_cb_done(data);
}
static void
-historize_log_list_cb_done(_historize_callback_data *callback_data)
+historize_log_list_cb_done(historize_callback_data *data)
{
- callback_data->count++;
+ data->count++;
- if (callback_data->log != NULL)
- purple_log_read_async(callback_data->log, G_PRIORITY_DEFAULT,
- callback_data->cancel, historize_log_read_cb, callback_data);
+ if (data->log != NULL)
+ purple_log_read_async(data->log, G_PRIORITY_DEFAULT,
+ data->cancel, historize_log_read_cb, data);
else
- historize_log_read_cb(NULL, NULL, callback_data);
+ historize_log_read_cb(NULL, NULL, data);
}
static void
historize_log_collector_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _historize_callback_data *callback_data = userdata;
+ historize_callback_data *data = userdata;
GList *list;
GError *err = NULL;
- list = purple_logs_list_logs_finish(res, &err);
+ list = purple_logs_list_finish(res, &err);
if (list != NULL)
- callback_data->log = get_last_log(list, callback_data->log);
+ data->log = get_last_log(list, data->log);
else if (err != NULL && err->code != G_IO_ERROR_CANCELLED)
purple_debug_error("gnthistory", "%s\n", err->message);
g_clear_error(&err);
- callback_data->count--;
+ data->count--;
- if (callback_data->count < 1)
+ if (data->count < 1)
historize_log_collector_cb_done(userdata);
}
static void
-historize_log_collector_cb_done(_historize_callback_data *callback_data)
+historize_log_collector_cb_done(historize_callback_data *data)
{
- callback_data->count++;
+ data->count++;
- if (callback_data->log == NULL)
- purple_logs_list_logs_async(PURPLE_LOG_IM, callback_data->name,
- callback_data->account, G_PRIORITY_DEFAULT, callback_data->cancel,
- historize_log_list_cb, callback_data);
+ if (data->log == NULL)
+ purple_logs_list_async(PURPLE_LOG_IM,
+ data->name,
+ data->account,
+ G_PRIORITY_DEFAULT,
+ data->cancel,
+ historize_log_list_cb,
+ data);
else
- historize_log_list_cb(NULL, NULL, callback_data);
+ historize_log_list_cb(NULL, NULL, data);
}
static void
historize_stop(PurpleConversation *c, gpointer userdata)
{
- _historize_callback_data *callback_data = userdata;
+ historize_callback_data *data = userdata;
- if (callback_data->cancel != NULL)
- g_cancellable_cancel(callback_data->cancel);
+ if (data->cancel != NULL)
+ g_cancellable_cancel(data->cancel);
- purple_signal_disconnect(purple_conversations_get_handle(), "deleting-conversation",
- c, PURPLE_CALLBACK(historize_stop));
+ purple_signal_disconnect(purple_conversations_get_handle(),
+ "deleting-conversation", c, PURPLE_CALLBACK(historize_stop));
}
static void
-historize_log_free(_historize_callback_data *callback_data)
+historize_log_free(historize_callback_data *data)
{
- if (callback_data->log != NULL)
- g_object_unref(callback_data->log);
+ if (data->log != NULL)
+ g_object_unref(data->log);
- // Why on earth does pidgin give us gulong to refer to our connected signal if it
- // offers no API to disconnect it with!?
- purple_signal_disconnect(purple_conversations_get_handle(), "deleting-conversation",
- callback_data->conv, PURPLE_CALLBACK(historize_stop));
+ /* Why on earth does pidgin give us gulong to refer to our connected signal
+ * if it offers no API to disconnect it with!?
+ */
+ purple_signal_disconnect(purple_conversations_get_handle(),
+ "deleting-conversation", data->conv, PURPLE_CALLBACK(historize_stop));
- g_object_unref(callback_data->cancel);
+ g_object_unref(data->cancel);
- g_free(callback_data);
+ g_free(data);
}
static void
@@ -432,7 +451,8 @@ static void
}
static void
-history_prefs_cb(const gchar *name, PurplePrefType type, gconstpointer val, gpointer data)
+history_prefs_cb(const gchar *name, PurplePrefType type, gconstpointer val,
+ gpointer data)
{
history_prefs_check((PurplePlugin *) data);
}
============================================================
--- finch/gntlog.c d6ac085d088991402f216517f281c9df84c1cbee
+++ finch/gntlog.c 1641f54566dfd19bc4fab7d7b17eb19810bc70e4
@@ -107,7 +107,7 @@ typedef struct {
guint count;
guint total;
-} _finch_log_data;
+} finch_log_data;
typedef struct {
PurpleAccount *account;
@@ -117,23 +117,23 @@ typedef struct {
} log_viewer_hash_t;
-static void finch_log_data_free(_finch_log_data *);
-static void finch_window_destroy_cb(_finch_log_data *);
+static void finch_log_data_free(finch_log_data *);
+static void finch_window_destroy_cb(finch_log_data *);
static guint log_viewer_hash(gconstpointer);
static gboolean log_viewer_equal(gconstpointer, gconstpointer);
static const gchar *log_get_date(PurpleLog *);
static FinchLogViewer *finch_log_viewer_new(log_viewer_hash_t *, const gchar *,
gboolean);
-static void finch_log_search_done_cb(_finch_log_data *);
+static void finch_log_search_done_cb(finch_log_data *);
static void finch_log_search_cb(GObject *, GAsyncResult *, gpointer);
static void search_cb(GntWidget *, FinchLogViewer *);
static void destroy_cb(FinchLogViewer *, log_viewer_hash_t *);
static void finch_log_read_cb(GObject *, GAsyncResult *, gpointer);
static void log_select_cb(GntWidget *, gpointer, gpointer, FinchLogViewer *);
static void populate_log_tree(FinchLogViewer *);
-static void finch_log_done_cb(_finch_log_data *);
-static void finch_log_viewer_update_list_bar(_finch_log_data *);
-static void finch_log_viewer_update_search_bar(_finch_log_data *);
+static void finch_log_done_cb(finch_log_data *);
+static void finch_log_viewer_update_list_bar(finch_log_data *);
+static void finch_log_viewer_update_search_bar(finch_log_data *);
static void finch_log_size_cb(GObject *, GAsyncResult *, gpointer);
static void finch_log_list_cb(GObject *, GAsyncResult *, gpointer);
static void finch_log_system_list_cb(GObject *, GAsyncResult *, gpointer);
@@ -205,7 +205,7 @@ static void
}
static void
-finch_log_data_free(_finch_log_data *data)
+finch_log_data_free(finch_log_data *data)
{
if (data->destroy_handler_id > 0)
g_signal_handler_disconnect(data->log_viewer, data->destroy_handler_id);
@@ -214,29 +214,29 @@ static void
}
static void
-finch_window_destroy_cb(_finch_log_data *data)
+finch_window_destroy_cb(finch_log_data *data)
{
data->destroy_handler_id = 0;
data->is_window_open = FALSE;
}
static void
-finch_log_search_done_cb(_finch_log_data *finch_log_data)
+finch_log_search_done_cb(finch_log_data *data)
{
- if (finch_log_data->is_window_open) {
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ if (data->is_window_open) {
+ FinchLogViewer *lv = data->log_viewer;
gnt_widget_hide(finch_log_viewer_get_search_bar(lv));
gnt_box_readjust(GNT_BOX(lv));
}
- finch_log_data_free(finch_log_data);
+ finch_log_data_free(data);
}
static void
finch_log_search_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *data = userdata;
+ finch_log_data *data = userdata;
GError *error = NULL;
GList *logs;
@@ -250,7 +250,7 @@ finch_log_search_cb(GObject *object, GAs
}
data->count--;
- } else if (finch_log_data->is_window_open)
+ } else if (data->is_window_open)
finch_log_viewer_add_logs(data->log_viewer, logs);
g_clear_error(&error);
@@ -270,13 +270,13 @@ search_cb(GntWidget *button, FinchLogVie
static void
search_cb(GntWidget *button, FinchLogViewer *lv)
{
- _finch_log_data *data;
+ finch_log_data *data;
FinchLogViewerPrivate *priv = FINCH_LOG_VIEWER_GET_PRIVATE(lv);
GntTree *tree = GNT_TREE(finch_log_viewer_get_tree(lv));
GntTextView *view = GNT_TEXT_VIEW(finch_log_viewer_get_text_area(lv));
GntWidget *bar;
GCancellable *cancel;
- GList *logs;
+ GList *logs, *account, *name;
const gchar *search_term, *old_search;
guint length;
@@ -309,7 +309,7 @@ search_cb(GntWidget *button, FinchLogVie
gnt_tree_remove_all(tree);
gnt_text_view_clear(view);
- data = g_new0(_finch_log_data, 1);
+ data = g_new0(finch_log_data, 1);
data->is_window_open = TRUE;
data->log_viewer = lv;
data->string = g_strdup(search_term);
@@ -358,7 +358,7 @@ finch_log_read_cb(GObject *object, GAsyn
static void
finch_log_read_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *data = userdata;
+ finch_log_data *data = userdata;
if (data->is_window_open) {
PurpleLog *log = data->log;
@@ -405,7 +405,7 @@ log_select_cb(GntWidget *w, gpointer old
log_select_cb(GntWidget *w, gpointer old_row, gpointer new_row,
FinchLogViewer *lv)
{
- _finch_log_data *data;
+ finch_log_data *data;
PurpleLog *log;
PurpleLogChatType chat_type;
GntTree *tree = GNT_TREE(w);
@@ -439,7 +439,7 @@ log_select_cb(GntWidget *w, gpointer old
g_free(title);
}
- data = g_new0(_finch_log_data, 1);
+ data = g_new0(finch_log_data, 1);
data->is_window_open = TRUE;
data->total = data->count = 1;
data->log_viewer = lv;
@@ -533,10 +533,10 @@ static void
}
static void
-finch_log_done_cb(_finch_log_data *finch_log_data)
+finch_log_done_cb(finch_log_data *data)
{
- if (finch_log_data->is_window_open) {
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ if (data->is_window_open) {
+ FinchLogViewer *lv = data->log_viewer;
GntWidget *bar = finch_log_viewer_get_list_bar(lv);
GList *logs = finch_log_viewer_get_logs(lv);
@@ -570,42 +570,42 @@ finch_log_done_cb(_finch_log_data *finch
}
}
- finch_log_data_free(finch_log_data);
+ finch_log_data_free(data);
}
static void
-finch_log_viewer_update_list_bar(_finch_log_data *finch_log_data)
+finch_log_viewer_update_list_bar(finch_log_data *data)
{
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ FinchLogViewer *lv = data->log_viewer;
GntWidget *bar = finch_log_viewer_get_list_bar(lv);
gdouble fraction;
- fraction = (gdouble) finch_log_data->count /
- (gdouble) finch_log_data->total;
+ fraction = (gdouble) data->count /
+ (gdouble) data->total;
gnt_progress_bar_set_fraction(GNT_PROGRESS_BAR(bar), 1.0 - fraction);
}
static void
-finch_log_viewer_update_search_bar(_finch_log_data *finch_log_data)
+finch_log_viewer_update_search_bar(finch_log_data *data)
{
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ FinchLogViewer *lv = data->log_viewer;
GntWidget *bar = finch_log_viewer_get_search_bar(lv);
gdouble fraction;
- fraction = (gdouble) finch_log_data->count /
- (gdouble) finch_log_data->total;
+ fraction = (gdouble) data->count /
+ (gdouble) data->total;
gnt_progress_bar_set_fraction(GNT_PROGRESS_BAR(bar), 1.0 - fraction);
}
static void
finch_log_size_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *finch_log_data = userdata;
+ finch_log_data *data = userdata;
GError *error = NULL;
gssize log_size;
- log_size = purple_logs_get_total_size_finish(res, &error);
- finch_log_data->count--;
+ log_size = purple_logs_total_size_finish(res, &error);
+ data->count--;
purple_debug_info("gntlog", "log size: %d\n", log_size);
@@ -613,8 +613,8 @@ finch_log_size_cb(GObject *object, GAsyn
if (error->code != G_IO_ERROR_CANCELLED)
purple_debug_error("gntlog", "Error getting total log size: %s\n",
error->message);
- } else if (finch_log_data->is_window_open) {
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ } else if (data->is_window_open) {
+ FinchLogViewer *lv = data->log_viewer;
gsize total;
total = finch_log_viewer_get_total_size(lv);
@@ -624,71 +624,71 @@ finch_log_size_cb(GObject *object, GAsyn
g_clear_error(&error);
- if (finch_log_data->is_window_open)
- finch_log_viewer_update_list_bar(finch_log_data);
+ if (data->is_window_open)
+ finch_log_viewer_update_list_bar(data);
- if (finch_log_data->count < 1)
- finch_log_done_cb(finch_log_data);
+ if (data->count < 1)
+ finch_log_done_cb(data);
}
static void
finch_log_list_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *finch_log_data = userdata;
+ finch_log_data *data = userdata;
GError *error = NULL;
GList *list;
- list = purple_logs_list_logs_finish(res, &error);
+ list = purple_logs_list_finish(res, &error);
if (list == NULL) {
- finch_log_data->count--;
+ data->count--;
if (error != NULL && error->code != G_IO_ERROR_CANCELLED)
purple_debug_error("gntlog", "Error getting logs: %s\n",
error->message);
- } else if (finch_log_data->is_window_open)
- finch_log_viewer_add_logs(finch_log_data->log_viewer, list);
+ } else if (data->is_window_open)
+ finch_log_viewer_add_logs(data->log_viewer, list);
g_clear_error(&error);
- if (finch_log_data->is_window_open)
- finch_log_viewer_update_list_bar(finch_log_data);
+ if (data->is_window_open)
+ finch_log_viewer_update_list_bar(data);
- if (finch_log_data->count < 1)
- finch_log_done_cb(finch_log_data);
+ if (data->count < 1)
+ finch_log_done_cb(data);
}
static void
finch_log_system_list_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *finch_log_data = userdata;
+ finch_log_data *data = userdata;
GError *error = NULL;
GList *list;
list = purple_logs_list_finish(res, &error);
if (list == NULL) {
- finch_log_data->count--;
+ data->count--;
if (error != NULL && error->code != G_IO_ERROR_CANCELLED)
purple_debug_error("gntlog", "Error getting system logs: %s\n",
error->message);
- } else if (finch_log_data->is_window_open)
- finch_log_viewer_add_logs(finch_log_data->log_viewer, list);
+ } else if (data->is_window_open)
+ finch_log_viewer_add_logs(data->log_viewer, list);
g_clear_error(&error);
- if (finch_log_data->is_window_open)
- finch_log_viewer_update_list_bar(finch_log_data);
+ if (data->is_window_open)
+ finch_log_viewer_update_list_bar(data);
- if (finch_log_data->count < 1)
- finch_log_done_cb(finch_log_data);
+ if (data->count < 1)
+ finch_log_done_cb(data);
}
static void
finch_log_sets_cb(GObject *object, GAsyncResult *res, gpointer userdata)
{
- _finch_log_data *finch_log_data = userdata;
+ finch_log_data *data = userdata;
GError *error = NULL;
GHashTable *table;
@@ -699,15 +699,15 @@ finch_log_sets_cb(GObject *object, GAsyn
purple_debug_error("gntlog", "Error getting log sets: %s\n",
error->message);
- finch_log_data_free(finch_log_data);
- } else if (finch_log_data->is_window_open) {
- FinchLogViewer *lv = finch_log_data->log_viewer;
+ finch_log_data_free(data);
+ } else if (data->is_window_open) {
+ FinchLogViewer *lv = data->log_viewer;
GList *list = g_hash_table_get_keys(table);
if (list != NULL) {
GCancellable *cancel = finch_log_viewer_get_list_cancel(lv);
- finch_log_data->count = finch_log_data->total = 0;
+ data->count = data->total = 0;
for ( ; list != NULL; list = g_list_delete_link(list, list)) {
PurpleLogSet *set = list->data;
@@ -715,20 +715,20 @@ finch_log_sets_cb(GObject *object, GAsyn
if (set->type != PURPLE_LOG_IM)
continue;
- finch_log_data->count = (finch_log_data->total += 2);
+ data->count = (data->total += 2);
- purple_logs_list_logs_async(PURPLE_LOG_IM, set->name,
+ purple_logs_list_async(PURPLE_LOG_IM, set->name,
set->account, G_PRIORITY_DEFAULT, cancel,
- finch_log_list_cb, finch_log_data);
- purple_logs_get_total_size_async(PURPLE_LOG_IM, set->name,
+ finch_log_list_cb, data);
+ purple_logs_total_size_async(PURPLE_LOG_IM, set->name,
set->account, G_PRIORITY_DEFAULT, cancel,
- finch_log_size_cb, finch_log_data);
+ finch_log_size_cb, data);
}
}
g_hash_table_unref(table);
} else {
- finch_log_data_free(finch_log_data);
+ finch_log_data_free(data);
g_hash_table_unref(table);
}
@@ -740,7 +740,7 @@ finch_log_show(PurpleLogChatType chat_ty
PurpleAccount *account)
{
log_viewer_hash_t *ht;
- _finch_log_data *data;
+ finch_log_data *data;
FinchLogViewer *lv;
FinchLogViewerPrivate *priv;
GCancellable *cancel;
@@ -787,7 +787,7 @@ finch_log_show(PurpleLogChatType chat_ty
title = g_strdup(_("All Conversations"));
}
- data = g_new0(_finch_log_data, 1);
+ data = g_new0(finch_log_data, 1);
data->is_window_open = TRUE;
lv = data->log_viewer = finch_log_viewer_new(ht,
@@ -802,18 +802,18 @@ finch_log_show(PurpleLogChatType chat_ty
cancel = g_cancellable_new();
finch_log_viewer_set_list_cancel(lv, cancel);
- priv = PIDGIN_LOG_VIEWER_GET_PRIVATE(data->log_viewer);
+ priv = FINCH_LOG_VIEWER_GET_PRIVATE(data->log_viewer);
priv->chat_type = chat_type;
- priv->names = g_list_prepend(priv->names, g_strdup(buddyname));
+ priv->names = g_list_prepend(priv->names, g_strdup(username));
/* XXX: g_object_ref(account) */
priv->accounts = g_list_prepend(priv->accounts, account);
if (username != NULL) {
data->count = data->total = 2;
- purple_logs_list_logs_async(chat_type, username, account,
+ purple_logs_list_async(chat_type, username, account,
G_PRIORITY_DEFAULT, cancel, finch_log_list_cb, data);
- purple_logs_get_total_size_async(chat_type, username, account,
+ purple_logs_total_size_async(chat_type, username, account,
G_PRIORITY_DEFAULT, cancel, finch_log_size_cb, data);
} else {
/* This will happen only for IMs */
@@ -829,10 +829,11 @@ finch_log_show_contact(PurpleContact *co
void
finch_log_show_contact(PurpleContact *contact)
{
- _finch_log_data *data;
+ finch_log_data *data;
log_viewer_hash_t *ht;
PurpleBlistNode *child;
FinchLogViewer *lv;
+ FinchLogViewerPrivate *priv;
GCancellable *cancel;
const gchar *name = NULL;
gchar *title;
@@ -872,7 +873,7 @@ finch_log_show_contact(PurpleContact *co
name = "";
}
- data = g_new0(_finch_log_data, 1);
+ data = g_new0(finch_log_data, 1);
data->is_window_open = TRUE;
data->count = data->total = 0;
@@ -887,7 +888,7 @@ finch_log_show_contact(PurpleContact *co
cancel = g_cancellable_new();
finch_log_viewer_set_list_cancel(lv, cancel);
- priv = PIDGIN_LOG_VIEWER_GET_PRIVATE(data->log_viewer);
+ priv = FINCH_LOG_VIEWER_GET_PRIVATE(data->log_viewer);
priv->chat_type = PURPLE_LOG_IM;
for (child = purple_blist_node_get_first_child(PURPLE_BLIST_NODE(contact));
@@ -910,9 +911,9 @@ finch_log_show_contact(PurpleContact *co
/* XXX: g_object_ref(account) */
priv->accounts = g_list_prepend(priv->accounts, account);
- purple_logs_list_logs_async(PURPLE_LOG_IM, name, account,
+ purple_logs_list_async(PURPLE_LOG_IM, name, account,
G_PRIORITY_DEFAULT, cancel, finch_log_list_cb, data);
- purple_logs_get_total_size_async(PURPLE_LOG_IM, name, account,
+ purple_logs_total_size_async(PURPLE_LOG_IM, name, account,
G_PRIORITY_DEFAULT, cancel, finch_log_size_cb, data);
}
@@ -925,7 +926,7 @@ finch_syslog_show(void)
void
finch_syslog_show(void)
{
- _finch_log_data *finch_log_data;
+ finch_log_data *data;
FinchLogViewer *lv;
FinchLogViewerPrivate *priv;
GCancellable *cancel;
@@ -939,16 +940,16 @@ finch_syslog_show(void)
return;
}
- finch_log_data = g_new0(_finch_log_data, 1);
- finch_log_data->is_window_open = TRUE;
- finch_log_data->count = finch_log_data->total = 0;
+ data = g_new0(finch_log_data, 1);
+ data->is_window_open = TRUE;
+ data->count = data->total = 0;
- lv = finch_log_data->log_viewer = finch_log_viewer_new(NULL,
+ lv = data->log_viewer = finch_log_viewer_new(NULL,
_("System Log"), FALSE);
gnt_widget_show(GNT_WIDGET(lv));
- finch_log_data->destroy_handler_id = g_signal_connect_swapped(lv,
- "destroy", G_CALLBACK(finch_window_destroy_cb), finch_log_data);
+ data->destroy_handler_id = g_signal_connect_swapped(lv,
+ "destroy", G_CALLBACK(finch_window_destroy_cb), data);
cancel = g_cancellable_new();
finch_log_viewer_set_list_cancel(lv, cancel);
@@ -966,14 +967,14 @@ finch_syslog_show(void)
continue;
found_account = TRUE;
- finch_log_data->count++;
- finch_log_data->total++;
+ data->count++;
+ data->total++;
priv->accounts = g_list_prepend(priv->accounts, account);
purple_logs_list_async(PURPLE_LOG_SYSTEM, NULL, account,
G_PRIORITY_DEFAULT, cancel, finch_log_system_list_cb,
- finch_log_data);
+ data);
}
g_object_unref(cancel);
@@ -981,7 +982,7 @@ finch_syslog_show(void)
if (found_account)
syslog_viewer = lv;
else
- finch_log_done_cb(finch_log_data);
+ finch_log_done_cb(data);
}
GList *
More information about the Commits
mailing list