# HG changeset patch # User andrew.victor@mxit.com # Date 1304456139 0 # Node ID 63fb41aa3dbedf3a977e71377cd3b054a5f90f1c # Parent 3448f64d197c28a9ab2fc6e237809193bc241f6f Add API: * purple_notify_searchresult_column_set_visible * purple_notify_searchresult_column_is_visible This allows columns to be defined in the search-results, but that are not visible to the user. These columns can, for example, be used to store values associated with the selected-row that are required in the search-result callback. diff -r 3448f64d197c -r 63fb41aa3dbe ChangeLog.API --- a/ChangeLog.API Mon Apr 18 07:02:43 2011 +0000 +++ b/ChangeLog.API Tue May 03 20:55:39 2011 +0000 @@ -2,6 +2,10 @@ version 3.0.0 (??/??/????): libpurple: + Added: + * purple_notify_searchresult_column_set_visible + * purple_notify_searchresult_column_is_visible + Removed: * purple_core_migrate diff -r 3448f64d197c -r 63fb41aa3dbe finch/gntnotify.c --- a/finch/gntnotify.c Mon Apr 18 07:02:43 2011 +0000 +++ b/finch/gntnotify.c Tue May 03 20:55:39 2011 +0000 @@ -426,6 +426,9 @@ { PurpleNotifySearchColumn *column = iter->data; gnt_tree_set_column_title(GNT_TREE(tree), i, column->title); + + if (!purple_notify_searchresult_column_is_visible(column)) + gnt_tree_set_column_visible(GNT_TREE(tree), i, FALSE); i++; } diff -r 3448f64d197c -r 63fb41aa3dbe libpurple/notify.c --- a/libpurple/notify.c Mon Apr 18 07:02:43 2011 +0000 +++ b/libpurple/notify.c Tue May 03 20:55:39 2011 +0000 @@ -363,10 +363,26 @@ sc = g_new0(PurpleNotifySearchColumn, 1); sc->title = g_strdup(title); + sc->visible = TRUE; return sc; } +void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible) +{ + g_return_if_fail(column != NULL); + + column->visible = visible; +} + +gboolean +purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *column) +{ + g_return_val_if_fail(column != NULL, FALSE); + + return column->visible; +} + guint purple_notify_searchresults_get_columns_count(PurpleNotifySearchResults *results) { diff -r 3448f64d197c -r 63fb41aa3dbe libpurple/notify.h --- a/libpurple/notify.h Mon Apr 18 07:02:43 2011 +0000 +++ b/libpurple/notify.h Tue May 03 20:55:39 2011 +0000 @@ -111,7 +111,8 @@ */ typedef struct { - char *title; /**< Title of the column. */ + char *title; /**< Title of the column. */ + gboolean visible; } PurpleNotifySearchColumn; @@ -275,6 +276,23 @@ PurpleNotifySearchColumn *purple_notify_searchresults_column_new(const char *title); /** + * Sets whether or not a search result column is visible. + * + * @param field The search column object. + * @param visible TRUE if visible, or FALSE if not. + */ +void purple_notify_searchresult_column_set_visible(PurpleNotifySearchColumn *column, gboolean visible); + +/** + * Returns whether or not a search result column is visible. + * + * @param field The search column object. + * + * @return TRUE if the search result column is visible. FALSE otherwise. + */ +gboolean purple_notify_searchresult_column_is_visible(const PurpleNotifySearchColumn *column); + +/** * Adds a new column to the search result object. * * @param results The result object to which the column will be added. diff -r 3448f64d197c -r 63fb41aa3dbe pidgin/gtknotify.c --- a/pidgin/gtknotify.c Mon Apr 18 07:02:43 2011 +0000 +++ b/pidgin/gtknotify.c Tue May 03 20:55:39 2011 +0000 @@ -1035,6 +1035,10 @@ gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, column->title, renderer, "text", i, NULL); + + if (!purple_notify_searchresult_column_is_visible(column)) + gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(treeview), i), FALSE); + i++; }