本文整理汇总了C++中GTK_TREE_MODEL_FILTER函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TREE_MODEL_FILTER函数的具体用法?C++ GTK_TREE_MODEL_FILTER怎么用?C++ GTK_TREE_MODEL_FILTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TREE_MODEL_FILTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gnc_tree_view_owner_get_selected_owner
/*
* Retrieve the selected owner from an owner tree view. The
* owner tree must be in single selection mode.
*/
GncOwner *
gnc_tree_view_owner_get_selected_owner (GncTreeViewOwner *view)
{
GtkTreeSelection *selection;
GtkTreeModel *f_model, *s_model;
GtkTreeIter iter, f_iter, s_iter;
GncOwner *owner;
GtkSelectionMode mode;
ENTER("view %p", view);
g_return_val_if_fail (GNC_IS_TREE_VIEW_OWNER (view), NULL);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
mode = gtk_tree_selection_get_mode(selection);
if ((mode != GTK_SELECTION_SINGLE) && (mode != GTK_SELECTION_BROWSE))
{
return NULL;
}
if (!gtk_tree_selection_get_selected (selection, &s_model, &s_iter))
{
LEAVE("no owner, get_selected failed");
return FALSE;
}
gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
&f_iter, &s_iter);
f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
gtk_tree_model_filter_convert_iter_to_child_iter (
GTK_TREE_MODEL_FILTER (f_model), &iter, &f_iter);
owner = iter.user_data;
LEAVE("owner %p (%s)", owner, gncOwnerGetName (owner));
return owner;
}
示例2: privileges_table_save
void
privileges_table_save (OobsUser *user)
{
GtkWidget *table;
GtkTreeModel *model, *child_model;
GtkTreeIter iter;
OobsGroup *group;
gboolean valid, member;
table = gst_dialog_get_widget (tool->main_dialog, "user_privileges");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (table));
child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
valid = gtk_tree_model_get_iter_first (child_model, &iter);
while (valid) {
gtk_tree_model_get (child_model, &iter,
COL_GROUP, &group,
COL_MEMBER, &member,
-1);
if (member)
oobs_group_add_user (group, user);
else
oobs_group_remove_user (group, user);
valid = gtk_tree_model_iter_next (child_model, &iter);
}
}
示例3: privileges_table_set_from_profile
void
privileges_table_set_from_profile (GstUserProfile *profile)
{
GtkWidget *table;
GtkTreeModel *model, *child_model;
GtkTreeIter iter;
gboolean valid;
OobsGroup *group;
table = gst_dialog_get_widget (tool->main_dialog, "user_privileges");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (table));
child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
valid = gtk_tree_model_get_iter_first (child_model, &iter);
while (valid) {
gtk_tree_model_get (child_model, &iter,
COL_GROUP, &group,
-1);
gtk_list_store_set (GTK_LIST_STORE (child_model), &iter,
COL_MEMBER, find_group_in_profile (group, profile),
-1);
valid = gtk_tree_model_iter_next (child_model, &iter);
}
}
示例4: privileges_table_set_from_user
void
privileges_table_set_from_user (OobsUser *user)
{
GtkWidget *table;
GtkTreeModel *model, *child_model;
GtkTreeIter iter;
gboolean valid;
OobsGroup *group;
GList *users;
table = gst_dialog_get_widget (tool->main_dialog, "user_privileges");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (table));
child_model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (model));
valid = gtk_tree_model_get_iter_first (child_model, &iter);
while (valid) {
gtk_tree_model_get (child_model, &iter,
COL_GROUP, &group,
-1);
users = oobs_group_get_users (group);
gtk_list_store_set (GTK_LIST_STORE (child_model), &iter,
COL_MEMBER, (g_list_find (users, user) != NULL),
-1);
g_list_free (users);
valid = gtk_tree_model_iter_next (child_model, &iter);
}
}
示例5: get_selected_owners_helper
/*
* This helper function is called once for each row in the tree view
* that is currently selected. Its task is to append the corresponding
* owner to the end of a glist.
*/
static void
get_selected_owners_helper (GtkTreeModel *s_model,
GtkTreePath *s_path,
GtkTreeIter *s_iter,
gpointer data)
{
GncTreeViewSelectionInfo *gtvsi = data;
GtkTreeModel *f_model;
GtkTreeIter iter, f_iter;
GncOwner *owner;
gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model),
&f_iter, s_iter);
f_model = gtk_tree_model_sort_get_model(GTK_TREE_MODEL_SORT(s_model));
gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (f_model),
&iter, &f_iter);
owner = iter.user_data;
/* Only selected if it passes the filter */
if (gtvsi->priv->filter_fn == NULL || gtvsi->priv->filter_fn(owner, gtvsi->priv->filter_data))
{
gtvsi->return_list = g_list_append(gtvsi->return_list, owner);
}
}
示例6: xkb_layout_filter_changed
static void
xkb_layout_filter_changed (GtkBuilder * chooser_dialog)
{
GtkTreeModelFilter *filtered_model =
GTK_TREE_MODEL_FILTER (gtk_builder_get_object (chooser_dialog,
"filtered_layout_list_model"));
GtkWidget *xkb_layout_filter = CWID ("xkb_layout_filter");
const gchar *pattern =
gtk_entry_get_text (GTK_ENTRY (xkb_layout_filter));
gchar *upattern = g_utf8_strup (pattern, -1);
if (!g_strcmp0 (pattern, "")) {
g_object_set (G_OBJECT (xkb_layout_filter),
"secondary-icon-name", "edit-find-symbolic",
"secondary-icon-activatable", FALSE,
"secondary-icon-sensitive", FALSE, NULL);
} else {
g_object_set (G_OBJECT (xkb_layout_filter),
"secondary-icon-name", "edit-clear-symbolic",
"secondary-icon-activatable", TRUE,
"secondary-icon-sensitive", TRUE, NULL);
}
if (search_pattern_list != NULL)
g_strfreev (search_pattern_list);
search_pattern_list = g_strsplit (upattern, " ", -1);
g_free (upattern);
gtk_tree_model_filter_refilter (filtered_model);
}
示例7: hide_delete_changed_cb
static void
hide_delete_changed_cb (GtkToggleButton *widget, GUI *appGUI)
{
config.hide_completed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->ct_hide_items_checkbutton));
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (appGUI->tsk->tasks_filter));
config.delete_completed = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->ct_delete_items_checkbutton));
}
示例8: gnac_properties_reset_properties
static void
gnac_properties_reset_properties(void)
{
gnac_properties_reset_basic_tab();
gnac_properties_reset_properties_tab();
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(properties_filter));
}
示例9: simple_filter_search_activate_handler
static gboolean
simple_filter_search_activate_handler(GtkEntry *entry,
PraghaFilterDialog *fdialog)
{
const gchar *text = NULL;
gchar *u_str = NULL;
gboolean has_text;
has_text = gtk_entry_get_text_length (GTK_ENTRY(entry)) > 0;
if (fdialog->filter_string != NULL) {
g_free (fdialog->filter_string);
fdialog->filter_string = NULL;
}
if (has_text) {
text = gtk_entry_get_text (entry);
u_str = g_utf8_strdown (text, -1);
fdialog->filter_string = u_str;
}
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER(fdialog->filter_model));
return FALSE;
}
示例10: cm_delete_all_cookies_real
static void cm_delete_all_cookies_real(CookieManagerPage *cmp)
{
CookieManagerPagePrivate *priv = cmp->priv;
GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->treeview));
GtkTreeIter iter, iter_store, child;
GtkTreePath *path_first, *path;
path_first = gtk_tree_path_new_first();
while (gtk_tree_model_get_iter(model, &iter, path_first))
{
path = gtk_tree_model_get_path(model, &iter);
while (gtk_tree_model_iter_children(model, &child, &iter))
{
cm_delete_cookie(cmp, model, &child);
cm_store_remove(cmp, &child);
/* we retrieve again the iter at path because it got invalid by the delete operation */
gtk_tree_model_get_iter(model, &iter, path);
}
gtk_tree_path_free(path);
/* remove/hide the parent */
gtk_tree_model_filter_convert_iter_to_child_iter(GTK_TREE_MODEL_FILTER(priv->filter),
&iter_store, &iter);
if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(priv->store), &iter_store))
gtk_tree_store_set(priv->store, &iter_store, COOKIE_MANAGER_COL_VISIBLE, FALSE, -1);
else
cm_store_remove(cmp, &iter);
}
/* now that we deleted all matching cookies, we reset the filter */
gtk_entry_set_text(GTK_ENTRY(priv->filter_entry), "");
cm_set_button_sensitiveness(cmp, FALSE);
cm_select_path(cmp, model, path_first);
gtk_tree_path_free(path_first);
}
示例11: simple_filter_search_activate_handler
static gboolean
simple_filter_search_activate_handler(GtkEntry *entry,
PraghaFilterDialog *fdialog)
{
gchar *text = NULL;
gchar *u_str = NULL;
gboolean has_text;
has_text = gtk_entry_get_text_length (GTK_ENTRY(entry)) > 0;
if (fdialog->filter_string != NULL) {
g_free (fdialog->filter_string);
fdialog->filter_string = NULL;
}
if (has_text) {
text = gtk_editable_get_chars (GTK_EDITABLE(entry), 0, -1);
u_str = g_utf8_strdown (text, -1);
fdialog->filter_string = u_str;
}
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER(fdialog->filter_model));
gtk_entry_set_icon_sensitive (GTK_ENTRY(entry),
GTK_ENTRY_ICON_SECONDARY,
has_text);
g_free (text);
return FALSE;
}
示例12: on_dir_tree_view_row_collapsed
void on_dir_tree_view_row_collapsed( GtkTreeView *treeview,
GtkTreeIter *iter,
GtkTreePath *path,
gpointer user_data )
{
GtkTreeIter real_it;
GtkTreePath* real_path;
GtkTreeModel* filter = gtk_tree_view_get_model( treeview );
PtkDirTree* tree = PTK_DIR_TREE( user_data );
gtk_tree_model_filter_convert_iter_to_child_iter(
GTK_TREE_MODEL_FILTER( filter ), &real_it, iter );
real_path = gtk_tree_model_filter_convert_path_to_child_path(
GTK_TREE_MODEL_FILTER( filter ), path );
ptk_dir_tree_collapse_row( tree, &real_it, real_path );
gtk_tree_path_free( real_path );
}
示例13: search_entry_changed_cb
static void
search_entry_changed_cb (GtkEntry *entry,
GnomeControlCenter *center)
{
GnomeControlCenterPrivate *priv = center->priv;
char *str;
/* if the entry text was set manually (not by the user) */
if (!g_strcmp0 (priv->filter_string, gtk_entry_get_text (entry)))
return;
/* Don't re-filter for added trailing or leading spaces */
str = g_strdup (gtk_entry_get_text (entry));
g_strstrip (str);
if (!g_strcmp0 (str, priv->filter_string))
{
g_free (str);
return;
}
g_free (priv->filter_string);
priv->filter_string = str;
if (!g_strcmp0 (priv->filter_string, ""))
{
shell_show_overview_page (center);
}
else
{
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (priv->search_filter));
notebook_select_page (priv->notebook, priv->search_scrolled);
}
}
示例14: feed_list_view_select
void
feed_list_view_select (nodePtr node)
{
GtkTreeModel *model = gtk_tree_view_get_model (flv->treeview);
if (model && node && node != feedlist_get_root ()) {
GtkTreePath *path;
/* in filtered mode we need to convert the iterator */
if (flv->feedlist_reduced_unread) {
GtkTreeIter iter;
gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (flv->filter), &iter, feed_list_view_to_iter (node->id));
path = gtk_tree_model_get_path (model, &iter);
} else {
path = gtk_tree_model_get_path (model, feed_list_view_to_iter (node->id));
}
if (node->parent)
feed_list_view_expand (node->parent);
if (path) {
gtk_tree_view_scroll_to_cell (flv->treeview, path, NULL, FALSE, 0.0, 0.0);
gtk_tree_view_set_cursor (flv->treeview, path, NULL, FALSE);
gtk_tree_path_free (path);
}
} else {
GtkTreeSelection *selection = gtk_tree_view_get_selection (flv->treeview);
gtk_tree_selection_unselect_all (selection);
}
}
示例15: feed_list_view_selection_changed_cb
static void
feed_list_view_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
{
GtkTreeIter iter;
GtkTreeModel *model;
nodePtr node;
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_tree_model_get (model, &iter, FS_PTR, &node, -1);
debug1 (DEBUG_GUI, "feed list selection changed to \"%s\"", node_get_title (node));
/* 1.) update feed list and item list states */
g_signal_emit_by_name (FEED_LIST_VIEW (flv), "selection-changed", node->id);
/* 2.) Refilter the GtkTreeView to get rid of nodes with 0 unread
messages when in reduced mode. */
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (flv->filter));
if (node) {
gboolean allowModify = (NODE_SOURCE_TYPE (node->source->root)->capabilities & NODE_SOURCE_CAPABILITY_WRITABLE_FEEDLIST);
liferea_shell_update_update_menu ((NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE) ||
(NODE_TYPE (node)->capabilities & NODE_CAPABILITY_UPDATE_CHILDS));
liferea_shell_update_feed_menu (allowModify, TRUE, allowModify);
} else {
liferea_shell_update_feed_menu (TRUE, FALSE, FALSE);
}
} else {
/* If we cannot get the new selection we keep the old one
this happens when we're doing drag&drop for example. */
}
}