changeset 7625:1ffe44bb2573

[gaim-migrate @ 8249] 1) removed a duplicate copy of one function. it was quite literally duplicate: it looked like an example of paste gone arry, like some of my commit messages. 2)" This is an update to make the disconnect dialog work better w/ the autoreconnect plugin and the accounts dialog. If any account on the list are reconnected (by anything that uses the "signed-on" signal, which should cover all bases), it will be removed from the list. Of course, the single-multiple behavior (show list or just message) still happens, and if it is there are no more disconnected accounts, the dialog will be closed." --Daniel Atallah (datallah) committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 24 Nov 2003 14:27:01 +0000
parents 8df31c1aca4a
children 2fb83607becf
files src/gtkconn.c src/gtkconv.c
diffstat 2 files changed, 33 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconn.c	Mon Nov 24 07:16:43 2003 +0000
+++ b/src/gtkconn.c	Mon Nov 24 14:27:01 2003 +0000
@@ -341,6 +341,35 @@
 	g_value_unset(&val);
 }
 
+static void disconnect_signed_on_cb(GaimConnection *gc, void *data)
+{
+	if (disconnect_window) {
+		GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview));
+		GtkTreeIter iter;
+		if (gtk_tree_model_get_iter_first(model, &iter)) {
+			GaimAccount *account = NULL;
+			do {
+				GValue val = { 0, };
+				gtk_tree_model_get_value(model, &iter, 4, &val);
+				account = g_value_get_pointer(&val);
+				g_value_unset(&val);
+				if (account == gaim_connection_get_account(gc)) {
+					gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
+
+					if (!gtk_tree_model_get_iter_first(model, &iter))
+						disconnect_window_hide();
+					else {
+						GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(disconnect_window->treeview));
+						gtk_tree_selection_select_iter(sel, &iter);
+						if (!gtk_tree_model_iter_next(model, &iter))
+							gtk_widget_hide_all(disconnect_window->sw);
+					}
+					break;
+				}
+			} while (gtk_tree_model_iter_next(model, &iter));
+		}
+	}
+}
 
 static void
 gaim_gtk_connection_report_disconnect(GaimConnection *gc, const char *text)
@@ -423,6 +452,10 @@
 		gtk_widget_set_size_request(disconnect_window->treeview, -1, 96);
 		g_signal_connect (G_OBJECT (sel), "changed",
 				  G_CALLBACK (disconnect_tree_cb), list_store);
+
+		gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
+				disconnect_window, GAIM_CALLBACK(disconnect_signed_on_cb), NULL);
+
 	} else
 		list_store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(disconnect_window->treeview)));
 
--- a/src/gtkconv.c	Mon Nov 24 07:16:43 2003 +0000
+++ b/src/gtkconv.c	Mon Nov 24 14:27:01 2003 +0000
@@ -895,20 +895,6 @@
 }
 
 static void
-menu_sendfile_cb(gpointer data, guint action, GtkWidget *widget)
-{
-	GaimConvWindow *win = (GaimConvWindow *)data;
-	GaimConversation *conv;
-	GaimConnection *gc;
-
-	conv = gaim_conv_window_get_active_conversation(win);
-
-	gc = gaim_conversation_get_gc(conv);
-
-	gaim_prpl_ask_send_file (gc, gaim_conversation_get_name (conv));
-}
-
-static void
 menu_warn_cb(gpointer data, guint action, GtkWidget *widget)
 {
 	GaimConvWindow *win = (GaimConvWindow *)data;