/* This function is only called during dnd, we don't need to emit TABS_REORDERED * here, instead we do it on drag_stop */ static void move_current_tab (PlumaNotebook *notebook, gint dest_position) { gint cur_page_num; cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); if (dest_position != cur_page_num) { GtkWidget *cur_tab; cur_tab = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), cur_page_num); pluma_notebook_reorder_tab (PLUMA_NOTEBOOK (notebook), PLUMA_TAB (cur_tab), dest_position); } }
static void treeview_row_inserted (GtkTreeModel *tree_model, GtkTreePath *path, GtkTreeIter *iter, PlumaDocumentsPanel *panel) { PlumaTab *tab; gint *indeces; GtkWidget *nb; gint old_position; gint new_position; if (panel->priv->adding_tab) return; tab = pluma_window_get_active_tab (panel->priv->window); g_return_if_fail (tab != NULL); panel->priv->is_reodering = TRUE; indeces = gtk_tree_path_get_indices (path); /* g_debug ("New Index: %d (path: %s)", indeces[0], gtk_tree_path_to_string (path));*/ nb = _pluma_window_get_notebook (panel->priv->window); new_position = indeces[0]; old_position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab)); if (new_position > old_position) new_position = MAX (0, new_position - 1); pluma_notebook_reorder_tab (PLUMA_NOTEBOOK (nb), tab, new_position); panel->priv->is_reodering = FALSE; }