[gnome-latex: 82/205] Possibility to reorder the document tabs
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 82/205] Possibility to reorder the document tabs
- Date: Fri, 14 Dec 2018 10:53:46 +0000 (UTC)
commit 729e2b455bb092d701909cc6d99dbfe733aefd4b
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Thu Sep 24 17:49:15 2009 +0200
Possibility to reorder the document tabs
TODO | 4 ++--
src/callbacks.c | 16 +++++++++++-----
src/callbacks.h | 2 ++
src/main.c | 2 ++
4 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/TODO b/TODO
index b0dbbd4..a6dd85c 100644
--- a/TODO
+++ b/TODO
@@ -22,8 +22,8 @@ Fri Sep 18, 2009 to Fri Sep 25, 2009
[x] command line option
x new document (--new-document)
-[-] document tabs
- - possibility to move the tabs
+[x] document tabs
+ x possibility to move the tabs
[-] undo/redo and the "saved" document property
- detect when the buffer is the same as in the file currently saved
diff --git a/src/callbacks.c b/src/callbacks.c
index 26fa725..5786cd7 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -711,10 +711,16 @@ cb_page_change (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num,
latexila.active_doc = g_list_nth_data (latexila.all_docs, page_num);
set_undo_redo_sensitivity ();
update_cursor_position_statusbar ();
- /*
- print_info ("page_num: %d", page_num);
- print_info ("doc: %s", latexila.active_doc->path);
- */
+}
+
+void
+cb_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num,
+ gpointer user_data)
+{
+ // keep the same order in the GList all_docs than the tabs
+ latexila.all_docs = g_list_remove (latexila.all_docs, latexila.active_doc);
+ latexila.all_docs = g_list_insert (latexila.all_docs, latexila.active_doc,
+ page_num);
}
void
@@ -977,7 +983,7 @@ create_document_in_new_tab (const gchar *path, const gchar *text, const gchar *t
gtk_widget_show_all (hbox);
gint index = gtk_notebook_append_page (latexila.notebook, sw, hbox);
- //gtk_notebook_set_tab_reorderable (latexila.notebook, sw, TRUE);
+ gtk_notebook_set_tab_reorderable (latexila.notebook, sw, TRUE);
gtk_notebook_set_current_page (latexila.notebook, index);
set_undo_redo_sensitivity ();
diff --git a/src/callbacks.h b/src/callbacks.h
index dae083c..c97f5c2 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -54,6 +54,8 @@ void cb_cursor_moved (GtkTextBuffer *text_buffer, GtkTextIter *location,
GtkTextMark *mark, gpointer user_data);
void cb_page_change (GtkNotebook *notebook, GtkNotebookPage *page,
guint page_num, gpointer user_data);
+void cb_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num,
+ gpointer user_data);
gboolean cb_delete_event (GtkWidget *widget, GdkEvent *event,
gpointer user_data);
void cb_recent_item_activated (GtkRecentAction *action, gpointer user_data);
diff --git a/src/main.c b/src/main.c
index 745ed88..6d697ce 100644
--- a/src/main.c
+++ b/src/main.c
@@ -191,6 +191,8 @@ main (int argc, char *argv[])
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
g_signal_connect (G_OBJECT (notebook), "switch-page",
G_CALLBACK (cb_page_change), NULL);
+ g_signal_connect (G_OBJECT (notebook), "page-reordered",
+ G_CALLBACK (cb_page_reordered), NULL);
gtk_paned_add1 (GTK_PANED (vpaned), notebook);
/* log zone */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]