changeset 13985:a7b1d2ab9cb0

[gaim-migrate @ 16555] Do not crash when you close the debug window, or use the "/clear" command. Enable the stuff in gntaccount.c that were waiting on the request-ui. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 24 Jul 2006 01:03:07 +0000
parents 599b35acd842
children 8a8b4f7f7d99
files console/gntaccount.c console/gntconv.c console/gntdebug.c
diffstat 3 files changed, 34 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntaccount.c	Mon Jul 24 00:52:01 2006 +0000
+++ b/console/gntaccount.c	Mon Jul 24 01:03:07 2006 +0000
@@ -644,9 +644,7 @@
 	gnt_widget_destroy(accounts.window);
 }
 
-#if 0
 /* The following uiops stuff are copied from gtkaccount.c */
-/* Need to do some work on notify- and request-ui before this works */
 typedef struct
 {
 	GaimAccount *account;
@@ -693,6 +691,31 @@
 }
 
 static void
+free_add_user_data(AddUserData *data)
+{
+	g_free(data->username);
+
+	if (data->alias != NULL)
+		g_free(data->alias);
+
+	g_free(data);
+}
+
+static void
+add_user_cb(AddUserData *data)
+{
+	GaimConnection *gc = gaim_account_get_connection(data->account);
+
+	if (g_list_find(gaim_connections_get_all(), gc))
+	{
+		gaim_blist_request_add_buddy(data->account, data->username,
+									 NULL, data->alias);
+	}
+
+	free_add_user_data(data);
+}
+
+static void
 request_add(GaimAccount *account, const char *remote_user,
 		  const char *id, const char *alias,
 		  const char *msg)
@@ -709,12 +732,10 @@
 	data->alias    = (alias != NULL ? g_strdup(alias) : NULL);
 
 	buffer = make_info(account, gc, remote_user, id, alias, msg);
-#if 0
 	gaim_request_action(NULL, NULL, _("Add buddy to your list?"),
 	                    buffer, GAIM_DEFAULT_ACTION_NONE, data, 2,
 	                    _("Add"),    G_CALLBACK(add_user_cb),
 	                    _("Cancel"), G_CALLBACK(free_add_user_data));
-#endif
 	g_free(buffer);
 }
 
@@ -724,16 +745,6 @@
 	.status_changed = NULL,
 	.request_add  = request_add
 };
-#else
-
-static GaimAccountUiOps ui_ops = 
-{
-	.notify_added = NULL,
-	.status_changed = NULL,
-	.request_add  = NULL
-};
-
-#endif
 
 GaimAccountUiOps *gg_accounts_get_ui_ops()
 {
--- a/console/gntconv.c	Mon Jul 24 00:52:01 2006 +0000
+++ b/console/gntconv.c	Mon Jul 24 01:03:07 2006 +0000
@@ -159,6 +159,7 @@
 	g_hash_table_insert(ggconvs, conv, ggc);
 
 	ggc->conv = conv;
+	conv->ui_data = ggc;
 
 	type = gaim_conversation_get_type(conv);
 	title = g_strdup_printf(_("%s"), gaim_conversation_get_name(conv));
--- a/console/gntdebug.c	Mon Jul 24 00:52:01 2006 +0000
+++ b/console/gntdebug.c	Mon Jul 24 01:03:07 2006 +0000
@@ -80,6 +80,12 @@
 	return &uiops;
 }
 
+static void
+reset_debug_win(GntWidget *w, gpointer null)
+{
+	debug.window = debug.tview = NULL;
+}
+
 void gg_debug_window_show()
 {
 	if (debug.window == NULL)
@@ -90,6 +96,8 @@
 
 		debug.tview = gnt_text_view_new();
 		gnt_box_add_widget(GNT_BOX(debug.window), debug.tview);
+
+		g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL);
 	}
 
 	gnt_widget_show(debug.window);