void display_command_history(int id, char *cmd) { GtkTreeIter iter; if (id < 0) { eprintf("DEL %d\n", -id); if (display_command_find(-id, &iter)) gtk_list_store_remove(display_command_list, &iter); } else if (id == 0) { eprintf("CLEAR\n"); gtk_list_store_clear(display_command_list); } else { /* Command history reordering */ if (*cmd == '\0') { eprintf("MOVE UP %d\n", id); if (display_command_find(id, &iter)) { gtk_list_store_move_after(display_command_list, &iter, NULL); } } /* New command to prepend */ else { eprintf("ADD %d '%s'\n", id, cmd); gtk_list_store_prepend(display_command_list, &iter); gtk_list_store_set(display_command_list, &iter, COMMAND_TREE_ID, id, COMMAND_TREE_TEXT, cmd, -1); } } }
static void dict_list_down_clicked_cb (GtkButton *button, gpointer userdata) { GtkTreeView *view = GTK_TREE_VIEW(userdata); GtkTreeModel *model = gtk_tree_view_get_model(view); GtkTreeSelection *selection = gtk_tree_view_get_selection(view); GtkTreeIter iter; if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { GtkTreePath *path; GtkTreeIter next_iter; int i; path = gtk_tree_model_get_path(model, &iter); i = gtk_tree_path_get_indices(path)[0]; if (i < __config_sysdicts.size() - 1) { vector<String>::iterator it = __config_sysdicts.begin() + i; vector<String>::iterator it2 = it + 1; iter_swap(it, it2); __have_changed = true; } gtk_tree_path_next(path); if (gtk_tree_model_get_iter(model, &next_iter, path)) { gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, &next_iter); } gtk_tree_path_free(path); } }
static VALUE rg_move_after(VALUE self, VALUE iter, VALUE position) { gtk_list_store_move_after(_SELF(self), RVAL2GTKTREEITER(iter), NIL_P(position) ? NULL : RVAL2GTKTREEITER(position)); return self; }
static void move_down_clicked_callback (GtkWidget *button, gpointer user_data) { NautilusColumnChooser *chooser; GtkTreeIter iter; GtkTreeSelection *selection; chooser = NAUTILUS_COLUMN_CHOOSER (user_data); selection = gtk_tree_view_get_selection (chooser->details->view); if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { GtkTreeIter next; next = iter; if (gtk_tree_model_iter_next (GTK_TREE_MODEL (chooser->details->store), &next)) { gtk_list_store_move_after (chooser->details->store, &iter, &next); } } list_changed (chooser); }
static void set_column_order (CajaColumnChooser *chooser, char **column_order) { GList *columns; GList *l; GtkTreePath *path; columns = caja_get_columns_for_file (chooser->details->file); columns = caja_sort_columns (columns, column_order); g_signal_handlers_block_by_func (chooser->details->store, G_CALLBACK (row_deleted_callback), chooser); path = gtk_tree_path_new_first (); for (l = columns; l != NULL; l = l->next) { GtkTreeIter iter; if (get_column_iter (chooser, CAJA_COLUMN (l->data), &iter)) { GtkTreeIter before; if (path) { gtk_tree_model_get_iter (GTK_TREE_MODEL (chooser->details->store), &before, path); gtk_list_store_move_after (chooser->details->store, &iter, &before); gtk_tree_path_next (path); } else { gtk_list_store_move_after (chooser->details->store, &iter, NULL); } } } gtk_tree_path_free (path); g_signal_handlers_unblock_by_func (chooser->details->store, G_CALLBACK (row_deleted_callback), chooser); caja_column_list_free (columns); }
static void gimp_container_combo_box_reorder_item (GimpContainerView *view, GimpViewable *viewable, gint new_index, gpointer insert_data) { GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (view)); GimpContainer *container = gimp_container_view_get_container (view); GtkTreeIter *iter = insert_data; if (!iter) return; if (new_index == -1 || new_index == container->num_children - 1) { gtk_list_store_move_before (GTK_LIST_STORE (model), iter, NULL); } else if (new_index == 0) { gtk_list_store_move_after (GTK_LIST_STORE (model), iter, NULL); } else { GtkTreePath *path; gint old_index; path = gtk_tree_model_get_path (model, iter); old_index = gtk_tree_path_get_indices (path)[0]; gtk_tree_path_free (path); if (new_index != old_index) { GtkTreeIter place; path = gtk_tree_path_new_from_indices (new_index, -1); gtk_tree_model_get_iter (model, &place, path); gtk_tree_path_free (path); if (new_index > old_index) gtk_list_store_move_after (GTK_LIST_STORE (model), iter, &place); else gtk_list_store_move_before (GTK_LIST_STORE (model), iter, &place); } } }
static void gebr_gui_sequence_edit_move_real (GebrGuiSequenceEdit *self, GtkTreeIter *iter, GtkTreeIter *position, GtkTreeViewDropPosition drop_position) { if (drop_position == GTK_TREE_VIEW_DROP_AFTER) gtk_list_store_move_after(self->list_store, iter, position); else gtk_list_store_move_before(self->list_store, iter, position); g_signal_emit(self, object_signals[CHANGED], 0); }
/** * \internal */ static void __category_edit_move_top(CategoryEdit * category_edit, GtkTreeIter * iter) { GebrGeoXmlSequence *sequence; gtk_tree_model_get(GTK_TREE_MODEL(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store), iter, 2, &sequence, -1); gebr_geoxml_sequence_move_after(sequence, NULL); gtk_list_store_move_after(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store, iter, NULL); g_signal_emit_by_name(category_edit, "changed"); }
static gboolean gw_settingswindow_dictionary_drag_reorder ( GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint time, gpointer user_data) { //Declarations GwSettingsWindow *window; GwApplication *application; GwDictionaryList *dictionarylist; LwPreferences *preferences; GtkTreeViewDropPosition drop_position; GtkTreePath *path; GtkTreeView *view; GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter, position; //Initializations window = GW_SETTINGSWINDOW (gtk_widget_get_ancestor (GTK_WIDGET (widget), GW_TYPE_SETTINGSWINDOW)); application = gw_window_get_application (GW_WINDOW (window)); dictionarylist = gw_application_get_installed_dictionarylist (application); preferences = gw_application_get_preferences (application); g_return_val_if_fail (window != NULL, FALSE); view = GTK_TREE_VIEW (widget); selection = gtk_tree_view_get_selection (view); model = gtk_tree_view_get_model (view); gtk_tree_view_get_dest_row_at_pos (view, x, y, &path, &drop_position); if (path == NULL) return FALSE; gtk_tree_model_get_iter (model, &position, path); gtk_tree_path_free (path); path = NULL; if (drop_position == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) drop_position = GTK_TREE_VIEW_DROP_BEFORE; else if (drop_position == GTK_TREE_VIEW_DROP_INTO_OR_AFTER) drop_position = GTK_TREE_VIEW_DROP_AFTER; gtk_tree_selection_get_selected (selection, &model, &iter); if (drop_position == GTK_TREE_VIEW_DROP_BEFORE) gtk_list_store_move_before (GTK_LIST_STORE (model), &iter, &position); else if (drop_position == GTK_TREE_VIEW_DROP_AFTER) gtk_list_store_move_after (GTK_LIST_STORE (model), &iter, &position); gw_dictionarylist_save_order (dictionarylist, preferences); return TRUE; }
/** * gwy_app_recent_file_list_update: * @data: A data container corresponding to the file. * @filename_utf8: A recent file to insert or move to the first position in * document history, in UTF-8. * @filename_sys: A recent file to insert or move to the first position in * document history, in GLib encoding. * @hint: Preferred channel id to use for thumbnail, pass 0 if no channel * is specificaly preferred. * * Moves @filename_utf8 to the first position in document history, possibly * adding it if not present yet. * * At least one of @filename_utf8, @filename_sys should be set. **/ void gwy_app_recent_file_list_update(GwyContainer *data, const gchar *filename_utf8, const gchar *filename_sys, gint hint) { gboolean free_utf8 = FALSE, free_sys = FALSE;; g_return_if_fail(!data || GWY_IS_CONTAINER(data)); if (!gcontrols.store) return; if (!filename_utf8 && filename_sys) { filename_utf8 = g_filename_to_utf8(filename_sys, -1, NULL, NULL, NULL); free_utf8 = TRUE; } if (!filename_sys && filename_utf8) { filename_sys = g_filename_from_utf8(filename_utf8, -1, NULL, NULL, NULL); free_sys = TRUE; } if (filename_utf8) { GtkTreeIter iter; GwyRecentFile *rf; if (gwy_app_recent_file_find(filename_utf8, &iter, &rf)) gtk_list_store_move_after(gcontrols.store, &iter, NULL); else { rf = gwy_app_recent_file_new(gwy_canonicalize_path(filename_utf8), gwy_canonicalize_path(filename_sys)); gtk_list_store_prepend(gcontrols.store, &iter); gtk_list_store_set(gcontrols.store, &iter, FILELIST_RAW, rf, -1); } if (data) gwy_recent_file_update_thumbnail(rf, data, hint, NULL); } if (free_utf8) g_free((gpointer)filename_utf8); if (free_sys) g_free((gpointer)filename_sys); gwy_app_recent_file_list_update_menu(&gcontrols); }
int clip_GTK_LISTSTOREMOVEAFTER(ClipMachine * cm) { C_object *cslist = _fetch_co_arg(cm); C_object *citer1 = _fetch_cobject(cm, _clip_spar(cm, 2)); C_object *citer2 = _fetch_cobject(cm, _clip_spar(cm, 3)); CHECKARG2(1, MAP_t, NUMERIC_t); CHECKCOBJ(cslist, GTK_IS_LIST_STORE(cslist->object)); CHECKCOBJ(citer1, GTK_IS_TREE_ITER(citer1->object)); CHECKCOBJ(citer2, GTK_IS_TREE_ITER(citer2->object)); gtk_list_store_move_after(GTK_LIST_STORE(cslist->object), GTK_TREE_ITER(citer1->object), GTK_TREE_ITER(citer2->object)); return 0; err: return 1; }
static void move_item (GtkWidget *widget, gpointer data, gboolean up) { GtkTreeIter iter; GtkTreeView *treeview = (GtkTreeView *)data; GtkTreeModel *model = gtk_tree_view_get_model (treeview); GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_get_selected (selection, NULL, &iter)) { gint i; GtkTreePath *path; path = gtk_tree_model_get_path (model, &iter); i = gtk_tree_path_get_indices (path)[0]; if (up) { if ( i > 0) i--; } else { if ( i < gtk_tree_model_iter_n_children(model, NULL) - 1 ) i++; } GtkTreePath *dst_path = gtk_tree_path_new_from_indices (i, -1); GtkTreeIter dst_iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &dst_iter, dst_path); if (up) gtk_list_store_move_before (GTK_LIST_STORE(model), &iter, &dst_iter); else gtk_list_store_move_after (GTK_LIST_STORE(model), &iter, &dst_iter); gtk_tree_path_free (path); gtk_tree_path_free (dst_path); } guint next_level = 1; gtk_tree_model_foreach(model, resequence_level_in_model, &next_level); }
/** * \internal */ static void __category_edit_move(CategoryEdit * category_edit, GtkTreeIter * iter, GtkTreeIter * position, GtkTreeViewDropPosition drop_position) { GebrGeoXmlSequence *sequence; GebrGeoXmlSequence *position_sequence; gtk_tree_model_get(GTK_TREE_MODEL(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store), iter, 2, &sequence, -1); gtk_tree_model_get(GTK_TREE_MODEL(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store), position, 2, &position_sequence, -1); if (drop_position == GTK_TREE_VIEW_DROP_AFTER) { gebr_geoxml_sequence_move_after(sequence, position_sequence); gtk_list_store_move_after(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store, iter, position); } else { gebr_geoxml_sequence_move_before(sequence, position_sequence); gtk_list_store_move_before(GEBR_GUI_SEQUENCE_EDIT(category_edit)->list_store, iter, position); } g_signal_emit_by_name(category_edit, "changed"); }
void dat_movedown_templ_cb(GtkButton *button, gpointer user_data) { GncABTransDialog *td = user_data; GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter; GtkTreeIter next_iter; g_return_if_fail(td); selection = gtk_tree_view_get_selection(td->template_gtktreeview); if (!gtk_tree_selection_get_selected (selection, &model, &iter)) return; next_iter = iter; if (gtk_tree_model_iter_next(model, &next_iter)) { gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, &next_iter); td->templ_changed = TRUE; } }
static void on_down_clicked( GtkButton *button, BaseWindow *window ) { GtkTreeView *treeview; GtkTreeSelection *selection; GtkTreeModel *model; GtkTreeIter iter_selected; GtkTreeIter *iter_next; GtkTreePath *path_next; treeview = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( window ), PROVIDERS_LIST_TREEVIEW )); selection = gtk_tree_view_get_selection( treeview ); if( gtk_tree_selection_get_selected( selection, &model, &iter_selected )){ iter_next = gtk_tree_iter_copy( &iter_selected ); if( gtk_tree_model_iter_next( model, iter_next )){ path_next = gtk_tree_model_get_path( model, iter_next ); gtk_list_store_move_after( GTK_LIST_STORE( model ), &iter_selected, iter_next ); gtk_tree_selection_unselect_all( selection ); gtk_tree_selection_select_path( selection, path_next ); gtk_tree_path_free( path_next ); } gtk_tree_iter_free( iter_next ); } }
void DictMngr::CreateReorderDialog() { GtkWidget *dialog, *selector; GtkCellRenderer *renderer; HildonTouchSelectorColumn *column; GtkTreeModel *tree_model; GtkTreeIter iter, iter2; GtkTreePath *path; gboolean iter_valid = TRUE; std::list < std::string > selected_dict_list; GtkListStore *dict_list = NULL; const gint RESPONSE_FIRST = 1; const gint RESPONSE_UP = 2; const gint RESPONSE_DOWN = 3; const gint RESPONSE_LAST = 4; gint response; dict_list = gtk_list_store_new(N_DICT_INFO_COLUMNS, G_TYPE_STRING, /* bookname */ G_TYPE_STRING); /* filename */ /* create dialog */ dialog = gtk_dialog_new(); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); gtk_window_set_title(GTK_WINDOW(dialog), _("Reorder")); gtk_dialog_add_button(GTK_DIALOG(dialog), _("First"), RESPONSE_FIRST); gtk_dialog_add_button(GTK_DIALOG(dialog), _("Up"), RESPONSE_UP); gtk_dialog_add_button(GTK_DIALOG(dialog), _("Down"), RESPONSE_DOWN); gtk_dialog_add_button(GTK_DIALOG(dialog), _("Last"), RESPONSE_LAST); gtk_dialog_add_button(GTK_DIALOG(dialog), "OK", GTK_RESPONSE_ACCEPT); gtk_window_set_default_size(GTK_WINDOW(dialog), -1, 400); /* dictionary selector */ selector = hildon_touch_selector_new(); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), selector); renderer = gtk_cell_renderer_text_new(); g_object_set(G_OBJECT(renderer), "xpad", 10, "ellipsize", PANGO_ELLIPSIZE_END, "ellipsize-set", TRUE, NULL); column = hildon_touch_selector_append_column(HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL(dict_list), renderer, "text", BOOKNAME_DICT_INFO_COLUMN, NULL); hildon_touch_selector_column_set_text_column(column, 0); /* fill list with selected dictionaries */ oStarDict->oConf->GetStringList("/apps/maemo/mstardict/dict_list", selected_dict_list); for (std::list < std::string >::iterator i = selected_dict_list.begin(); i != selected_dict_list.end(); ++i) { DictInfo dictinfo; dictinfo.load_from_ifo_file(i->c_str(), 0); gtk_list_store_append(dict_list, &iter); gtk_list_store_set(dict_list, &iter, BOOKNAME_DICT_INFO_COLUMN, dictinfo.bookname.c_str(), FILENAME_DICT_INFO_COLUMN, i->c_str(), -1); } g_object_unref(dict_list); /* show dialog */ gtk_widget_show_all(GTK_WIDGET(dialog)); /* run the dialog */ while (TRUE) { response = gtk_dialog_run(GTK_DIALOG(dialog)); switch(response) { case RESPONSE_FIRST: tree_model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN); if (hildon_touch_selector_get_selected(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN, &iter)) { gtk_list_store_move_after(GTK_LIST_STORE(tree_model), &iter, NULL); hildon_touch_selector_center_on_selected(HILDON_TOUCH_SELECTOR(selector)); } break; case RESPONSE_UP: tree_model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN); if (hildon_touch_selector_get_selected(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN, &iter)) { path = gtk_tree_model_get_path(tree_model, &iter); gtk_tree_path_prev(path); if (gtk_tree_model_get_iter(tree_model, &iter2, path)) { gtk_list_store_swap(GTK_LIST_STORE(tree_model), &iter, &iter2); } gtk_tree_path_free(path); hildon_touch_selector_center_on_selected(HILDON_TOUCH_SELECTOR(selector)); } break; case RESPONSE_DOWN: tree_model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN); if (hildon_touch_selector_get_selected(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN, &iter)) { path = gtk_tree_model_get_path(tree_model, &iter); gtk_tree_path_next(path); if (gtk_tree_model_get_iter(tree_model, &iter2, path)) { gtk_list_store_swap(GTK_LIST_STORE(tree_model), &iter, &iter2); } gtk_tree_path_free(path); hildon_touch_selector_center_on_selected(HILDON_TOUCH_SELECTOR(selector)); } break; case RESPONSE_LAST: tree_model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN); if (hildon_touch_selector_get_selected(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN, &iter)) { gtk_list_store_move_before(GTK_LIST_STORE(tree_model), &iter, NULL); hildon_touch_selector_center_on_selected(HILDON_TOUCH_SELECTOR(selector)); } break; case GTK_RESPONSE_ACCEPT: tree_model = hildon_touch_selector_get_model(HILDON_TOUCH_SELECTOR(selector), BOOKNAME_DICT_INFO_COLUMN); iter_valid = gtk_tree_model_get_iter_first(tree_model, &iter); selected_dict_list.clear(); while (iter_valid) { const gchar *filename; gtk_tree_model_get(GTK_TREE_MODEL(tree_model), &iter, FILENAME_DICT_INFO_COLUMN, &filename, -1); selected_dict_list.push_back(std::string(filename)); iter_valid = gtk_tree_model_iter_next(tree_model, &iter); } if (oStarDict->oConf->SetStringList("/apps/maemo/mstardict/dict_list", selected_dict_list)) { /* reload dictionaries */ ReLoadDictionaries(selected_dict_list); } gtk_widget_destroy(GTK_WIDGET(dialog)); return; default: gtk_widget_destroy(GTK_WIDGET(dialog)); return; } } }
void slide_move_down(void) { // Local variables GtkTreeIter from_iter, to_iter; GtkTreePath *new_path; // Temporary path GList *next_slide; // Pointer to the slide below gint num_slides; // The total number of slides GtkTreePath *old_path = NULL; // The old path, which we'll free gint slide_position; // Which slide in the slide list we are moving slide *this_slide_data; // Pointer to the data for this slide GString *tmp_gstring; // Initialise some things tmp_gstring = g_string_new(NULL); // Safety check set_slides(g_list_first(get_slides())); slide_position = g_list_position(get_slides(), get_current_slide()); num_slides = g_list_length(get_slides()); if (num_slides == (slide_position + 1)) { // We can't move the bottom most slide any further down, so just return return; } // Swap the slides around this_slide_data = get_current_slide_data(); next_slide = g_list_nth(get_slides(), slide_position + 1); set_current_slide_data(next_slide->data); next_slide->data = this_slide_data; set_current_slide(next_slide); // Move the thumbnail down one position in the film strip list g_string_printf(tmp_gstring, "%u", slide_position); if (TRUE == gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(get_film_strip_store()), &from_iter, tmp_gstring->str)) { g_string_printf(tmp_gstring, "%u", slide_position + 1); if (TRUE == gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(get_film_strip_store()), &to_iter, tmp_gstring->str)) { gtk_list_store_move_after(GTK_LIST_STORE(get_film_strip_store()), &from_iter, &to_iter); } } g_string_free(tmp_gstring, TRUE); // Scroll the film strip to show the new thumbnail position gtk_tree_view_get_cursor(GTK_TREE_VIEW(get_film_strip_view()), &new_path, NULL); if (NULL != new_path) old_path = new_path; // Make a backup of the old path, so we can free it new_path = gtk_tree_path_new_from_indices(slide_position + 1, -1); gtk_tree_view_set_cursor(GTK_TREE_VIEW(get_film_strip_view()), new_path, NULL, FALSE); gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(get_film_strip_view()), new_path, NULL, TRUE, 0.5, 0.0); if (NULL != old_path) gtk_tree_path_free(old_path); // Free the old path // Set the changes made variable set_changes_made(TRUE); // Update the status bar gtk_progress_bar_set_text(GTK_PROGRESS_BAR(get_status_bar()), _(" Slide moved down")); gdk_flush(); }
static void on_drag_data_received ( GtkWidget *dest_widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *sel_data, guint info, guint time) { FmPlacesView* view = FM_PLACES_VIEW(dest_widget); GtkTreePath* dest_tp = NULL; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(view), x, y, &dest_tp, &pos); switch(info) { case FM_DND_DEST_TARGET_BOOOKMARK: if(get_bookmark_drag_dest(view, &dest_tp, &pos)) /* got the drop position */ { GtkTreePath* src_tp; /* get the source row */ gboolean ret = gtk_tree_get_row_drag_data(sel_data, NULL, &src_tp); if(ret) { /* don't do anything if source and dest are the same row */ if(G_UNLIKELY(gtk_tree_path_compare(src_tp, dest_tp) == 0)) ret = FALSE; else { /* don't do anything if this is not a bookmark item */ if(!fm_places_model_path_is_bookmark(FM_PLACES_MODEL(model), src_tp)) ret = FALSE; } if(ret) { GtkTreeIter src_it, dest_it; FmPlaceItem* item = NULL; ret = FALSE; /* get the source bookmark item */ if(gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &src_it, src_tp)) gtk_tree_model_get(GTK_TREE_MODEL(model), &src_it, FM_PLACES_MODEL_COL_INFO, &item, -1); if(item) { /* move it to destination position */ if(gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &dest_it, dest_tp)) { int new_pos, sep_pos; /* get index of the separator */ const GtkTreePath* sep_tp = fm_places_model_get_separator_path(FM_PLACES_MODEL(model)); sep_pos = gtk_tree_path_get_indices(sep_tp)[0]; if(pos == GTK_TREE_VIEW_DROP_BEFORE) gtk_list_store_move_before(model, &src_it, &dest_it); else gtk_list_store_move_after(model, &src_it, &dest_it); new_pos = gtk_tree_path_get_indices(dest_tp)[0] - sep_pos - 1; /* reorder the bookmark item */ fm_bookmarks_reorder(FM_PLACES_MODEL(model)->bookmarks, item->bm_item, new_pos); ret = TRUE; } } } gtk_tree_path_free(src_tp); } gtk_drag_finish(drag_context, ret, FALSE, time); } break; default: /* check if files are received. */ fm_dnd_dest_drag_data_received(view->dnd_dest, drag_context, x, y, sel_data, info, time); break; } if(dest_tp) gtk_tree_path_free(dest_tp); }
static void gebr_gui_sequence_edit_move_top_real(GebrGuiSequenceEdit *self, GtkTreeIter *iter) { gtk_list_store_move_after(self->list_store, iter, NULL); g_signal_emit(self, object_signals[CHANGED], 0); }