Mercurial > pidgin.yaz
changeset 10435:341d4932f89e
[gaim-migrate @ 11692]
Better CTRL+F searching for the saved statuses window
Use gtk2.6's ellipsizing for status messages
Escape & in status titles when deleting statuses
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 27 Dec 2004 19:35:21 +0000 |
parents | 6be6da69d603 |
children | 08c8a18fb557 |
files | src/gtkblist.c src/gtksavedstatuses.c |
diffstat | 2 files changed, 24 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkblist.c Mon Dec 27 18:53:59 2004 +0000 +++ b/src/gtkblist.c Mon Dec 27 19:35:21 2004 +0000 @@ -3184,13 +3184,13 @@ static gboolean _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) { + gboolean result; gchar *enteredstring; const gchar *withmarkup; gchar *nomarkup; const gchar *normalized; - gboolean result; - - gtk_tree_model_get(model, iter, NAME_COLUMN, &withmarkup, -1); + + gtk_tree_model_get(model, iter, column, &withmarkup, -1); enteredstring = g_strdup(gaim_normalize(NULL, key)); nomarkup = gaim_markup_strip_html(withmarkup);
--- a/src/gtksavedstatuses.c Mon Dec 27 18:53:59 2004 +0000 +++ b/src/gtksavedstatuses.c Mon Dec 27 19:35:21 2004 +0000 @@ -167,11 +167,13 @@ GtkTreeIter *iter, gpointer user_data) { const char *title; - char *buf; + char *title_escaped, *buf; gtk_tree_model_get(model, iter, STATUS_WINDOW_COLUMN_TITLE, &title, -1); - buf = g_strdup_printf(_("Are you sure you want to delete %s?"), title); + title_escaped = gaim_escape_html(title); + buf = g_strdup_printf(_("Are you sure you want to delete %s?"), title_escaped); + free(title_escaped); gaim_request_action(NULL, NULL, buf, NULL, 0, g_strdup(title), 2, _("Delete"), status_window_delete_confirm_cb, _("Cancel"), g_free); @@ -222,8 +224,6 @@ title = gaim_savedstatus_get_title(saved_status); type = gaim_primitive_get_name_from_type(gaim_savedstatus_get_type(saved_status)); message = gaim_markup_strip_html(gaim_savedstatus_get_message(saved_status)); - if (strlen(message) > 70) - strcpy(&message[68], "..."); gtk_list_store_append(model, &iter); gtk_list_store_set(model, &iter, @@ -248,6 +248,16 @@ } } +static gboolean +search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data) +{ + const char *haystack; + + gtk_tree_model_get(model, iter, column, &haystack, -1); + + return (gaim_strcasestr(haystack, key) == NULL); +} + static GtkWidget * create_saved_status_list(StatusWindow *dialog) { @@ -318,6 +328,13 @@ gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", STATUS_WINDOW_COLUMN_MESSAGE); +#if GTK_CHECK_VERSION(2,6,0) + g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END); +#endif + + /* Enable CTRL+F searching */ + gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), STATUS_WINDOW_COLUMN_TITLE); + gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(treeview), search_func, NULL, NULL); /* Sort the title column by default */ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(dialog->model),