changeset 13244:c97c76d9d347

[gaim-migrate @ 15610] Don't create duplicate primtive statuses without messages when using the docklet, either. And I renamed a function and made it only look for transient statuses. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 12 Feb 2006 16:30:57 +0000
parents 70809b5c5f86
children 403c3a8287f7
files plugins/docklet/docklet.c src/gtkmain.c src/gtkstatusbox.c src/savedstatuses.c src/savedstatuses.h
diffstat 5 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/docklet/docklet.c	Sun Feb 12 16:28:17 2006 +0000
+++ b/plugins/docklet/docklet.c	Sun Feb 12 16:30:57 2006 +0000
@@ -374,9 +374,12 @@
 
 	primitive = GPOINTER_TO_INT(user_data);
 
-	/* Create a new transient saved status */
-	saved_status = gaim_savedstatus_new(NULL, primitive);
-	gaim_savedstatus_set_type(saved_status, primitive);
+	/* Try to lookup an already existing transient saved status */
+	saved_status = gaim_savedstatus_find_transient_by_type_and_message(primitive, NULL);
+
+	/* Create a new transient saved status if we weren't able to find one */
+	if (saved_status == NULL)
+		saved_status = gaim_savedstatus_new(NULL, primitive);
 
 	/* Set the status for each account */
 	gaim_savedstatus_activate(saved_status);
--- a/src/gtkmain.c	Sun Feb 12 16:28:17 2006 +0000
+++ b/src/gtkmain.c	Sun Feb 12 16:30:57 2006 +0000
@@ -736,7 +736,7 @@
 		GaimSavedStatus *saved_status;
 
 		/* If we've used this type+message before, lookup the transient status */
-		saved_status = gaim_savedstatus_find_by_type_and_message(
+		saved_status = gaim_savedstatus_find_transient_by_type_and_message(
 							GAIM_STATUS_OFFLINE, NULL);
 
 		/* If this type+message is unique then create a new transient saved status */
--- a/src/gtkstatusbox.c	Sun Feb 12 16:28:17 2006 +0000
+++ b/src/gtkstatusbox.c	Sun Feb 12 16:30:57 2006 +0000
@@ -1262,7 +1262,7 @@
 		if (changed)
 		{
 			/* If we've used this type+message before, lookup the transient status */
-			saved_status = gaim_savedstatus_find_by_type_and_message(
+			saved_status = gaim_savedstatus_find_transient_by_type_and_message(
 										GPOINTER_TO_INT(data), message);
 
 			/* If this type+message is unique then create a new transient saved status */
--- a/src/savedstatuses.c	Sun Feb 12 16:28:17 2006 +0000
+++ b/src/savedstatuses.c	Sun Feb 12 16:30:57 2006 +0000
@@ -804,8 +804,8 @@
 }
 
 GaimSavedStatus *
-gaim_savedstatus_find_by_type_and_message(GaimStatusPrimitive type,
-										  const char *message)
+gaim_savedstatus_find_transient_by_type_and_message(GaimStatusPrimitive type,
+													const char *message)
 {
 	GList *iter;
 	GaimSavedStatus *status;
@@ -813,7 +813,7 @@
 	for (iter = saved_statuses; iter != NULL; iter = iter->next)
 	{
 		status = (GaimSavedStatus *)iter->data;
-		if ((status->type == type) &&
+		if ((status->type == type) && gaim_savedstatus_is_transient(status) &&
 			(((status->message == NULL) && (message == NULL)) ||
 			((status->message != NULL) && (message != NULL) && !strcmp(status->message, message))))
 		{
--- a/src/savedstatuses.h	Sun Feb 12 16:28:17 2006 +0000
+++ b/src/savedstatuses.h	Sun Feb 12 16:30:57 2006 +0000
@@ -217,7 +217,7 @@
  *
  * @return The saved status if found, or NULL.
  */
-GaimSavedStatus *gaim_savedstatus_find_by_type_and_message(GaimStatusPrimitive type, const char *message);
+GaimSavedStatus *gaim_savedstatus_find_transient_by_type_and_message(GaimStatusPrimitive type, const char *message);
 
 /**
  * Determines if a given saved status is "transient."