changeset 18101:5cff2b8bfb08

merge of '42eba34c013784379084cfe8e5899cc7e9e7dde2' and 'c9b5a303a7b8dc0a0741ecef936ccf9082f18974'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 15 Jun 2007 04:27:08 +0000
parents 55ff2a39244e (current diff) f63b3a23280d (diff)
children 74842d0ac1a7
files
diffstat 4 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntconv.c	Thu Jun 14 15:33:50 2007 +0000
+++ b/finch/gntconv.c	Fri Jun 15 04:27:08 2007 +0000
@@ -440,6 +440,16 @@
 }
 
 static void
+gained_focus_cb(GntWindow *window, FinchConv *fc)
+{
+	GList *iter;
+	for (iter = fc->list; iter; iter = iter->next) {
+		purple_conversation_set_data(iter->data, "unseen-count", 0);
+		purple_conversation_update(iter->data, PURPLE_CONV_UPDATE_UNSEEN);
+	}
+}
+
+static void
 finch_create_conversation(PurpleConversation *conv)
 {
 	FinchConv *ggc = conv->ui_data;
@@ -529,6 +539,7 @@
 
 	g_free(title);
 	gnt_box_give_focus_to_child(GNT_BOX(ggc->window), ggc->entry);
+	g_signal_connect(G_OBJECT(ggc->window), "gained-focus", G_CALLBACK(gained_focus_cb), ggc);
 }
 
 static void
@@ -622,6 +633,11 @@
 
 	if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR))
 		gnt_widget_set_urgent(ggconv->tv);
+	if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) {
+		int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"));
+		purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1));
+		purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN);
+	}
 }
 
 static void
--- a/finch/gntplugin.c	Thu Jun 14 15:33:50 2007 +0000
+++ b/finch/gntplugin.c	Fri Jun 15 04:27:08 2007 +0000
@@ -106,6 +106,9 @@
 	char *text;
 	GList *list = NULL, *iter = NULL;
 
+	if (!plugin)
+		return;
+
 	/* If the selected plugin was unseen before, mark it as seen. But save the list
 	 * only when the plugin list is closed. So if the user enables a plugin, and it
 	 * crashes, it won't get marked as seen so the user can fix the bug and still
--- a/finch/libgnt/gnttree.c	Thu Jun 14 15:33:50 2007 +0000
+++ b/finch/libgnt/gnttree.c	Fri Jun 15 04:27:08 2007 +0000
@@ -753,15 +753,16 @@
 			g_signal_emit(tree, signals[SIG_TOGGLED], 0, row->key);
 			redraw_tree(tree);
 		}
+	} else {
+		return FALSE;
 	}
 
 	if (old != tree->current)
 	{
 		tree_selection_changed(tree, old, tree->current);
-		return TRUE;
 	}
 
-	return FALSE;
+	return TRUE;
 }
 
 static void
--- a/finch/libgnt/gntwm.c	Thu Jun 14 15:33:50 2007 +0000
+++ b/finch/libgnt/gntwm.c	Fri Jun 15 04:27:08 2007 +0000
@@ -1561,6 +1561,7 @@
 			gnt_wm_raise_window(wm, node->me);
 		} else {
 			bottom_panel(node->panel);     /* New windows should not grab focus */
+			gnt_widget_set_focus(node->me, FALSE);
 			gnt_widget_set_urgent(node->me);
 			if (wm->cws != ws)
 				gnt_ws_widget_hide(widget, wm->nodes);