changeset 14001:66d01a547603

[gaim-migrate @ 16586] It is feasible that a UI is finished with notifying the user via the Notification API within the UI callback and has no need of a ui_handle to deal with closing the notification at a later date nor to tell the gaim core at a later point that it is finished with the data. If the ui_op for a notification returns a ui_handle of NULL, the GaimNotifyCloseCallback (if non-NULL) is now called immediately and the info structure is freed. If the op returns a non-NULL value, which is the case for all of gtkgaim's functions, the behavior is unchanged. committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Thu, 27 Jul 2006 20:02:57 +0000
parents f327a27f7f07
children fccb5cfa33b9
files src/notify.c
diffstat 1 files changed, 86 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/notify.c	Thu Jul 27 18:58:14 2006 +0000
+++ b/src/notify.c	Thu Jul 27 20:02:57 2006 +0000
@@ -58,9 +58,19 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+			
+			return info->ui_handle;
+			
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
 
-		return info->ui_handle;
+			g_free(info);
+
+			return NULL;
+		}		
 	}
 
 	return NULL;
@@ -85,7 +95,19 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+
+			return info->ui_handle;
+
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
+
+			g_free(info);
+
+			return NULL;
+		}		
 
 		return info->ui_handle;
 	}
@@ -125,9 +147,19 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+
+			return info->ui_handle;
 
-		return info->ui_handle;
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
+
+			g_free(info);
+
+			return NULL;
+		}
 	}
 
 	return NULL;
@@ -154,9 +186,19 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
-
-		return info->ui_handle;
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+			
+			return info->ui_handle;
+			
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
+			
+			g_free(info);
+			
+			return NULL;
+		}
 	}
 
 	return NULL;
@@ -183,7 +225,19 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+
+			return info->ui_handle;
+
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
+
+			g_free(info);
+
+			return NULL;
+		}
 
 		return info->ui_handle;
 	}
@@ -375,10 +429,21 @@
 		info->cb = cb;
 		info->cb_user_data = user_data;
 
-		handles = g_list_append(handles, info);
+		g_free(infotext);
+
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+
+			return info->ui_handle;
 
-		g_free(infotext);
-		return info->ui_handle;
+		} else {
+			if (info->cb != NULL)
+				info->cb(info->cb_user_data);
+
+			g_free(info);
+
+			return NULL;
+		}
 	}
 
 	return NULL;
@@ -401,9 +466,16 @@
 		info->handle    = handle;
 		info->ui_handle = ops->notify_uri(uri);
 
-		handles = g_list_append(handles, info);
+		if (info->ui_handle != NULL) {
+			handles = g_list_append(handles, info);
+			
+			return info->ui_handle;
 
-		return info->ui_handle;
+		} else {
+			g_free(info);
+
+			return NULL;
+		}
 	}
 
 	return NULL;