static void raise_bus_cell_position (GtkWidget *widget, gpointer data) { bus_layout_D *dialog = (bus_layout_D *)data ; GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tview)) ; GtkTreeModel *tm = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->tview)) ; GtkTreePath *tpBus = g_object_get_data (G_OBJECT (dialog->tview), "tpBus") ; GtkTreePath *tpSrc = NULL, *tpDst = NULL ; int icChildren = -1, Nix ; if (NULL == tpBus) return ; if (0 == (icChildren = gtk_tree_model_path_n_children (tm, tpBus))) return ; gtk_tree_path_down (tpDst = gtk_tree_path_copy (tpBus)) ; gtk_tree_path_next (tpSrc = gtk_tree_path_copy (tpDst)) ; for (Nix = 1 ; Nix < icChildren ; Nix++) { if (gtk_tree_selection_path_is_selected (sel, tpSrc)) { // swap the 2 rows swap_model_paths_contents (tm, tpSrc, tpDst) ; gtk_tree_selection_unselect_path (sel, tpSrc) ; gtk_tree_selection_select_path (sel, tpDst) ; } gtk_tree_path_next (tpSrc) ; gtk_tree_path_next (tpDst) ; } }
void gd_main_view_generic_set_rubberband_range (GdMainViewGeneric *self, GtkTreePath *start, GtkTreePath *end) { RubberbandInfo *info; info = get_rubber_band_info (self); if (start == NULL || end == NULL) { g_clear_pointer (&info->rubberband_start, gtk_tree_path_free); g_clear_pointer (&info->rubberband_end, gtk_tree_path_free); } else { if (gtk_tree_path_compare (start, end) < 0) { info->rubberband_start = gtk_tree_path_copy (start); info->rubberband_end = gtk_tree_path_copy (end); } else { info->rubberband_start = gtk_tree_path_copy (end); info->rubberband_end = gtk_tree_path_copy (start); } } gtk_widget_queue_draw (GTK_WIDGET (self)); }
static void insert_event_with_parent(ReplayMessageTree *self, ReplayMessageTreeEntry *entry, ReplayMessageTreeEntry *parent) { ReplayMessageTreePrivate *priv; priv = self->priv; entry->parent = parent; if (parent) { if (parent->last_child) { parent->last_child->next = entry; entry->prev = parent->last_child; /* create a tree path which is next after the one before us */ entry->tree_path = gtk_tree_path_copy(entry->prev->tree_path); gtk_tree_path_next(entry->tree_path); } else { g_assert(parent->first_child == NULL); parent->first_child = entry; entry->parent = parent; /* create a tree path which is the first child of our parent */ entry->tree_path = gtk_tree_path_copy(entry->parent->tree_path); gtk_tree_path_down(entry->tree_path); } parent->last_child = entry; parent->num_children++; } else { if (priv->last_child) { priv->last_child->next = entry; entry->prev = priv->last_child; /* create a tree path which is next after the one before us */ entry->tree_path = gtk_tree_path_copy(entry->prev->tree_path); gtk_tree_path_next(entry->tree_path); } else { g_assert(priv->first_child == NULL); priv->first_child = entry; entry->parent = parent; /* create a tree path which is the first child of our parent */ entry->tree_path = gtk_tree_path_new_first(); } priv->last_child = entry; priv->num_children++; } }
/* sort using merge sort */ static void gbf_project_model_sort (GtkTreeModel *model, GtkTreePath *begin, GtkTreePath *end, GtkTreeIterCompareFunc compare_func, gpointer user_data) { GtkTreePath *half; gint depth; /* Empty list are sorted */ if (gtk_tree_path_compare (begin, end) >= 0) { return; } /* Split the list in two */ half = gtk_tree_path_copy (begin); gtk_tree_path_up (half); gtk_tree_path_append_index (half, (gtk_tree_path_get_indices_with_depth (begin, &depth)[depth -1] + gtk_tree_path_get_indices_with_depth (end, &depth)[depth - 1]) / 2); /* List with a single element are sorted too */ if (gtk_tree_path_compare (begin, half) < 0) { gbf_project_model_sort (model, begin, half, compare_func, user_data); gbf_project_model_sort (model, half, end, compare_func, user_data); gbf_project_model_merge (model, begin, half, end, compare_func, user_data); } gtk_tree_path_free (half); }
static GtkTreePath * get_drop_path (NautilusTreeViewDragDest *dest, GtkTreePath *path) { NautilusFile *file; GtkTreePath *ret; if (!path || !dest->details->have_drag_data) { return NULL; } ret = gtk_tree_path_copy (path); file = file_for_path (dest, ret); /* Go up the tree until we find a file that can accept a drop */ while (file == NULL /* dummy row */ || !nautilus_drag_can_accept_info (file, dest->details->drag_type, dest->details->drag_list)) { if (gtk_tree_path_get_depth (ret) == 1) { gtk_tree_path_free (ret); ret = NULL; break; } else { gtk_tree_path_up (ret); nautilus_file_unref (file); file = file_for_path (dest, ret); } } nautilus_file_unref (file); return ret; }
static void prefs_custom_header_up(void) { GtkTreePath *prev, *sel; GtkTreeIter isel; GtkListStore *store = NULL; GtkTreeModel *model = NULL; GtkTreeIter iprev; if (!gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW(customhdr.list_view)), &model, &isel)) return; store = (GtkListStore *)model; sel = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &isel); if (!sel) return; /* no move if we're at row 0... */ prev = gtk_tree_path_copy(sel); if (!gtk_tree_path_prev(prev)) { gtk_tree_path_free(prev); gtk_tree_path_free(sel); return; } gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iprev, prev); gtk_tree_path_free(sel); gtk_tree_path_free(prev); gtk_list_store_swap(store, &iprev, &isel); prefs_custom_header_set_list(cur_ac); }
static gboolean find_entry (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { VinagreBookmarksEntry *entry; struct _find_entry *f = data; gboolean result = FALSE; gtk_tree_model_get (model, iter, ENTRY_COL, &entry, -1); if (entry == f->entry) { f->found = TRUE; f->path = gtk_tree_path_copy (path); result = TRUE; } if (entry) g_object_unref (entry); return result; }
static void search_selection_changed(GtkTreeSelection * treeselection, gpointer user_data) { GtkTreeIter iter; GtkTreePath * path; GtkTreePath * path_up; gpointer gptr1; gpointer gptr2; playlist_t * pl; if (!gtk_tree_selection_get_selected(search_select, NULL, &iter)) { return; } gtk_tree_model_get(GTK_TREE_MODEL(search_store), &iter, 1, &gptr1, 3, &gptr2, -1); path = (GtkTreePath *)gptr1; path_up = gtk_tree_path_copy(path); pl = (playlist_t *)gptr2; if (gtk_tree_path_up(path_up)) { gtk_tree_view_expand_row(GTK_TREE_VIEW(pl->view), path_up, FALSE); } gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pl->view), path, NULL, TRUE, 0.5f, 0.5f); gtk_tree_view_set_cursor(GTK_TREE_VIEW(pl->view), path, NULL, FALSE); playlist_set_current(pl); gtk_tree_path_free(path_up); }
static void select_index (const gchar *uri) { GtkTreeSelection *selection; GtkTreeIter *iter = NULL; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); if (uri) iter = g_hash_table_lookup (uri_hash_table, uri); if (iter) { GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)); GtkTreePath *path; GtkTreePath *scroll_path; path = gtk_tree_model_get_path (model, iter); scroll_path = gtk_tree_path_copy (path); gtk_tree_path_up (path); gtk_tree_view_expand_to_path (GTK_TREE_VIEW (tree_view), path); gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tree_view), scroll_path, NULL, FALSE, 0.0, 0.0); gtk_tree_path_free (path); gtk_tree_path_free (scroll_path); gtk_tree_selection_select_iter (selection, iter); } else { gtk_tree_selection_unselect_all (selection); } }
// This callback is responsible for enabling/disabling the appropriate buttons depending on // the contents of the selection static void tree_view_selection_changed (GtkTreeSelection *sel, gpointer data) { bus_layout_D *dialog = (bus_layout_D *)data ; gboolean bSomethingSelected = FALSE ; gboolean bBusSelected = FALSE ; gboolean bSelectionIsFromBus = FALSE ; gboolean bFirstSelected = FALSE ; gboolean bLastSelected = FALSE ; gboolean bFirstBusSelected = TRUE ; gboolean bLastBusSelected = TRUE ; GtkTreePath *tpSelBus = NULL, *tp = NULL ; GtkTreeModel *tm = NULL ; int icChildren = -1, Nix ; tm = gtk_tree_view_get_model (gtk_tree_selection_get_tree_view (sel)) ; if ((bSelectionIsFromBus = (NULL != (tpSelBus = get_selection_bus (sel, &bSomethingSelected))))) if (!(bFirstSelected = bLastSelected = bBusSelected = whole_bus_selected_p (sel, tm, tpSelBus))) if ((icChildren = gtk_tree_model_path_n_children (tm, tpSelBus)) > 0) { gtk_tree_path_down (tp = gtk_tree_path_copy (tpSelBus)) ; bFirstSelected = gtk_tree_selection_path_is_selected (sel, tp) ; for (Nix = 1 ; Nix < icChildren ; Nix++) gtk_tree_path_next (tp) ; bLastSelected = gtk_tree_selection_path_is_selected (sel, tp) ; gtk_tree_path_free (tp) ; } if (bSelectionIsFromBus) determine_first_or_last_bus (tm, tpSelBus, &bFirstBusSelected, &bLastBusSelected) ; gtk_widget_set_sensitive (dialog->btnCreateBus, bSomethingSelected && !bBusSelected) ; gtk_widget_set_sensitive (dialog->btnDeleteBus, bSelectionIsFromBus) ; gtk_widget_set_sensitive (dialog->btnMoveBusUp, bSelectionIsFromBus && !bFirstBusSelected) ; gtk_widget_set_sensitive (dialog->btnMoveBusDown, bSelectionIsFromBus && !bLastBusSelected) ; gtk_widget_set_sensitive (dialog->btnMoveCellsUp, bSelectionIsFromBus && !bFirstSelected) ; gtk_widget_set_sensitive (dialog->btnMoveCellsDown, bSelectionIsFromBus && !bLastSelected) ; gtk_widget_set_sensitive (dialog->lblBusName, bSelectionIsFromBus) ; gtk_widget_set_sensitive (dialog->txtBusName, bSelectionIsFromBus) ; // Fill in the text box with the name of the bus if (bSelectionIsFromBus) { GtkTreeIter itr ; char *psz = NULL ; gtk_tree_model_get_iter (tm, &itr, tpSelBus) ; gtk_tree_model_get (tm, &itr, BUS_LAYOUT_MODEL_COLUMN_NAME, &psz, -1) ; g_signal_handlers_block_matched (G_OBJECT (dialog->txtBusName), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer)bus_name_changed, NULL) ; gtk_entry_set_text (GTK_ENTRY (dialog->txtBusName), psz) ; g_signal_handlers_unblock_matched (G_OBJECT (dialog->txtBusName), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, (gpointer)bus_name_changed, NULL) ; g_free (psz) ; } if (NULL != (tp = g_object_get_data (G_OBJECT (gtk_tree_selection_get_tree_view (sel)), "tpBus"))) gtk_tree_path_free (tp) ; g_object_set_data (G_OBJECT (gtk_tree_selection_get_tree_view (sel)), "tpBus", tpSelBus) ; }
/* If m is not a base TreeModel type (ie, is a filter or sorter) then convert OP to a TreePath for the base and return it. The return value must be freed by the caller. */ static GtkTreePath * get_base_tree_path (GtkTreeModel *m, GtkTreePath *op) { GtkTreePath *p = gtk_tree_path_copy (op); while ( ! PSPPIRE_IS_DICT (m)) { GtkTreePath *oldp = p; if (GTK_IS_TREE_MODEL_FILTER (m)) { p = gtk_tree_model_filter_convert_path_to_child_path (GTK_TREE_MODEL_FILTER (m), oldp); m = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (m)); } else if (GTK_IS_TREE_MODEL_SORT (m)) { p = gtk_tree_model_sort_convert_path_to_child_path (GTK_TREE_MODEL_SORT (m), oldp); m = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (m)); } else { g_error ("Unexpected model type: %s", G_OBJECT_TYPE_NAME (m)); } gtk_tree_path_free (oldp); } return p; }
/*# @method copy GtkTreePath @brief Creates a new GtkTreePath as a copy of path. @return A new GtkTreePath. */ FALCON_FUNC TreePath::copy( VMARG ) { NO_ARGS MYSELF; vm->retval( new Gtk::TreePath( vm->findWKI( "GtkTreePath" )->asClass(), gtk_tree_path_copy( self->getTreePath() ), true ) ); }
/* selected_foreach callbacks to implement get_selected_rows and * count_selected_rows for gtk < 2.2 */ static void get_selected_rows (GtkTreeModel * model, GtkTreePath * path, GtkTreeIter * iter, GList ** paths) { *paths = g_list_append (*paths, gtk_tree_path_copy (path)); }
static gboolean contact_list_view_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time) { static DragMotionData *dm = NULL; GtkTreePath *path; gboolean is_row; gboolean is_different = FALSE; gboolean cleanup = TRUE; is_row = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), x, y, &path, NULL, NULL, NULL); cleanup &= (!dm); if (is_row) { cleanup &= (dm && gtk_tree_path_compare (dm->path, path) != 0); is_different = (!dm || (dm && gtk_tree_path_compare (dm->path, path) != 0)); } else { cleanup &= FALSE; } if (!is_different && !cleanup) { return TRUE; } if (dm) { gtk_tree_path_free (dm->path); if (dm->timeout_id) { g_source_remove (dm->timeout_id); } g_free (dm); dm = NULL; } if (!gtk_tree_view_row_expanded (GTK_TREE_VIEW (widget), path)) { dm = g_new0 (DragMotionData, 1); dm->view = EMPATHY_CONTACT_LIST_VIEW (widget); dm->path = gtk_tree_path_copy (path); dm->timeout_id = g_timeout_add_seconds (1, (GSourceFunc) contact_list_view_drag_motion_cb, dm); } return TRUE; }
static void gimp_path_editor_move_clicked (GtkWidget *widget, GimpPathEditor *editor) { GtkTreePath *path; GtkTreeModel *model; GtkTreeIter iter1, iter2; gchar *utf81, *utf82; gchar *dir1, *dir2; gboolean writable1, writable2; if (editor->sel_path == NULL) return; path = gtk_tree_path_copy (editor->sel_path); if (widget == editor->up_button) gtk_tree_path_prev (path); else gtk_tree_path_next (path); model = GTK_TREE_MODEL (editor->dir_list); gtk_tree_model_get_iter (model, &iter1, editor->sel_path); gtk_tree_model_get_iter (model, &iter2, path); gtk_tree_model_get (model, &iter1, COLUMN_UTF8, &utf81, COLUMN_DIRECTORY, &dir1, COLUMN_WRITABLE, &writable1, -1); gtk_tree_model_get (model, &iter2, COLUMN_UTF8, &utf82, COLUMN_DIRECTORY, &dir2, COLUMN_WRITABLE, &writable2, -1); gtk_list_store_set (editor->dir_list, &iter1, COLUMN_UTF8, utf82, COLUMN_DIRECTORY, dir2, COLUMN_WRITABLE, writable2, -1); gtk_list_store_set (editor->dir_list, &iter2, COLUMN_UTF8, utf81, COLUMN_DIRECTORY, dir1, COLUMN_WRITABLE, writable1, -1); g_free (utf81); g_free (utf82); g_free (dir2); g_free (dir1); gtk_tree_selection_select_iter (editor->sel, &iter2); g_signal_emit (editor, gimp_path_editor_signals[PATH_CHANGED], 0); }
/** @brief delete selected row(s), if any, from @a treeview @param treeview where the action is to occur @return */ void e2_tree_delete (GtkTreeView *treeview) { GtkTreeSelection *sel = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_count_selected_rows (sel) > 0) { GtkTreeModel *model; GList *tmp, *rowrefs = NULL; GList *selpaths = gtk_tree_selection_get_selected_rows (sel, &model); //identify a place to goto after the deletion //(current place, if we're at the start of the tree) GtkTreePath *newpath = gtk_tree_path_copy (selpaths->data); if (!gtk_tree_path_prev (newpath)) if (gtk_tree_path_get_depth (newpath) > 1) gtk_tree_path_up (newpath); GtkTreePath *path; GtkTreeIter iter; //create treerowrefs for all selected rows for (tmp = selpaths; tmp!=NULL; tmp=tmp->next) { path = (GtkTreePath *) tmp->data; if (gtk_tree_model_get_iter (model, &iter, path)) _e2_tree_reference_treerow (model, &iter, &rowrefs); gtk_tree_path_free (path); } g_list_free (selpaths); for (tmp = rowrefs; tmp != NULL; tmp = tmp->next) { path = gtk_tree_row_reference_get_path ((GtkTreeRowReference *) tmp->data); if (path != NULL) { if (gtk_tree_model_get_iter (model, &iter, path)) { //gtk_tree_selection_unselect_path (sel, path); //needed ? //this deletes all children too gtk_tree_store_remove (GTK_TREE_STORE (model), &iter); } gtk_tree_path_free (path); } gtk_tree_row_reference_free ((GtkTreeRowReference *) tmp->data); } g_list_free (rowrefs); //go to the new place if (!gtk_tree_model_get_iter (model, &iter, newpath) && gtk_tree_model_get_iter_first (model, &iter)) { gtk_tree_path_free (newpath); newpath = gtk_tree_model_get_path (model, &iter); } gtk_tree_view_set_cursor (treeview, newpath, gtk_tree_view_get_column (treeview, 0), FALSE); gtk_tree_path_free (newpath); } }
static void get_selection_bus_foreach_func (GtkTreeModel *tm, GtkTreePath *tp, GtkTreeIter *itr, gpointer data) { GET_SELECTION_BUS_STRUCT *gsbs = (GET_SELECTION_BUS_STRUCT *)data ; int this_depth = gtk_tree_path_get_depth (tp), row_type = -1 ; if (gsbs->state == GSBS_REJECT) return ; gtk_tree_model_get (tm, itr, BUS_LAYOUT_MODEL_COLUMN_TYPE, &row_type, -1) ; if (GSBS_START == gsbs->state && 2 == this_depth) { if (gtk_tree_path_up (gsbs->tpBus = gtk_tree_path_copy (tp))) gsbs->state = GSBS_D1B_ACCEPT ; else gsbs->state = GSBS_REJECT ; } else if (GSBS_START == gsbs->state && 1 == this_depth) { if (row_type & ROW_TYPE_BUS) { gsbs->tpBus = gtk_tree_path_copy (tp) ; gsbs->state = GSBS_D1B_ACCEPT ; } else gsbs->state = GSBS_REJECT ; } else // At this point, gsbs->state can only be GSBS_ACCEPT { if (1 == this_depth) gsbs->state = GSBS_REJECT ; else { GtkTreePath *tpThisParent = NULL ; if (!gtk_tree_path_up (tpThisParent = gtk_tree_path_copy (tp))) gsbs->state = GSBS_REJECT ; else gsbs->state = (0 == gtk_tree_path_compare (tpThisParent, gsbs->tpBus)) ? GSBS_D1B_ACCEPT : GSBS_REJECT ; gtk_tree_path_free (tpThisParent) ; } } }
/* builds a keyword string out of GtkTreePath */ static void _lib_keywords_string_from_path(char *dest,size_t ds, GtkTreeModel *model, GtkTreePath *path) { g_assert(model!=NULL); g_assert(path!=NULL); GList *components = NULL; GtkTreePath *wp = gtk_tree_path_copy(path); GtkTreeIter iter; /* get components of path */ while (1) { GValue value; memset(&value,0,sizeof(GValue)); /* get iter from path, break out if fail */ if (!gtk_tree_model_get_iter(model, &iter, wp)) break; /* add component to begin of list */ gtk_tree_model_get_value(model, &iter, 0, &value); if ( !(gtk_tree_path_get_depth(wp) == 1 && strcmp(g_value_get_string(&value), _(UNCATEGORIZED_TAG)) == 0)) { components = g_list_insert(components, g_strdup(g_value_get_string(&value)), 0); } g_value_unset(&value); /* get parent of current path break out if we are at root */ if (!gtk_tree_path_up(wp) || gtk_tree_path_get_depth(wp) == 0) break; } /* build the tag string from components */ int dcs = 0; if(g_list_length(components) == 0) dcs += g_snprintf(dest+dcs, ds-dcs," "); for(guint i=0; i<g_list_length(components); i++) { dcs += g_snprintf(dest+dcs, ds-dcs, "%s%s", (gchar *)g_list_nth_data(components, i), (i < g_list_length(components)-1) ? "|" : ""); } /* free data */ gtk_tree_path_free(wp); }
/** * gpk_log_find_iter_model_cb: **/ static gboolean gpk_log_find_iter_model_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, const gchar *id) { gchar *id_tmp = NULL; gtk_tree_model_get (model, iter, GPK_LOG_COLUMN_ID, &id_tmp, -1); if (strcmp (id_tmp, id) == 0) { path_global = gtk_tree_path_copy (path); return TRUE; } return FALSE; }
static Signal * signal_new (SignalName signal, GtkTreePath *path) { Signal *s; s = g_new0 (Signal, 1); s->signal = signal; s->path = gtk_tree_path_copy (path); s->new_order = NULL; return s; }
static gboolean find_frame(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { int fileid; tGetFileInfo *pData = (tGetFileInfo*)data; gtk_tree_model_get(model, iter, FCOL_ID, &fileid, -1); if (fileid == pData->id) { pData->path = gtk_tree_path_copy(path); return TRUE; } return FALSE; }
static gboolean find_file(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { gchar *fname = NULL; tGetFileInfo *pData = (tGetFileInfo*)data; gtk_tree_model_get(model, iter, CCOL_FILENAME, &fname, -1); if (strcmp(fname, pData->file)==0) { pData->path = gtk_tree_path_copy(path); return TRUE; } g_free(fname); return FALSE; }
static void lower_bus_cell_position (GtkWidget *widget, gpointer data) { bus_layout_D *dialog = (bus_layout_D *)data ; GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->tview)) ; GtkTreeModel *tm = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->tview)) ; GtkTreePath *tpBus = g_object_get_data (G_OBJECT (dialog->tview), "tpBus") ; GtkTreePath *tpSrc = NULL, *tpDst = NULL ; int icChildren = -1, Nix ; if (NULL == tpBus) { fprintf (stderr, "lower_bus_cell_position: tpBus == NULL !\n") ; return ; } if (0 == (icChildren = gtk_tree_model_path_n_children (tm, tpBus))) { fprintf (stderr, "lower_bus_cell_position: tpBus has no children O_o\n") ; return ; } gtk_tree_path_down (tpDst = gtk_tree_path_copy (tpBus)) ; for (Nix = 1 ; Nix < icChildren ; Nix++) gtk_tree_path_next (tpDst) ; // St00pid short-circuit if statement to suppress a warning. if (gtk_tree_path_prev (tpSrc = gtk_tree_path_copy (tpDst))) ; for (Nix = 1 ; Nix < icChildren ; Nix++) { if (gtk_tree_selection_path_is_selected (sel, tpSrc)) { // swap the 2 rows swap_model_paths_contents (tm, tpSrc, tpDst) ; gtk_tree_selection_unselect_path (sel, tpSrc) ; gtk_tree_selection_select_path (sel, tpDst) ; } if (!gtk_tree_path_prev (tpSrc)) break ; if (!gtk_tree_path_prev (tpDst)) break ; } }
static gboolean attr_dialog_select_page_search (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, page_search_t *pst) { int page; gtk_tree_model_get (model, iter, PAGE_NUMBER, &page, -1); if (page == pst->page) { pst->path = gtk_tree_path_copy (path); return TRUE; } else return FALSE; }
static void photos_view_container_item_activated (PhotosViewContainer *self, const gchar * id, const GtkTreePath *path) { PhotosViewContainerPrivate *priv = self->priv; GObject *object; priv->current_path = gtk_tree_path_copy (path); object = photos_base_manager_get_object_by_id (priv->item_mngr, id); if (!photos_base_item_is_collection (PHOTOS_BASE_ITEM (object)) && photos_remote_display_manager_is_active (priv->remote_mngr)) photos_remote_display_manager_render (priv->remote_mngr, PHOTOS_BASE_ITEM (object)); else photos_base_manager_set_active_object (priv->item_mngr, object); }
static void gimp_action_view_select_path (GimpActionView *view, GtkTreePath *path) { GtkTreeView *tv = GTK_TREE_VIEW (view); GtkTreePath *expand; expand = gtk_tree_path_copy (path); gtk_tree_path_up (expand); gtk_tree_view_expand_row (tv, expand, FALSE); gtk_tree_path_free (expand); gtk_tree_view_set_cursor (tv, path, NULL, FALSE); gtk_tree_view_scroll_to_cell (tv, path, NULL, TRUE, 0.5, 0.0); }
static GList *get_bus_refs (GtkTreeModel *tm, GtkTreePath *tpBus) { int Nix, icChildren = -1 ; GList *llRefs = NULL ; GtkTreePath *tp = gtk_tree_path_copy (tpBus) ; icChildren = gtk_tree_model_path_n_children (tm, tp) ; gtk_tree_path_down (tp) ; for (Nix = 0 ; Nix < icChildren ; Nix++, gtk_tree_path_next (tp)) llRefs = g_list_prepend (llRefs, gtk_tree_row_reference_new (tm, tp)) ; gtk_tree_path_free (tp) ; return llRefs ; }
static gboolean dialog_pref_select_page_search (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, page_search_t *pst) { gchar *page; gtk_tree_model_get (model, iter, ITEM_NAME, &page, -1); if (0 == strcmp (page, pst->page)) { g_free (page); pst->path = gtk_tree_path_copy (path); return TRUE; } else { g_free (page); return FALSE; } }
static GtkTreePath *get_prev_bus (GtkTreeModel *tm, GtkTreePath *tpSelBus) { GtkTreePath *tp = NULL ; GtkTreeIter itr ; int row_type ; if (1 != gtk_tree_path_get_depth (tpSelBus)) return NULL ; tp = gtk_tree_path_copy (tpSelBus) ; while (gtk_tree_path_prev (tp)) { if (gtk_tree_model_get_iter (tm, &itr, tp)) gtk_tree_model_get (tm, &itr, BUS_LAYOUT_MODEL_COLUMN_TYPE, &row_type, -1) ; if (ROW_TYPE_BUS & row_type) return tp ; } gtk_tree_path_free (tp) ; return NULL ; }
int path_get_store_type(GtkTreePath * p) { GtkTreeIter iter; GtkTreePath * path; store_t * data; path = gtk_tree_path_copy(p); while (gtk_tree_path_get_depth(path) > 1) { gtk_tree_path_up(path); } gtk_tree_model_get_iter(GTK_TREE_MODEL(music_store), &iter, path); gtk_tree_model_get(GTK_TREE_MODEL(music_store), &iter, MS_COL_DATA, &data, -1); gtk_tree_path_free(path); return data->type; }