Revision: 6017 http://geany.svn.sourceforge.net/geany/?rev=6017&view=rev Author: ntrel Date: 2011-10-07 16:47:31 +0000 (Fri, 07 Oct 2011) Log Message: ----------- Add document_show_tab().
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/dialogs.c trunk/src/document.c trunk/src/document.h trunk/src/editor.c trunk/src/keybindings.c trunk/src/notebook.c trunk/src/sidebar.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/ChangeLog 2011-10-07 16:47:31 UTC (rev 6017) @@ -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:
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/callbacks.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -202,8 +202,7 @@ 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++; }
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/dialogs.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -629,10 +629,9 @@ }
-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 @@ **/ 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 @@ } else #endif - result = show_save_as_gtk(); + result = show_save_as_gtk(doc); return result; }
@@ -839,8 +841,7 @@
/* 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);
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/document.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -1108,6 +1108,13 @@ }
+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 @@ { 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 */ } }
Modified: trunk/src/document.h =================================================================== --- trunk/src/document.h 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/document.h 2011-10-07 16:47:31 UTC (rev 6017) @@ -192,6 +192,8 @@
GeanyDocument *document_get_current(void);
+void document_show_tab(GeanyDocument *doc); + void document_init_doclist(void);
void document_finalize(void);
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/editor.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -4496,8 +4496,6 @@ **/ 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 @@ 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; }
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/keybindings.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -1842,8 +1842,7 @@ 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 */
Modified: trunk/src/notebook.c =================================================================== --- trunk/src/notebook.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/notebook.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -177,8 +177,7 @@ if (! DOC_VALID(doc)) return;
- gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), - document_get_notebook_page(doc)); + document_show_tab(doc); }
Modified: trunk/src/sidebar.c =================================================================== --- trunk/src/sidebar.c 2011-10-06 20:45:53 UTC (rev 6016) +++ trunk/src/sidebar.c 2011-10-07 16:47:31 UTC (rev 6017) @@ -840,9 +840,7 @@ 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); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.