G_MODULE_EXPORT gboolean on_menu_quit_activate(void) { gint wx = 0, wy = 0, width = 0, height = 0; gchar buf[16]; int i = 0; gint length = g_list_length(gummi->tabmanager->tabs); motion_pause_compile_thread(gummi->motion); for (i = 0; i < length; i++) { gtk_notebook_set_current_page(gui->tabmanagergui->notebook, i); tabmanager_set_active_tab(i); gint ret = check_for_save(g_active_editor); if (GTK_RESPONSE_YES == ret) { gui_save_file(g_active_tab, FALSE); } else if (GTK_RESPONSE_CANCEL == ret || GTK_RESPONSE_DELETE_EVENT == ret) { motion_resume_compile_thread(gummi->motion); return TRUE; } } /* Stop compile thread */ if (length > 0) motion_stop_compile_thread(gummi->motion); gboolean is_maximized; g_object_get(gui->mainwindow, "is-maximized", &is_maximized, NULL); if (!is_maximized) { gtk_window_get_size(gui->mainwindow, &width, &height); gtk_window_get_position(gui->mainwindow, &wx, &wy); config_begin(); config_set_value("mainwindow_x", g_ascii_dtostr(buf, 16, (double)wx)); config_set_value("mainwindow_y", g_ascii_dtostr(buf, 16, (double)wy)); config_set_value("mainwindow_w", g_ascii_dtostr(buf, 16, (double)width)); config_set_value("mainwindow_h", g_ascii_dtostr(buf, 16, (double)height)); config_commit(); } gtk_main_quit(); for (i = 0; i < length; i++) editor_destroy(GU_TAB_CONTEXT(g_list_nth_data (gummi->tabmanager->tabs, i))->editor); printf(" ___ \n" " {o,o} Thanks for using Gummi!\n" " |)__) I welcome your feedback at:\n" " -\"-\"- http://gummi.midnightcoding.org\n\n"); return FALSE; }
G_MODULE_EXPORT void on_menu_close_activate (GtkWidget *widget, void* user) { GuTabContext* tab = NULL; tab = (user)? GU_TAB_CONTEXT (user): g_active_tab; gint ret = check_for_save (tab->editor); if (GTK_RESPONSE_YES == ret) gui_save_file (tab, FALSE); else if (GTK_RESPONSE_CANCEL == ret || GTK_RESPONSE_DELETE_EVENT == ret) return; /* Kill typesetter command */ motion_kill_typesetter(gummi->motion); if (!tabmanager_remove_tab (tab)) { motion_start_errormode (gummi->motion, ""); gui_set_hastabs_sensitive (FALSE); } else { gui_set_filename_display (g_active_tab, TRUE, FALSE); } }
G_MODULE_EXPORT void on_menu_saveas_activate(GtkWidget *widget, void* user) { gui_save_file(g_active_tab, TRUE); }