diff src/server.c @ 4412:8067614e49e4

[gaim-migrate @ 4685] Gtk2ification. Thanks, Ari. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sat, 25 Jan 2003 23:00:32 +0000
parents a8249a5250b6
children d9e4eacf6b46
line wrap: on
line diff
--- a/src/server.c	Sat Jan 25 21:23:02 2003 +0000
+++ b/src/server.c	Sat Jan 25 23:00:32 2003 +0000
@@ -492,17 +492,20 @@
 
 int find_queue_row_by_name(char *name)
 {
-	GSList *templist;
-	char *temp;
-	int i;
-
-	templist = message_queue;
+	gchar *temp;
+	gint i = 0;
+	gboolean valid;
+	GtkTreeIter iter;
 
-	for (i = 0; i < GTK_CLIST(clistqueue)->rows; i++) {
-		gtk_clist_get_text(GTK_CLIST(clistqueue), i, 0, &temp);
-
-		if (!strcmp(name, temp))
+	valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), &iter);
+	while(valid) {
+		gtk_tree_model_get(GTK_TREE_MODEL(awayqueuestore), &iter, 0, &temp, -1);
+		if(!strcmp(name, temp))
 			return i;
+		g_free(temp);
+		
+		i++;
+		valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(awayqueuestore), &iter);
 	}
 
 	return -1;
@@ -667,7 +670,7 @@
 		 * this to be queued properly, we have to make sure that the
 		 * imaway dialog actually exists, first.
 		 */
-		if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
+		if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
 			/* 
 			 * Alright, so we're going to queue it. Neat, eh? :)
 			 * So first we create something to store the message, and add
@@ -675,6 +678,8 @@
 			 * that we've queued something.
 			 */
 			struct queued_message *qm;
+			GtkTreeIter iter;
+			gchar path[10];
 
 			qm = g_new0(struct queued_message, 1);
 				g_snprintf(qm->name, sizeof(qm->name), "%s", name);
@@ -686,20 +691,25 @@
 			message_queue = g_slist_append(message_queue, qm);
 
 			row = find_queue_row_by_name(qm->name);
-
 			if (row >= 0) {
 				char number[32];
 				int qtotal;
 
 				qtotal = find_queue_total_by_name(qm->name);
 				g_snprintf(number, 32, _("(%d messages)"), qtotal);
-				gtk_clist_set_text(GTK_CLIST(clistqueue), row, 1, number);
+				g_snprintf(path, 10, "%d", row);
+				gtk_tree_model_get_iter_from_string(
+								GTK_TREE_MODEL(awayqueuestore), &iter, path);
+				gtk_list_store_set(awayqueuestore, &iter,
+								1, number, -1);
 			} else {
-				gchar *heh[2];
-
-				heh[0] = qm->name;
-				heh[1] = _("(1 message)");
-				gtk_clist_append(GTK_CLIST(clistqueue), heh);
+				gtk_tree_model_get_iter_first(GTK_TREE_MODEL(awayqueuestore), 
+								&iter);
+				gtk_list_store_append(awayqueuestore, &iter);
+				gtk_list_store_set(awayqueuestore, &iter,
+								0, qm->name,
+								1, _("(1 message)"),
+								-1);
 			}
 		} else {
 			/*
@@ -775,7 +785,7 @@
 		/* apply default fonts and colors */
 		tmpmsg = stylize(gc->away, MSG_LEN);
 		serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY);
-		if (!cnv && clistqueue && (away_options & OPT_AWAY_QUEUE)) {
+		if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) {
 			struct queued_message *qm;
 			qm = g_new0(struct queued_message, 1);
 			g_snprintf(qm->name, sizeof(qm->name), "%s", name);