Add document_show_tab().
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@6017 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
be81fafafb
commit
1563c625f7
@ -1,3 +1,10 @@
|
||||
2011-10-07 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/keybindings.c, src/sidebar.c, src/dialogs.c, src/callbacks.c,
|
||||
src/notebook.c, src/document.c, src/document.h, src/editor.c:
|
||||
Add document_show_tab().
|
||||
|
||||
|
||||
2011-10-06 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* doc/Makefile.am, doc/makefile.win32:
|
||||
|
@ -202,8 +202,7 @@ void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data)
|
||||
if (document_need_save_as(doc))
|
||||
{
|
||||
/* display unnamed document */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(doc));
|
||||
document_show_tab(doc);
|
||||
if (dialogs_show_save_as())
|
||||
count++;
|
||||
}
|
||||
|
@ -629,10 +629,9 @@ static GtkWidget *create_save_file_dialog(void)
|
||||
}
|
||||
|
||||
|
||||
static gboolean show_save_as_gtk(void)
|
||||
static gboolean show_save_as_gtk(GeanyDocument *doc)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GeanyDocument *doc = document_get_current();
|
||||
gint resp;
|
||||
|
||||
g_return_val_if_fail(doc != NULL, FALSE);
|
||||
@ -700,12 +699,15 @@ static gboolean show_save_as_gtk(void)
|
||||
**/
|
||||
gboolean dialogs_show_save_as()
|
||||
{
|
||||
GeanyDocument *doc = document_get_current();
|
||||
gboolean result = FALSE;
|
||||
|
||||
g_return_val_if_fail(doc, FALSE);
|
||||
document_show_tab(doc);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
if (interface_prefs.use_native_windows_dialogs)
|
||||
{
|
||||
GeanyDocument *doc = document_get_current();
|
||||
gchar *utf8_name = win32_show_document_save_as_dialog(GTK_WINDOW(main_widgets.window),
|
||||
_("Save File"), DOC_FILENAME(doc));
|
||||
if (utf8_name != NULL)
|
||||
@ -713,7 +715,7 @@ gboolean dialogs_show_save_as()
|
||||
}
|
||||
else
|
||||
#endif
|
||||
result = show_save_as_gtk();
|
||||
result = show_save_as_gtk(doc);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -839,8 +841,7 @@ gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
|
||||
|
||||
/* display the file tab to remind the user of the document */
|
||||
main_status.quitting = FALSE;
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(doc));
|
||||
document_show_tab(doc);
|
||||
main_status.quitting = old_quitting_state;
|
||||
|
||||
short_fn = document_get_basename_for_display(doc, -1);
|
||||
|
@ -1108,6 +1108,13 @@ void document_apply_indent_settings(GeanyDocument *doc)
|
||||
}
|
||||
|
||||
|
||||
void document_show_tab(GeanyDocument *doc)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(doc));
|
||||
}
|
||||
|
||||
|
||||
/* To open a new file, set doc to NULL; filename should be locale encoded.
|
||||
* To reload a file, set the doc for the document to be reloaded; filename should be NULL.
|
||||
* pos is the cursor position, which can be overridden by --line and --column.
|
||||
@ -1156,9 +1163,7 @@ GeanyDocument *document_open_file_full(GeanyDocument *doc, const gchar *filename
|
||||
{
|
||||
ui_add_recent_file(utf8_filename); /* either add or reorder recent item */
|
||||
/* show the doc before reload dialog */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
(GtkWidget*) doc->editor->sci));
|
||||
document_show_tab(doc);
|
||||
document_check_disk_status(doc, TRUE); /* force a file changed check */
|
||||
}
|
||||
}
|
||||
|
@ -192,6 +192,8 @@ GeanyDocument* document_get_from_page(guint page_num);
|
||||
|
||||
GeanyDocument *document_get_current(void);
|
||||
|
||||
void document_show_tab(GeanyDocument *doc);
|
||||
|
||||
void document_init_doclist(void);
|
||||
|
||||
void document_finalize(void);
|
||||
|
@ -4496,8 +4496,6 @@ gboolean editor_goto_line(GeanyEditor *editor, gint line_no, gint offset)
|
||||
**/
|
||||
gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark)
|
||||
{
|
||||
gint page_num;
|
||||
|
||||
g_return_val_if_fail(editor, FALSE);
|
||||
if (G_UNLIKELY(pos < 0))
|
||||
return FALSE;
|
||||
@ -4515,9 +4513,7 @@ gboolean editor_goto_pos(GeanyEditor *editor, gint pos, gboolean mark)
|
||||
editor->scroll_percent = 0.25F;
|
||||
|
||||
/* finally switch to the page */
|
||||
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook), GTK_WIDGET(editor->sci));
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page_num);
|
||||
|
||||
document_show_tab(editor->document);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1842,8 +1842,7 @@ static void cb_func_switch_tablastused(G_GNUC_UNUSED guint key_id)
|
||||
if (! DOC_VALID(last_doc))
|
||||
return;
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(last_doc));
|
||||
document_show_tab(last_doc);
|
||||
|
||||
/* if there's a modifier key, we can switch back in MRU order each time unless
|
||||
* the key is released */
|
||||
|
@ -177,8 +177,7 @@ static void tab_bar_menu_activate_cb(GtkMenuItem *menuitem, gpointer data)
|
||||
if (! DOC_VALID(doc))
|
||||
return;
|
||||
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(doc));
|
||||
document_show_tab(doc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -840,9 +840,7 @@ static gboolean openfiles_go_to_selection(GtkTreeSelection *selection, guint key
|
||||
return FALSE; /* parent */
|
||||
|
||||
/* switch to the doc and grab the focus */
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
gtk_notebook_page_num(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
(GtkWidget*) doc->editor->sci));
|
||||
document_show_tab(doc);
|
||||
if (keyval != GDK_space)
|
||||
change_focus_to_editor(doc, tv.tree_openfiles);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user