Keep the list of open files in sync when reordering notebook tabs.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@606 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2006-07-22 14:36:20 +00:00
parent e538244874
commit 285cda8924
4 changed files with 32 additions and 2 deletions

View File

@ -8,6 +8,8 @@
encoding(both were patches from Stefan Oltmanns).
* src/callbacks.c: Fixed two issues when showing / hiding the sidebar.
* src/filetypes.c: Added *.cfg as extension for config files.
* src/treeviews.c, src/notebook.c:
Keep the list of open files in sync when reordering notebook tabs.
2006-07-21 Nick Treleaven <nick.treleaven@btinternet.com>

View File

@ -24,6 +24,7 @@
#include "notebook.h"
#include "document.h"
#include "utils.h"
#include "treeviews.h"
#define GEANY_DND_NOTEBOOK_TAB_TYPE "geany_dnd_notebook_tab"
@ -142,8 +143,12 @@ notebook_drag_motion_cb(GtkWidget *widget, GdkDragContext *dc,
break;
}
if (ok) gtk_notebook_reorder_child(notebook,
gtk_notebook_get_nth_page(notebook, ncurr), ndest);
if (ok)
{
gtk_notebook_reorder_child(notebook,
gtk_notebook_get_nth_page(notebook, ncurr), ndest);
treeviews_openfiles_update_all();
}
}
oldx = x; oldy = y;

View File

@ -27,6 +27,7 @@
#include "callbacks.h"
#include "utils.h"
#include "treeviews.h"
#include "document.h"
/* the following two functions are document-related, but I think they fit better here than in document.c*/
@ -245,6 +246,26 @@ void treeviews_openfiles_update(GtkTreeIter iter, const gchar *string)
}
void treeviews_openfiles_update_all(void)
{
guint i;
gint idx;
gchar *basename;
gtk_list_store_clear(tv.store_openfiles);
for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); i++)
{
idx = document_get_n_idx(i);
if (! doc_list[idx].is_valid) continue;
basename = g_path_get_basename(doc_list[idx].file_name);
doc_list[idx].iter = treeviews_openfiles_add(idx, basename);
g_free(basename);
}
}
void treeviews_create_taglist_popup_menu(void)
{
GtkWidget *item;

View File

@ -58,6 +58,8 @@ GtkTreeIter treeviews_openfiles_add(gint idx, const gchar *string);
void treeviews_openfiles_update(GtkTreeIter iter, const gchar *string);
void treeviews_openfiles_update_all(void);
void treeviews_openfiles_remove(GtkTreeIter iter);
void treeviews_create_openfiles_popup_menu(void);