rendered paste bodyIndex: bindings/python/gedit.defs
===================================================================
RCS file: /cvs/gnome/gedit/bindings/python/gedit.defs,v
retrieving revision 1.5
diff -u -p -r1.5 gedit.defs
--- bindings/python/gedit.defs 19 Jan 2006 18:15:59 -0000 1.5
+++ bindings/python/gedit.defs 19 Feb 2006 15:50:14 -0000
@@ -205,7 +205,7 @@
(define-method load
(of-object "GeditDocument")
(c-name "gedit_document_load")
- (return-type "gboolean")
+ (return-type "none")
(parameters
'("const-gchar*" "uri")
'("const-GeditEncoding*" "encoding")
Index: gedit/gedit-commands-file.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-commands-file.c,v
retrieving revision 1.3
diff -u -p -r1.3 gedit-commands-file.c
--- gedit/gedit-commands-file.c 3 Jan 2006 17:19:10 -0000 1.3
+++ gedit/gedit-commands-file.c 19 Feb 2006 15:50:17 -0000
@@ -107,36 +107,34 @@ load_file_list (GeditWindow *win
gboolean ret;
uri = (const gchar *)uris->data;
- ret = _gedit_tab_load (tab,
- uri,
- encoding,
- line_pos,
- create);
+
+ _gedit_tab_load (tab,
+ uri,
+ encoding,
+ line_pos,
+ create);
uris = g_slist_next (uris);
jump_to = FALSE;
- if (ret)
+ if (uris == NULL)
{
- if (uris == NULL)
- {
- /* There is only a single file to load */
- gchar *uri_for_display;
-
- uri_for_display = gnome_vfs_format_uri_for_display (uri);
+ /* There is only a single file to load */
+ gchar *uri_for_display;
- gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
- window->priv->generic_message_cid,
- _("Loading file '%s'\342\200\246"),
- uri_for_display);
+ uri_for_display = gnome_vfs_format_uri_for_display (uri);
- g_free (uri_for_display);
+ gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
+ window->priv->generic_message_cid,
+ _("Loading file '%s'\342\200\246"),
+ uri_for_display);
- flash = FALSE;
- }
+ g_free (uri_for_display);
- ++loaded_files;
+ flash = FALSE;
}
+
+ ++loaded_files;
}
}
Index: gedit/gedit-document-loader.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-document-loader.c,v
retrieving revision 1.4
diff -u -p -r1.4 gedit-document-loader.c
--- gedit/gedit-document-loader.c 16 Jan 2006 18:03:44 -0000 1.4
+++ gedit/gedit-document-loader.c 19 Feb 2006 15:50:19 -0000
@@ -877,23 +877,47 @@ load_remote_file (GeditDocumentLoader *l
/* ---------- public api ---------- */
+static gboolean
+vfs_uri_new_failed (GeditDocumentLoader *loader)
+{
+ load_completed_or_failed (loader);
+
+ /* stop the timeout */
+ return FALSE;
+}
+
/* If enconding == NULL, the encoding will be autodetected */
-gboolean
+void
gedit_document_loader_load (GeditDocumentLoader *loader,
const gchar *uri,
const GeditEncoding *encoding)
{
gchar *local_path;
- g_return_val_if_fail (GEDIT_IS_DOCUMENT_LOADER (loader), FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
+
+ g_return_if_fail (GEDIT_IS_DOCUMENT_LOADER (loader));
+ g_return_if_fail (uri != NULL);
/* the loader can be used just once, then it must be thrown away */
- g_return_val_if_fail (loader->priv->used == FALSE, FALSE);
+ g_return_if_fail (loader->priv->used == FALSE);
loader->priv->used = TRUE;
+ /* vfs_uri may be NULL for some valid but unsupported uris */
loader->priv->vfs_uri = gnome_vfs_uri_new (uri);
if (loader->priv->vfs_uri == NULL)
- return FALSE;
+ {
+ g_set_error (&loader->priv->error,
+ GEDIT_DOCUMENT_ERROR,
+ GNOME_VFS_ERROR_NOT_SUPPORTED,
+ gnome_vfs_result_to_string (GNOME_VFS_ERROR_NOT_SUPPORTED));
+
+ g_timeout_add_full (G_PRIORITY_HIGH,
+ 0,
+ (GSourceFunc) vfs_uri_new_failed,
+ loader,
+ NULL);
+
+ return;
+ }
loader->priv->encoding = encoding;
@@ -909,8 +933,6 @@ gedit_document_loader_load (GeditDocumen
{
load_remote_file (loader);
}
-
- return TRUE;
}
/* Returns STDIN_URI if loading from stdin */
Index: gedit/gedit-document-loader.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-document-loader.h,v
retrieving revision 1.2
diff -u -p -r1.2 gedit-document-loader.h
--- gedit/gedit-document-loader.h 12 Dec 2005 17:27:55 -0000 1.2
+++ gedit/gedit-document-loader.h 19 Feb 2006 15:50:20 -0000
@@ -85,7 +85,7 @@ GType gedit_document_loader_get_typ
GeditDocumentLoader *gedit_document_loader_new (GeditDocument *doc);
/* If enconding == NULL, the encoding will be autodetected */
-gboolean gedit_document_loader_load (GeditDocumentLoader *loader,
+void gedit_document_loader_load (GeditDocumentLoader *loader,
const gchar *uri,
const GeditEncoding *encoding);
#if 0
Index: gedit/gedit-document.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-document.c,v
retrieving revision 1.129
diff -u -p -r1.129 gedit-document.c
--- gedit/gedit-document.c 12 Feb 2006 22:02:04 -0000 1.129
+++ gedit/gedit-document.c 19 Feb 2006 15:50:24 -0000
@@ -675,8 +675,9 @@ set_uri (GeditDocument *doc,
if (doc->priv->vfs_uri != NULL)
gnome_vfs_uri_unref (doc->priv->vfs_uri);
+ /* Note: vfs_uri may be NULL for some valid but
+ * unsupported uris */
doc->priv->vfs_uri = gnome_vfs_uri_new (uri);
- g_return_if_fail (doc->priv->vfs_uri != NULL);
if (doc->priv->untitled_number > 0)
{
@@ -685,8 +686,6 @@ set_uri (GeditDocument *doc,
}
}
- g_return_if_fail (doc->priv->vfs_uri != NULL);
-
g_free (doc->priv->mime_type);
if (mime_type != NULL)
{
@@ -694,10 +693,11 @@ set_uri (GeditDocument *doc,
}
else
{
- gchar *base_name;
+ gchar *base_name = NULL;
/* Guess the mime type from file extension or fallback to "text/plain" */
- base_name = gnome_vfs_uri_extract_short_path_name (doc->priv->vfs_uri);
+ if (doc->priv->vfs_uri != NULL)
+ base_name = gnome_vfs_uri_extract_short_path_name (doc->priv->vfs_uri);
if (base_name != NULL)
{
const gchar *detected_mime;
@@ -708,13 +708,13 @@ set_uri (GeditDocument *doc,
detected_mime = "text/plain";
doc->priv->mime_type = g_strdup (detected_mime);
+
+ g_free (base_name);
}
else
{
doc->priv->mime_type = g_strdup ("text/plain");
}
-
- g_free (base_name);
}
if (!doc->priv->language_set_by_user)
@@ -785,6 +785,7 @@ get_uri_shortname_for_display (GnomeVFSU
gboolean validated;
validated = FALSE;
+
name = gnome_vfs_uri_extract_short_name (uri);
if (name == NULL)
@@ -853,6 +854,8 @@ gedit_document_get_short_name_for_displa
if (doc->priv->uri == NULL)
return g_strdup_printf (_("Unsaved Document %d"),
doc->priv->untitled_number);
+ else if (doc->priv->vfs_uri == NULL)
+ return g_strdup (doc->priv->uri);
else
return get_uri_shortname_for_display (doc->priv->vfs_uri);
}
@@ -1024,18 +1027,18 @@ document_loader_loading (GeditDocumentLo
}
}
-gboolean
+void
gedit_document_load (GeditDocument *doc,
const gchar *uri,
const GeditEncoding *encoding,
gint line_pos,
gboolean create)
{
- g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
- g_return_val_if_fail (gedit_utils_is_valid_uri (uri), FALSE);
+ g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
+ g_return_if_fail (uri != NULL);
+ g_return_if_fail (gedit_utils_is_valid_uri (uri));
- g_return_val_if_fail (doc->priv->loader == NULL, FALSE);
+ g_return_if_fail (doc->priv->loader == NULL);
/* create a loader. It will be destroyed when loading is completed */
doc->priv->loader = gedit_document_loader_new (doc);
@@ -1051,9 +1054,9 @@ gedit_document_load (GeditDocument
set_uri (doc, uri, NULL);
- return gedit_document_loader_load (doc->priv->loader,
- uri,
- encoding);
+ gedit_document_loader_load (doc->priv->loader,
+ uri,
+ encoding);
}
gboolean
@@ -1224,7 +1227,7 @@ gedit_document_get_deleted (GeditDocumen
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
- if (doc->priv->uri == NULL)
+ if (doc->priv->uri == NULL || doc->priv->vfs_uri == NULL)
return FALSE;
return !gnome_vfs_uri_exists (doc->priv->vfs_uri);
Index: gedit/gedit-document.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-document.h,v
retrieving revision 1.45
diff -u -p -r1.45 gedit-document.h
--- gedit/gedit-document.h 19 Jan 2006 18:16:00 -0000 1.45
+++ gedit/gedit-document.h 19 Feb 2006 15:50:26 -0000
@@ -154,12 +154,12 @@ gchar *gedit_document_get_mime_type (G
gboolean gedit_document_get_readonly (GeditDocument *doc);
-gboolean gedit_document_load (GeditDocument *doc,
- const gchar *uri,
+void gedit_document_load (GeditDocument *doc,
+ const gchar *uri,
const GeditEncoding *encoding,
gint line_pos,
gboolean create);
-
+
gboolean gedit_document_insert_file (GeditDocument *doc,
GtkTextIter *iter,
const gchar *uri,
Index: gedit/gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v
retrieving revision 1.7
diff -u -p -r1.7 gedit-tab.c
--- gedit/gedit-tab.c 13 Feb 2006 00:15:26 -0000 1.7
+++ gedit/gedit-tab.c 19 Feb 2006 15:50:30 -0000
@@ -1450,17 +1450,11 @@ _gedit_tab_new_from_uri (const gchar
tab = GEDIT_TAB (_gedit_tab_new ());
- ret = _gedit_tab_load (tab,
- uri,
- encoding,
- line_pos,
- create);
-
- if (!ret)
- {
- g_object_unref (tab);
- return NULL;
- }
+ _gedit_tab_load (tab,
+ uri,
+ encoding,
+ line_pos,
+ create);
return GTK_WIDGET (tab);
}
@@ -1768,7 +1762,7 @@ gedit_tab_get_from_document (GeditDocume
return (res != NULL) ? GEDIT_TAB (res) : NULL;
}
-gboolean
+void
_gedit_tab_load (GeditTab *tab,
const gchar *uri,
const GeditEncoding *encoding,
@@ -1791,11 +1785,11 @@ _gedit_tab_load (GeditTab *ta
if (tab->priv->auto_save_timeout > 0)
remove_auto_save_timeout (tab);
- return gedit_document_load (doc,
- uri,
- encoding,
- line_pos,
- create);
+ gedit_document_load (doc,
+ uri,
+ encoding,
+ line_pos,
+ create);
}
void
Index: gedit/gedit-tab.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.h,v
retrieving revision 1.3
diff -u -p -r1.3 gedit-tab.h
--- gedit/gedit-tab.h 19 Jan 2006 18:16:00 -0000 1.3
+++ gedit/gedit-tab.h 19 Feb 2006 15:50:32 -0000
@@ -136,7 +136,7 @@ GtkWidget *_gedit_tab_new_from_uri (cons
gchar *_gedit_tab_get_name (GeditTab *tab);
gchar *_gedit_tab_get_tooltips (GeditTab *tab);
GdkPixbuf *_gedit_tab_get_icon (GeditTab *tab);
-gboolean _gedit_tab_load (GeditTab *tab,
+void _gedit_tab_load (GeditTab *tab,
const gchar *uri,
const GeditEncoding *encoding,
gint line_pos,