static void bmark_popup_menu_goto_lcb(GtkWidget * widget, gpointer user_data) { Tbmark *b; GtkTextIter it; if (!user_data) return; b = get_current_bmark(BFWIN(user_data)); if (!b) return; if (b->filepath && !b->doc) { /* check if that document _is_ open */ Tdocument *tmpdoc; GList *doclist = return_allwindows_documentlist(); tmpdoc = documentlist_return_document_from_filename(doclist, b->filepath); g_list_free(doclist); if (tmpdoc == NULL) { if (!g_file_test(b->filepath, G_FILE_TEST_EXISTS)) { gchar *string = g_strdup_printf(_("Could not find the file \"%s\"."), b->filepath); error_dialog(BFWIN(user_data)->main_window, string, _("This bookmark is set in a file that no longer exists.")); g_free(string); return; } tmpdoc = doc_new_with_file(BFWIN(user_data), b->filepath, FALSE, TRUE); } /* now I have to check all bookmarks */ bmark_set_for_doc(tmpdoc); } if (b->doc) { GdkRectangle visirect; GtkTextIter visi_so, visi_eo; gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(b->doc->view),&visirect); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(b->doc->view), &visi_so, visirect.x, visirect.y); gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(b->doc->view), &visi_eo, visirect.x + visirect.width, visirect.y + visirect.height); gtk_text_buffer_get_iter_at_mark(b->doc->buffer, &it, b->mark); gtk_text_buffer_place_cursor(b->doc->buffer, &it); if (!gtk_text_iter_in_range(&it,&visi_so,&visi_eo)) { DEBUG_MSG("bmark_popup_menu_goto_lcb, cursor NOT visible!\n"); /* gtk_text_view_scroll_mark_onscreen(GTK_TEXT_VIEW(b->doc->view), b->mark); */ gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(b->doc->view),b->mark,0.0, TRUE,0.5,0.5); } if (b->doc != BFWIN(user_data)->current_document) switch_to_document_by_pointer(BFWIN(user_data), b->doc); gtk_widget_grab_focus(b->doc->view); } }
void bluefish_exit_request() { GList *tmplist; gboolean tmpb; DEBUG_MSG("winefish_exit_request, started\n"); /* if we have modified documents we have to do something, file_close_all_cb() does exactly want we want to do */ tmplist = return_allwindows_documentlist(); tmpb = (tmplist && test_docs_modified(tmplist)); g_list_free(tmplist); tmplist = g_list_first(main_v->bfwinlist); while (tmplist) { /* if there is a project, we anyway want to save & close the project */ if (BFWIN(tmplist->data)->project) { if (!project_save_and_close(BFWIN(tmplist->data))) { /* cancelled or error! */ DEBUG_MSG("winefish_exit_request, project_save_and_close returned FALSE\n"); return; } } if (tmpb) { file_close_all_cb(NULL, BFWIN(tmplist->data)); } tmplist = g_list_next(tmplist); } /* if we still have modified documents we don't do a thing, if we don't have them we can quit */ if (tmpb) { tmplist = return_allwindows_documentlist(); tmpb = (tmplist && test_docs_modified(tmplist)); g_list_free(tmplist); if (tmpb) { return; } } /* gtk_widget_hide(main_v->main_window);*/ tmplist = g_list_first(gtk_window_list_toplevels()); gchar *role=NULL; while (tmplist) { /* BUG#38 */ if (GTK_IS_WIDGET(tmplist->data)) { role = g_strdup(gtk_window_get_role ((GtkWindow*)tmplist->data)); gtk_widget_hide(GTK_WIDGET(tmplist->data)); if (role && strncmp(role,"html_dialog",11) ==0) { window_destroy(GTK_WIDGET(tmplist->data)); } } /* g_print("type = %s, role=%s\n", GTK_OBJECT_TYPE_NAME((GtkObject*) tmplist->data), role); */ tmplist = g_list_next(tmplist); } g_free(role); flush_queue(); rcfile_save_all(); { gchar *filename = g_strconcat(g_get_home_dir(), "/.winefish/dir_history", NULL); put_stringlist_limited(filename, main_v->recent_directories, main_v->props.max_dir_history); g_free(filename); } gtk_main_quit(); }