Commit 38fdf042 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Switch to using URIs internally.

2004-06-11  Morten Welinder  <terra@gnome.org>

	* src/workbook.c (workbook_set_uri): Ranamed from
	workbook_set_filename.
	(workbook_get_uri): Renamed from workbook_get_filename.

	* src/application.c (gnm_app_history_add): Change to take uri.
	All callers changed.

	* src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Adapt to uris.

	* src/gui-file.c (gui_file_read, do_save_as, go_file_is_writable):
	Changed to take uri.  All callers changed.

	* src/workbook-view.c (wb_view_new_from_uri): Renamed from
	wb_view_new_from_file and adapted to take uri.  All callers
	changed.
	(wb_view_save_as): Change to take uri.  All callers changed.
parent b8af1e1f
2004-06-11 Morten Welinder <terra@gnome.org>
* src/workbook.c (workbook_set_uri): Ranamed from
workbook_set_filename.
(workbook_get_uri): Renamed from workbook_get_filename.
* src/application.c (gnm_app_history_add): Change to take uri.
All callers changed.
* src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Adapt to uris.
* src/gui-file.c (gui_file_read, do_save_as, go_file_is_writable):
Changed to take uri. All callers changed.
* src/workbook-view.c (wb_view_new_from_uri): Renamed from
wb_view_new_from_file and adapted to take uri. All callers
changed.
(wb_view_save_as): Change to take uri. All callers changed.
2004-06-08 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=143577
......
......@@ -89,6 +89,7 @@ Morten:
* Fix parser problem with single empty arg after expression. [backported]
* Avoid keeping passwords in memory. (Will need gtk+ fix to be really
effective.)
* Switch to keeping URIs, not filenames, inside and in history.
(For those worrying over the pile of accuracy fixes above it should
be noted that prior versions of Gnumeric were already pretty good,
......
2004-06-11 Morten Welinder <terra@gnome.org>
* src/workbook.c (workbook_set_uri): Ranamed from
workbook_set_filename.
(workbook_get_uri): Renamed from workbook_get_filename.
* src/application.c (gnm_app_history_add): Change to take uri.
All callers changed.
* src/wbc-gtk.c (wbc_gtk_reload_recent_file_menu): Adapt to uris.
* src/gui-file.c (gui_file_read, do_save_as, go_file_is_writable):
Changed to take uri. All callers changed.
* src/workbook-view.c (wb_view_new_from_uri): Renamed from
wb_view_new_from_file and adapted to take uri. All callers
changed.
(wb_view_save_as): Change to take uri. All callers changed.
2004-06-08 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=143577
......
......@@ -75,7 +75,7 @@ applix_write_header (ApplixWriteState const *state)
#warning "FIXME: filename is fs encoded; that's not right, but neither is UTF-8."
gsf_output_printf (state->sink,
"Current Doc Real Name: %s",
workbook_get_filename (state->wb));
workbook_get_uri (state->wb));
}
static void
......
......@@ -66,7 +66,7 @@ cworkbook_get_name (PortableServer_Servant servant,
{
WorkbookControlCORBA *wbcc = wbcc_from_servant (servant);
Workbook *wb = wb_control_workbook (WORKBOOK_CONTROL (wbcc));
return CORBA_string_dup (workbook_get_filename (wb));
return CORBA_string_dup (workbook_get_uri (wb));
}
static void
......@@ -77,7 +77,7 @@ cworkbook_set_name (PortableServer_Servant servant, CORBA_char const *name,
Workbook *wb = wb_control_workbook (WORKBOOK_CONTROL (wbcc));
g_return_if_fail (wbcc != NULL);
workbook_set_filename (wb, name);
workbook_set_uri (wb, name);
}
static GNOME_Gnumeric_Sheet
......
......@@ -4998,7 +4998,7 @@ excel_read_FILEPASS (BiffQuery *q, ExcelWorkbook *ewb)
while (TRUE) {
char *passwd = gnm_cmd_context_get_password (GNM_CMD_CONTEXT (ewb->context),
workbook_get_filename (ewb->gnum_wb));
workbook_get_uri (ewb->gnum_wb));
if (passwd == NULL)
return _("No password supplied");
if (ms_biff_query_set_decrypt (q, ewb->container.ver, passwd))
......
......@@ -667,8 +667,8 @@ ms_excel_dump_cellname (ExcelWorkbook const *ewb, ExcelReadSheet const *esheet,
{
if (esheet && esheet->sheet && esheet->sheet->name_unquoted)
fprintf (stderr, "%s!", esheet->sheet->name_unquoted);
else if (ewb && ewb->gnum_wb && workbook_get_filename (ewb->gnum_wb)) {
fprintf (stderr, "[%s]", workbook_get_filename (ewb->gnum_wb));
else if (ewb && ewb->gnum_wb && workbook_get_uri (ewb->gnum_wb)) {
fprintf (stderr, "[%s]", workbook_get_uri (ewb->gnum_wb));
return;
}
fprintf (stderr, "%s%d : ", col_name(fn_col), fn_row+1);
......
......@@ -241,7 +241,7 @@ gnumeric_cell (FunctionEvalInfo *ei, GnmValue **argv)
* the worksheet name, but they can't make any other changes to CELL?!
*/
} else if (!g_ascii_strcasecmp (info_type, "filename")) {
char *name = workbook_get_filename_utf8 (ei->pos->sheet->workbook, FALSE);
char *name = workbook_get_uri (ei->pos->sheet->workbook);
if (name == NULL)
return value_new_string ("");
......
......@@ -315,7 +315,9 @@ static gboolean
cb_workbook_name (Workbook * wb, gpointer closure)
{
struct wb_name_closure *dat = closure;
if (0 == strcmp (wb->filename, dat->name)) {
const char *wb_uri = workbook_get_uri (wb);
if (wb_uri && strcmp (wb_uri, dat->name) == 0) {
dat->wb = wb;
return FALSE;
}
......@@ -420,46 +422,36 @@ gnm_app_history_get_list (gboolean force_reload)
/**
* application_history_update_list:
* @filename:
* @uri:
*
* Adds @filename to the application's history of files.
* Adds @uri to the application's history of files.
**/
void
gnm_app_history_add (char const *filename)
gnm_app_history_add (char const *uri)
{
char *canonical_name;
gint max_entries;
GSList *exists;
GSList **ptr;
g_return_if_fail (filename != NULL);
g_return_if_fail (uri != NULL);
g_return_if_fail (app != NULL);
/* Rudimentary filename canonicalization. */
if (!g_path_is_absolute (filename)) {
char *cwd = g_get_current_dir ();
canonical_name = g_strconcat (cwd, "/", filename, NULL);
g_free (cwd);
} else
canonical_name = g_strdup (filename);
/* force a reload in case max_entries has changed */
gnm_app_history_get_list (TRUE);
exists = g_slist_find_custom (app->history_list,
canonical_name, g_str_compare);
uri, g_str_compare);
if (exists != NULL) {
/* its already the top of the stack no need to do anything */
if (exists == app->history_list) {
g_free (canonical_name);
if (exists == app->history_list)
return;
}
/* remove the other instance */
g_free (exists->data);
app->history_list = g_slist_remove (app->history_list, exists->data);
g_free (exists->data);
}
app->history_list = g_slist_prepend (app->history_list, canonical_name);
app->history_list = g_slist_prepend (app->history_list, g_strdup (uri));
/* clip the list if it is too long */
max_entries = gnm_app_prefs->file_history_max;
......
2004-06-11 Morten Welinder <terra@gnome.org>
* utils/go-file.c: New file.
2004-06-11 Emmanuel Pacaud <emmanuel.pacaud@univ-poitiers.fr>
* graph/gog-axis-prefs.glade : add a combobox for map selection.
......
......@@ -4,6 +4,8 @@ libgoffice_utils_la_SOURCES = \
goffice-utils.h \
go-color.c \
go-color.h \
go-file.c \
go-file.h \
go-font.c \
go-font.h \
go-format.c \
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* go-file.c :
*
* Copyright (C) 2004 Morten Welinder (terra@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include <goffice/goffice-config.h>
#include "go-file.h"
#include <gsf/gsf-input-memory.h>
#include <gsf/gsf-input-stdio.h>
#ifdef WITH_GNOME
#include <libgnomevfs/gnome-vfs-utils.h>
#include <gsf-gnome/gsf-input-gnomevfs.h>
#endif
/* ------------------------------------------------------------------------- */
char *
go_filename_from_uri (const char *uri)
{
#ifdef WITH_GNOME
return gnome_vfs_get_local_path_from_uri (uri);
#else
return g_filename_from_uri (uri, NULL, NULL);
#endif
}
char *
go_filename_to_uri (const char *filename)
{
if (g_path_is_absolute (filename)) {
/* FIXME: Resolve ".." and "." parts. */
#ifdef WITH_GNOME
return gnome_vfs_get_uri_from_local_path (filename);
#else
return g_filename_to_uri (uri, NULL, NULL);
#endif
} else {
char *result;
char *current_dir = g_get_current_dir ();
gsize clen = strlen (current_dir);
char *abs_filename =
g_strconcat (current_dir,
(clen && current_dir[clen - 1] == G_DIR_SEPARATOR
? ""
: G_DIR_SEPARATOR_S),
filename,
NULL);
g_return_val_if_fail (g_path_is_absolute (abs_filename), NULL);
result = go_filename_to_uri (abs_filename);
g_free (current_dir);
g_free (abs_filename);
return result;
}
}
char *
go_shell_arg_to_uri (const char *arg)
{
#ifdef WITH_GNOME
return gnome_vfs_make_uri_from_shell_arg (arg);
#else
if (g_path_is_absolute (arg))
return go_filename_to_uri (arg);
else {
/* See if it's a file: uri. */
char *tmp = go_filename_from_uri (arg);
if (tmp) {
g_free (tmp);
return g_strdup (arg);
}
}
/* Just assume it's a filename. */
return go_filename_to_uri (arg);
#endif
}
/* ------------------------------------------------------------------------- */
static GsfInput *
open_plain_file (const char *path, GError **err)
{
GsfInputMemory *in_mem;
GsfInputStdio *in_stdio;
in_mem = gsf_input_mmap_new (path, NULL);
if (in_mem != NULL)
return GSF_INPUT (in_mem);
/* Only report error if stdio fails too */
in_stdio = gsf_input_stdio_new (path, err);
return in_stdio ? GSF_INPUT (in_stdio) : NULL;
}
/**
* go_file_open :
* @uri :
* @err : #GError
*
* Try all available methods to open a file or return an error
**/
GsfInput *
go_file_open (char const *uri, GError **err)
{
char *filename;
if (err != NULL)
*err = NULL;
g_return_val_if_fail (uri != NULL, NULL);
if (uri[0] == G_DIR_SEPARATOR) {
g_warning ("Got plain filename %s in go_file_open.", uri);
return open_plain_file (uri, err);
}
filename = go_filename_from_uri (uri);
if (filename) {
GsfInput *result = open_plain_file (filename, err);
g_free (filename);
return result;
}
#ifdef WITH_GNOME
return (GsfInput *)gsf_input_gnomevfs_new (uri, err);
#else
g_set_error (err, gsf_input_error (), 0,
"Invalid or non-supported URI");
return NULL;
#endif
}
/* ------------------------------------------------------------------------- */
/*
* go-file.h :
*
* Copyright (C) 2004 Morten Welinder (terra@gnome.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#ifndef GO_FILE_H
#define GO_FILE_H
#include <glib.h>
#include <gsf/gsf.h>
G_BEGIN_DECLS
char *go_filename_from_uri (const char *uri);
char *go_filename_to_uri (const char *filename);
char *go_shell_arg_to_uri (const char *arg);
GsfInput *go_file_open (char const *uri, GError **err);
G_END_DECLS
#endif /* GO_FILE_H */
......@@ -69,17 +69,15 @@ dialog_autosave_prompt (WorkbookControlGUI *wbcg)
{
gint result;
GtkWidget *dialog;
char *filename_utf8;
const char *uri;
filename_utf8 = workbook_get_filename_utf8 (wb_control_workbook
(WORKBOOK_CONTROL (wbcg)), FALSE);
uri = workbook_get_uri (wb_control_workbook (WORKBOOK_CONTROL (wbcg)));
dialog = gtk_message_dialog_new (wbcg_toplevel (wbcg),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
_("Do you want to save the workbook %s ?"),
filename_utf8);
g_free (filename_utf8);
uri);
result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
......
......@@ -668,7 +668,7 @@ cb_rotate_canvas_realize (GnomeCanvas *canvas, FormatState *state)
gnm_app_display_dpi_get (TRUE),
gnm_app_display_dpi_get (FALSE));
context = pango_ft2_font_map_create_context (font_map);
g_object_unref (font_map);
// g_object_unref (font_map);
layout = pango_layout_new (context);
g_object_unref (context);
pango_layout_set_font_description (layout,
......@@ -682,7 +682,11 @@ cb_rotate_canvas_realize (GnomeCanvas *canvas, FormatState *state)
pango_layout_set_attributes (layout, attrs);
pango_attr_list_unref (attrs);
#if 0
w = h = 1;
#else
pango_layout_get_pixel_size (layout, &w, &h);
#endif
if (w == 0 || h == 0) {
g_object_unref (layout);
......@@ -697,7 +701,7 @@ cb_rotate_canvas_realize (GnomeCanvas *canvas, FormatState *state)
ft_bitmap.palette_mode = 0;
ft_bitmap.palette = NULL;
#if 0
#if 1
pango_ft2_render_layout (&ft_bitmap, layout, 0, 0);
#endif
g_object_unref (layout);
......@@ -724,6 +728,12 @@ cb_rotate_canvas_realize (GnomeCanvas *canvas, FormatState *state)
state->align.rot_width = w;
state->align.rot_height = h;
cb_rotate_changed (NULL, state);
#if 0
/* This prevents leaks, but isn't public. */
pango_fc_font_map_cache_clear (font_map);
#endif
g_object_unref (font_map);
}
static void
......
......@@ -134,11 +134,8 @@ dialog_summary_put (SummaryState *state)
g_free (txt);
}
w = glade_xml_get_widget (state->gui, "doc_name");
if (w) {
char *filename_utf8 = workbook_get_filename_utf8 (wb, FALSE);
gtk_entry_set_text (GTK_ENTRY (w), filename_utf8);
g_free (filename_utf8);
}
if (w)
gtk_entry_set_text (GTK_ENTRY (w), workbook_get_uri (wb));
}
static void
......
......@@ -26,14 +26,10 @@
#include <gsf/gsf-output.h>
#include <gsf/gsf-output-stdio.h>
#include <gsf/gsf-impl-utils.h>
#include <gsf/gsf-input-memory.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-output-stdio.h>
#include <gsf/gsf-utils.h>
#ifdef WITH_GNOME
#include <gsf-gnome/gsf-input-gnomevfs.h>
#endif
#include <string.h>
#include <goffice/utils/go-file.h>
static void
gnm_file_opener_init (GnmFileOpener *fo)
......@@ -251,7 +247,7 @@ gnm_file_opener_probe (GnmFileOpener const *fo, GsfInput *input, FileProbeLevel
* @opt_enc : Optional encoding
* @io_context : Context for i/o operation
* @wbv : Workbook View
* @file_name : File name
* @input : Gsf input stream
*
* Reads content of @file_name file into workbook @wbv is attached to.
* Results are reported using @io_context object, use
......@@ -264,12 +260,21 @@ gnm_file_opener_open (GnmFileOpener const *fo, gchar const *opt_enc,
IOContext *io_context,
WorkbookView *wbv, GsfInput *input)
{
const char *input_name;
g_return_if_fail (IS_GNM_FILE_OPENER (fo));
g_return_if_fail (GSF_IS_INPUT (input));
if (NULL != gsf_input_name (input))
workbook_set_filename (wb_view_workbook (wbv),
gsf_input_name (input));
input_name = gsf_input_name (input);
if (input_name) {
/*
* When we open a file, the input get a name that is its
* absolute filename.
*/
char *uri = go_shell_arg_to_uri (input_name);
workbook_set_uri (wb_view_workbook (wbv), uri);
g_free (uri);
}
GNM_FILE_OPENER_METHOD (fo, open) (fo, opt_enc, io_context, wbv, input);
}
......@@ -889,42 +894,3 @@ get_file_openers (void)
{
return file_opener_list;
}
/**
* go_file_open :
* @path :
* @err : #GError
*
* Try all available methods to open a file or return an error
**/
#warning this belongs in gsf
GsfInput *
go_file_open (char const *path, GError **err)
{
GsfInputMemory *in_mem;
GsfInputStdio *in_stdio;
if (err != NULL)
*err = NULL;
in_mem = gsf_input_mmap_new (path, NULL);
if (in_mem != NULL)
return GSF_INPUT (in_mem);
/* Only report error if stdio fails too */
in_stdio = gsf_input_stdio_new (path, err);
if (in_stdio != NULL)
return GSF_INPUT (in_stdio);
#ifdef WITH_GNOME
{
GsfInputGnomeVFS *in_vfs;
g_error_free (*err);
*err = NULL;
in_vfs = gsf_input_gnomevfs_new (path, err);
if (in_vfs != NULL)
return GSF_INPUT (in_vfs);
}
#endif
return NULL;
}
......@@ -6,8 +6,6 @@
#include <gsf/gsf.h>
GsfInput *go_file_open (char const *path, GError **err);
/*
* File format levels. They are ordered. When we save a file, we
* remember the name, but not if we already have a name at a higher level.
......
......@@ -23,6 +23,7 @@
#include "workbook-priv.h"
#include "gnumeric-gconf.h"
#include "widgets/widget-charmap-selector.h"
#include <goffice/utils/go-file.h>
#include <gtk/gtkcombobox.h>
#include <gtk/gtklabel.h>
......@@ -91,7 +92,7 @@ make_format_chooser (GList *list, GtkComboBox *combo)
}
gboolean
gui_file_read (WorkbookControlGUI *wbcg, char const *file_name,
gui_file_read (WorkbookControlGUI *wbcg, char const *uri,
GnmFileOpener const *optional_format, gchar const *optional_encoding)
{
IOContext *io_context;
......@@ -99,8 +100,8 @@ gui_file_read (WorkbookControlGUI *wbcg, char const *file_name,
gnm_cmd_context_set_sensitive (GNM_CMD_CONTEXT (wbcg), FALSE);
io_context = gnumeric_io_context_new (GNM_CMD_CONTEXT (wbcg));
wbv = wb_view_new_from_file (file_name, optional_format, io_context,
optional_encoding);
wbv = wb_view_new_from_uri (uri, optional_format, io_context,
optional_encoding);
if (gnumeric_io_error_occurred (io_context) ||
gnumeric_io_warning_occurred (io_context))
......@@ -176,7 +177,7 @@ gui_file_open (WorkbookControlGUI *wbcg, char const *default_format)
file_format_changed_cb_data data;
gint opener_default;
char const *title;
char *file_name = NULL;
char *uri = NULL;
const char *encoding = NULL;
GnmFileOpener *fo = NULL;
......@@ -281,8 +282,7 @@ gui_file_open (WorkbookControlGUI *wbcg, char const *default_format)
if (!gnumeric_dialog_file_selection (wbcg, GTK_WIDGET (fsel)))
goto out;
/* NOTE: we get a filename here. Think about URIs later. */
file_name = gtk_file_chooser_get_filename (fsel);
uri = gtk_file_chooser_get_uri (fsel);
encoding = charmap_selector_get_encoding (CHARMAP_SELECTOR (charmap_selector));
fo = g_list_nth_data (openers, gtk_combo_box_get_active (format_combo));
......@@ -290,12 +290,12 @@ gui_file_open (WorkbookControlGUI *wbcg, char const *default_format)
gtk_widget_destroy (GTK_WIDGET (fsel));
g_list_free (openers);
if (file_name) {
if (uri) {
/* Make sure dialog goes away right now. */
while (g_main_context_iteration (NULL, FALSE));
gui_file_read (wbcg, file_name, fo, encoding);
g_free (file_name);
gui_file_read (wbcg, uri, fo, encoding);
g_free (uri);
}
}
......@@ -358,43 +358,44 @@ update_preview_cb (GtkFileChooser *chooser)
*
* FIXME: The message boxes should really be children of the file selector,
* not the workbook.
*
* Note: filename is filesys, not UTF-8 encoded.
*/
static gboolean
go_file_is_writable (char const *name, WorkbookControlGUI *wbcg)
go_file_is_writable (char const *uri, WorkbookControlGUI *wbcg)
{
gboolean result = TRUE;
gchar *msg;
char *filename_utf8 = name
? g_filename_to_utf8 (name, -1, NULL, NULL, NULL)
: NULL;
char *filename;
if (name == NULL || name[0] == '\0' || filename_utf8 == NULL)
if (uri == NULL || uri[0] == '\0')
result = FALSE;
else if (name [strlen (name) - 1] == G_DIR_SEPARATOR_S ||
g_file_test (name, G_FILE_TEST_IS_DIR)) {
msg = g_strdup_printf (_("%s\nis a directory name"), filename_utf8);
filename = go_filename_from_uri (uri);
if (!filename)
return TRUE; /* Just assume writable. */
if (filename [strlen (filename) - 1] == G_DIR_SEPARATOR ||
g_file_test (filename, G_FILE_TEST_IS_DIR)) {
msg = g_strdup_printf (_("%s\nis a directory name"), uri);
gnumeric_notice (wbcg, GTK_MESSAGE_ERROR, msg);
g_free (msg);
result = FALSE;
} else if (access (name, W_OK) != 0 && errno != ENOENT) {
} else if (access (filename, W_OK) != 0 && errno != ENOENT) {
msg = g_strdup_printf (
_("You do not have permission to save to\n%s"),
filename_utf8);
uri);
gnumeric_notice (wbcg, GTK_MESSAGE_ERROR, msg);
g_free (msg);
result = FALSE;
} else if (g_file_test (name, G_FILE_TEST_EXISTS)) {
} else if (g_file_test (filename, G_FILE_TEST_EXISTS)) {
msg = g_strdup_printf (
_("%s already exists.\n"
"Do you want to save over it?"), filename_utf8);
"Do you want to save over it?"), uri);
result = gnumeric_dialog_question_yes_no (
wbcg, msg, gnm_app_prefs->file_overwrite_default_answer);
g_free (msg);
}
g_free (filename_utf8);
g_free (filename);
return result;
}
......@@ -513,36 +514,31 @@ check_multiple_sheet_support_if_needed (GnmFileSaver *fs,
*/
static gboolean
do_save_as (WorkbookControlGUI *wbcg, WorkbookView *wb_view,
GnmFileSaver *fs, char const *name)
GnmFileSaver *fs, char const *uri1)
{
char *filename = NULL;
char *uri2 = NULL;
gboolean success = FALSE;
if (!gnm_file_saver_fix_file_name (fs, name, &filename) &&
if (!gnm_file_saver_fix_file_name (fs, uri1, &uri2) &&
!gnumeric_dialog_question_yes_no (wbcg,
_("The given file extension does not match the"
" chosen file type. Do you want to use this name"
" anyways?"), TRUE)) {
g_free (filename);
return FALSE;
}
" anyways?"), TRUE))
goto out;
if (!go_file_is_writable (filename, wbcg)) {
g_free (filename);
return FALSE;
}
success = go_file_is_writable (uri2, wbcg);
if (!success) goto out;
wb_view_preferred_size (wb_view, GTK_WIDGET (wbcg->notebook)->allocation.width,
GTK_WIDGET (wbcg->notebook)->allocation.height);
success = check_multiple_sheet_support_if_needed (fs, wbcg, wb_view);
if (!success) {
g_free (filename);
return FALSE;
}
if (!success) goto out;
success = wb_view_save_as (wb_view, fs, filename, GNM_CMD_CONTEXT (wbcg));
g_free (filename);
success = wb_view_save_as (wb_view, fs, uri2, GNM_CMD_CONTEXT (wbcg));
out:
g_free (uri2);
return success;