void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data) { guint i, max = (guint) gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); GeanyDocument *doc, *cur_doc = document_get_current(); guint count = 0; /* iterate over documents in tabs order */ for (i = 0; i < max; i++) { doc = document_get_from_page(i); if (! doc->changed) continue; if (document_save_file(doc, FALSE)) count++; } if (!count) return; ui_set_statusbar(FALSE, ngettext("%d file saved.", "%d files saved.", count), count); /* saving may have changed window title, sidebar for another doc, so update */ document_show_tab(cur_doc); sidebar_update_tag_list(cur_doc, TRUE); ui_set_window_title(cur_doc); }
/* Changes window-title after switching tabs and lots of other things. * note: using 'after' makes Scintilla redraw before the UI, appearing more responsive */ static void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { GeanyDocument *doc; if (G_UNLIKELY(main_status.opening_session_files || main_status.closing_all)) return; doc = document_get_from_notebook_child(page); if (doc != NULL) { sidebar_select_openfiles_item(doc); ui_save_buttons_toggle(doc->changed); ui_set_window_title(doc); ui_update_statusbar(doc, -1); ui_update_popup_reundo_items(doc); ui_document_show_hide(doc); /* update the document menu */ build_menu_update(doc); sidebar_update_tag_list(doc, FALSE); document_highlight_tags(doc); /* We delay the check to avoid weird fast, unintended switching of notebook pages when * the 'file has changed' dialog is shown while the switch event is not yet completely * finished. So, we check after the switch has been performed to be safe. */ g_idle_add(delayed_check_disk_status, doc); #ifdef HAVE_VTE vte_cwd((doc->real_path != NULL) ? doc->real_path : doc->file_name, FALSE); #endif g_signal_emit_by_name(geany_object, "document-activate", doc); } }
/* Changes window-title after switching tabs and lots of other things. * note: using 'after' makes Scintilla redraw before the UI, appearing more responsive */ static void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { GeanyDocument *doc; if (G_UNLIKELY(main_status.opening_session_files || main_status.closing_all)) return; doc = document_get_from_notebook_child(page); if (doc != NULL) { sidebar_select_openfiles_item(doc); ui_save_buttons_toggle(doc->changed); ui_set_window_title(doc); ui_update_statusbar(doc, -1); ui_update_popup_reundo_items(doc); ui_document_show_hide(doc); /* update the document menu */ build_menu_update(doc); sidebar_update_tag_list(doc, FALSE); document_highlight_tags(doc); document_check_disk_status(doc, TRUE); #ifdef HAVE_VTE vte_cwd((doc->real_path != NULL) ? doc->real_path : doc->file_name, FALSE); #endif g_signal_emit_by_name(geany_object, "document-activate", doc); } }
/* Called when creating, opening, closing and updating projects. */ static void update_ui(void) { if (main_status.quitting) return; ui_set_window_title(NULL); build_menu_update(NULL); sidebar_openfiles_update_all(); }