Commit e420e093 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Paolo Maggi

Fixes bug #311187:

2005-07-27  Federico Mena Quintero  <federico@ximian.com>

 	Fixes bug #311187:

 	* gedit-file-selector-util.c (gedit_file_selector_save): Take a
 	full URI instead of a basename for "default_filename"; actually,
 	renamed this argument to "default_uri".
 	(run_file_selector): Likewise.
 	(create_gtk_selector): Likewise.  Also, just call
 	gtk_file_chooser_set_uri() with the default_uri if it is
 	available.

 	* gedit-file.c (gedit_file_save_as): Use the document's raw URI if
 	we already have it and it is a file:/// URI --- don't split into
 	dirname and basename.
parent 1d4c1bd7
......@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)
AC_INIT(gedit, 2.10.2, http://bugzilla.gnome.org/enter_bug.cgi?product=gedit)
AC_INIT(gedit, 2.10.3, http://bugzilla.gnome.org/enter_bug.cgi?product=gedit)
AC_CONFIG_SRCDIR(gedit/gedit2.c)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
......
2005-07-27 Federico Mena Quintero <federico@ximian.com>
Fixes bug #311187:
* gedit-file-selector-util.c (gedit_file_selector_save): Take a
full URI instead of a basename for "default_filename"; actually,
renamed this argument to "default_uri".
(run_file_selector): Likewise.
(create_gtk_selector): Likewise. Also, just call
gtk_file_chooser_set_uri() with the default_uri if it is
available.
* gedit-file.c (gedit_file_save_as): Use the document's raw URI if
we already have it and it is a file:/// URI --- don't split into
dirname and basename.
2005-07-23 Paolo Borelli <pborelli@katamail.com>
* gedit-debug.h: fix printing the function name.
......
......@@ -312,7 +312,7 @@ create_gtk_selector (GtkWindow *parent,
FileselMode mode,
const char *title,
const char *default_path,
const char *default_filename,
const char *default_uri,
const char *untitled_name,
gboolean use_encoding,
const GeditEncoding *encoding)
......@@ -400,27 +400,16 @@ create_gtk_selector (GtkWindow *parent,
}
else
{
if (default_filename == NULL)
if (default_uri == NULL)
{
if (default_path != NULL)
{
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (filesel), default_path);
}
g_return_val_if_fail (untitled_name != NULL, GTK_WINDOW (filesel));
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filesel), untitled_name);
}
else
{
if (default_path != NULL)
{
gchar *uri;
uri = g_strconcat (default_path, "/", default_filename, NULL);
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (filesel), uri);
g_free (uri);
}
}
gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (filesel), default_uri);
}
if (mode == FILESEL_OPEN_MULTI)
......@@ -435,7 +424,7 @@ run_file_selector (GtkWindow *parent,
FileselMode mode,
const char *title,
const char *default_path,
const char *default_filename,
const char *default_uri,
const char *untitled_name,
const GeditEncoding **encoding)
......@@ -448,7 +437,7 @@ run_file_selector (GtkWindow *parent,
mode,
title,
default_path,
default_filename,
default_uri,
untitled_name,
(encoding != NULL),
(encoding != NULL) ? *encoding : NULL);
......@@ -541,12 +530,16 @@ gedit_file_selector_open_multi (GtkWindow *parent,
* @enable_vfs: if FALSE, restrict files to local paths.
* @title: optional window title to use
* @default_path: optional directory to start in (must be an URI)
* @default_filename: optional file name to default to
* @default_uri: optional URI to default to
* @untitled_name: optional untitled name (valid UTF-8)
*
* Creates and shows a modal save file dialog, waiting for the user to
* select a file or cancel before returning.
*
* If @default_uri is %NULL, then only @default_path and @untitled_name will be
* used. Otherwise, only the @default_uri will be used; the starting directory
* will correspond to the last directory component of that URI.
*
* Return value: the URI of the file selected, or NULL if cancel
* was pressed.
**/
......@@ -555,14 +548,14 @@ gedit_file_selector_save (GtkWindow *parent,
gboolean enable_vfs,
const char *title,
const char *default_path,
const char *default_filename,
const char *default_uri,
const char *untitled_name,
const GeditEncoding **encoding)
{
g_return_val_if_fail (((default_filename != NULL) && (untitled_name == NULL)) ||
((default_filename == NULL) && (untitled_name != NULL)), NULL);
g_return_val_if_fail (((default_uri != NULL) && (untitled_name == NULL)) ||
((default_uri == NULL) && (untitled_name != NULL)), NULL);
return run_file_selector (parent, enable_vfs, FILESEL_SAVE,
title ? title : _("Select a filename to save"),
default_path, default_filename, untitled_name, encoding);
default_path, default_uri, untitled_name, encoding);
}
......@@ -68,7 +68,7 @@ char *gedit_file_selector_save (GtkWindow *parent,
gboolean enable_vfs,
const char *title,
const char *default_path,
const char *default_filename,
const char *default_uri,
const char *untitled_name,
const GeditEncoding **encoding);
......
......@@ -306,7 +306,7 @@ gedit_file_save_as (GeditMDIChild *child)
gboolean ret = FALSE;
GeditDocument *doc;
GtkWidget *view;
gchar *fname = NULL;
gchar *uri = NULL;
gchar *untitled_name = NULL;
gchar *path = NULL;
const GeditEncoding *encoding;
......@@ -349,21 +349,19 @@ gedit_file_save_as (GeditMDIChild *child)
if (gedit_utils_uri_has_file_scheme (raw_uri))
{
fname = gedit_utils_uri_get_basename (raw_uri);
g_return_val_if_fail (fname != NULL, FALSE);
uri = raw_uri;
path = gedit_utils_uri_get_dirname (raw_uri);
}
else
{
g_free (raw_uri);
untitled_name = gedit_document_get_short_name (doc);
g_return_val_if_fail (untitled_name != NULL, FALSE);
path = (gedit_default_path != NULL) ?
g_strdup (gedit_default_path) : NULL;
}
g_free (raw_uri);
}
encoding = gedit_document_get_encoding (doc);
......@@ -373,11 +371,11 @@ gedit_file_save_as (GeditMDIChild *child)
FALSE,
_("Save as..."),
path,
fname,
uri,
untitled_name,
&encoding);
g_free (fname);
g_free (uri);
g_free (untitled_name);
g_free (path);
......
......@@ -371,7 +371,7 @@ get_language_from_abrev (const gchar *abrev)
{
const GeditLanguage *l = (const GeditLanguage *)langs->data;
if (g_ascii_strncasecmp (abrev, l->abrev, strlen(l->abrev)) == 0)
if (g_ascii_strncasecmp (abrev, l->abrev, strlen (l->abrev)) == 0)
return l;
langs = g_slist_next (langs);
......@@ -600,7 +600,7 @@ gedit_spell_checker_check_word (GeditSpellChecker *spell,
res = TRUE;
break;
default:
g_return_val_if_fail (FALSE, FALSE);
g_return_val_if_reached (FALSE);
}
return res;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment