# HG changeset patch # User Evan Schoenberg # Date 1154030577 0 # Node ID 66d01a5476033b4cbf281bdb69800b5daae61da8 # Parent f327a27f7f071227b247720c366c1dbd3ce56a76 [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 diff -r f327a27f7f07 -r 66d01a547603 src/notify.c --- 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;