[gedit/wip/loader-saver] Adapt for the removal of the GtkSourceFileLoader:location property
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/loader-saver] Adapt for the removal of the GtkSourceFileLoader:location property
- Date: Mon, 7 Jul 2014 19:29:02 +0000 (UTC)
commit e5de5014f6dce7414f323d7f105244ae8b2e2122
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jul 7 21:27:42 2014 +0200
Adapt for the removal of the GtkSourceFileLoader:location property
gedit/gedit-tab.c | 40 +++++++++++++++++-----------------------
1 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 99e2363..2378a3f 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -613,6 +613,7 @@ io_loading_error_info_bar_response (GtkWidget *info_bar,
GeditTab *tab)
{
GeditView *view;
+ GtkSourceFile *file;
GFile *location;
const GtkSourceEncoding *encoding;
@@ -620,7 +621,8 @@ io_loading_error_info_bar_response (GtkWidget *info_bar,
view = gedit_tab_get_view (tab);
- location = gtk_source_file_loader_get_location (tab->priv->loader);
+ file = gtk_source_file_loader_get_file (tab->priv->loader);
+ location = gtk_source_file_get_location (file);
switch (response_id)
{
@@ -1696,10 +1698,16 @@ load_cb (GtkSourceFileLoader *loader,
GAsyncResult *result,
GeditTab *tab)
{
- GeditDocument *doc = gedit_tab_get_document (tab);
- GFile *location = gtk_source_file_loader_get_location (loader);
+ GeditDocument *doc;
+ GtkSourceFile *file;
+ GFile *location;
GError *error = NULL;
+ doc = gedit_tab_get_document (tab);
+
+ file = gtk_source_file_loader_get_file (loader);
+ location = gtk_source_file_get_location (file);
+
g_return_if_fail (tab->priv->state == GEDIT_TAB_STATE_LOADING ||
tab->priv->state == GEDIT_TAB_STATE_REVERTING);
@@ -1955,24 +1963,10 @@ load (GeditTab *tab,
gint column_pos)
{
GSList *candidate_encodings = NULL;
- GtkSourceFile *file;
- GFile *location;
GeditDocument *doc;
g_return_if_fail (GTK_SOURCE_IS_FILE_LOADER (tab->priv->loader));
- file = gtk_source_file_loader_get_file (tab->priv->loader);
- location = gtk_source_file_loader_get_location (tab->priv->loader);
-
- /* Sets the location directly, before launching the actual load, so
- * GeditDocument functions relying on the location work correctly (e.g.
- * get the metadata encoding with gedit_document_get_metadata(), used in
- * get_candidate_encodings()).
- * The previous location is anyway not needed, even if the load fails,
- * since the buffer contents is first removed.
- */
- gtk_source_file_set_location (file, location);
-
if (encoding != NULL)
{
tab->priv->user_requested_encoding = TRUE;
@@ -2029,15 +2023,15 @@ _gedit_tab_load (GeditTab *tab,
doc = gedit_tab_get_document (tab);
file = gedit_document_get_file (doc);
+ gtk_source_file_set_location (file, location);
+
if (tab->priv->loader != NULL)
{
g_warning ("GeditTab: file loader already exists.");
g_object_unref (tab->priv->loader);
}
- tab->priv->loader = gtk_source_file_loader_new (GTK_SOURCE_BUFFER (doc),
- file,
- location);
+ tab->priv->loader = gtk_source_file_loader_new (GTK_SOURCE_BUFFER (doc), file);
_gedit_document_set_create (doc, create);
@@ -2063,6 +2057,8 @@ _gedit_tab_load_stream (GeditTab *tab,
doc = gedit_tab_get_document (tab);
file = gedit_document_get_file (doc);
+ gtk_source_file_set_location (file, NULL);
+
if (tab->priv->loader != NULL)
{
g_warning ("GeditTab: file loader already exists.");
@@ -2107,9 +2103,7 @@ _gedit_tab_revert (GeditTab *tab)
g_object_unref (tab->priv->loader);
}
- tab->priv->loader = gtk_source_file_loader_new (GTK_SOURCE_BUFFER (doc),
- file,
- location);
+ tab->priv->loader = gtk_source_file_loader_new (GTK_SOURCE_BUFFER (doc), file);
load (tab, NULL, 0, 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]