#include "folder.h"
#include "filtering.h"
#include "addr_compl.h"
-#include "colorlabel.h"
#include "manual.h"
#include "combobox.h"
static GtkWidget *prefs_filtering_list_view_create (void);
static void prefs_filtering_create_list_view_columns (GtkWidget *list_view);
-static gint prefs_filtering_get_selected_row (GtkWidget *list_view);
-static gboolean prefs_filtering_list_view_select_row (GtkWidget *list, gint row);
static gboolean prefs_filtering_selected (GtkTreeSelection *selector,
GtkTreeModel *model,
for (; accounts != NULL; accounts = accounts->next) {
PrefsAccount *ac = (PrefsAccount *)accounts->data;
- COMBOBOX_ADD(filtering.account_combobox_list, ac->account_name, ac->account_id);
+ COMBOBOX_ADD_ESCAPED(filtering.account_combobox_list, ac->account_name, ac->account_id);
}
}
static void prefs_filtering_substitute_cb(void)
{
- gint selected_row = prefs_filtering_get_selected_row
+ gint selected_row = gtkut_list_view_get_selected_row
(filtering.cond_list_view);
FilteringProp *prop;
gboolean enabled;
GtkTreeIter iter;
gint row;
- row = prefs_filtering_get_selected_row(filtering.cond_list_view);
+ row = gtkut_list_view_get_selected_row(filtering.cond_list_view);
if (row <= 0)
return;
GtkTreeIter top, sel;
GtkTreeModel *model;
- row = prefs_filtering_get_selected_row(filtering.cond_list_view);
+ row = gtkut_list_view_get_selected_row(filtering.cond_list_view);
if (row <= 1)
return;
return;
gtk_list_store_move_after(GTK_LIST_STORE(model), &sel, &top);
- prefs_filtering_list_view_select_row(filtering.cond_list_view, 1);
+ gtkut_list_view_select_row(filtering.cond_list_view, 1);
}
static void prefs_filtering_up(void)
GtkTreeIter top, sel;
GtkTreeModel *model;
- row = prefs_filtering_get_selected_row(filtering.cond_list_view);
+ row = gtkut_list_view_get_selected_row(filtering.cond_list_view);
if (row <= 1)
return;
return;
gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
- prefs_filtering_list_view_select_row(filtering.cond_list_view, row - 1);
+ gtkut_list_view_select_row(filtering.cond_list_view, row - 1);
}
static void prefs_filtering_down(void)
model = gtk_tree_view_get_model(GTK_TREE_VIEW(filtering.cond_list_view));
n_rows = gtk_tree_model_iter_n_children(model, NULL);
- row = prefs_filtering_get_selected_row(filtering.cond_list_view);
+ row = gtkut_list_view_get_selected_row(filtering.cond_list_view);
if (row < 1 || row >= n_rows - 1)
return;
return;
gtk_list_store_swap(GTK_LIST_STORE(model), &top, &sel);
- prefs_filtering_list_view_select_row(filtering.cond_list_view, row + 1);
+ gtkut_list_view_select_row(filtering.cond_list_view, row + 1);
}
static void prefs_filtering_bottom(void)
model = gtk_tree_view_get_model(GTK_TREE_VIEW(filtering.cond_list_view));
n_rows = gtk_tree_model_iter_n_children(model, NULL);
- row = prefs_filtering_get_selected_row(filtering.cond_list_view);
+ row = gtkut_list_view_get_selected_row(filtering.cond_list_view);
if (row < 1 || row >= n_rows - 1)
return;
return;
gtk_list_store_move_after(GTK_LIST_STORE(model), &top, &sel);
- prefs_filtering_list_view_select_row(filtering.cond_list_view, n_rows - 1);
+ gtkut_list_view_select_row(filtering.cond_list_view, n_rows - 1);
}
static void prefs_filtering_select_set(FilteringProp *prop)
gtk_tree_view_append_column(GTK_TREE_VIEW(list_view), column);
}
-static gboolean gtkut_tree_iter_comp(GtkTreeModel *model,
- GtkTreeIter *iter1,
- GtkTreeIter *iter2)
-{
- GtkTreePath *path1 = gtk_tree_model_get_path(model, iter1);
- GtkTreePath *path2 = gtk_tree_model_get_path(model, iter2);
- gboolean result;
-
- result = gtk_tree_path_compare(path1, path2) == 0;
-
- gtk_tree_path_free(path1);
- gtk_tree_path_free(path2);
-
- return result;
-}
-
-/*!
- *\brief Get selected row number.
- */
-static gint prefs_filtering_get_selected_row(GtkWidget *list_view)
-{
- GtkTreeView *view = GTK_TREE_VIEW(list_view);
- GtkTreeModel *model = gtk_tree_view_get_model(view);
- int n_rows = gtk_tree_model_iter_n_children(model, NULL);
- GtkTreeSelection *selection;
- GtkTreeIter iter;
- int row;
-
- if (n_rows == 0)
- return -1;
-
- selection = gtk_tree_view_get_selection(view);
- if (!gtk_tree_selection_get_selected(selection, &model, &iter))
- return -1;
-
- /* get all iterators and compare them... */
- for (row = 0; row < n_rows; row++) {
- GtkTreeIter itern;
-
- gtk_tree_model_iter_nth_child(model, &itern, NULL, row);
- if (gtkut_tree_iter_comp(model, &iter, &itern))
- return row;
- }
-
- return -1;
-}
-
-static gboolean prefs_filtering_list_view_select_row(GtkWidget *list, gint row)
-{
- GtkTreeView *list_view = GTK_TREE_VIEW(list);
- GtkTreeSelection *selection = gtk_tree_view_get_selection(list_view);
- GtkTreeModel *model = gtk_tree_view_get_model(list_view);
- GtkTreeIter iter;
- GtkTreePath *path;
-
- if (!gtk_tree_model_iter_nth_child(model, &iter, NULL, row))
- return FALSE;
-
- gtk_tree_selection_select_iter(selection, &iter);
-
- path = gtk_tree_model_get_path(model, &iter);
- gtk_tree_view_set_cursor(list_view, path, NULL, FALSE);
- gtk_tree_path_free(path);
-
- return TRUE;
-}
-
/*!
*\brief Triggered when a row is selected
*/