[gedit/wip/loader-saver: 30/52] GeditDocument: remove GeditMountOperationFactory
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/loader-saver: 30/52] GeditDocument: remove GeditMountOperationFactory
- Date: Mon, 7 Jul 2014 15:12:54 +0000 (UTC)
commit cfd1e2f5e13012b5a40fe7ddab2b1cf50728eef5
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jun 27 14:02:10 2014 +0200
GeditDocument: remove GeditMountOperationFactory
It has been moved to GtkSourceFile.
gedit/gedit-document.c | 15 ---------------
gedit/gedit-document.h | 32 ++++++++++++--------------------
gedit/gedit-view-frame.c | 28 +++++++++++++++++++++-------
3 files changed, 33 insertions(+), 42 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 68b1bb0..24c95a2 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -72,10 +72,6 @@ struct _GeditDocumentPrivate
gboolean create; /* Create file if uri points
* to a non existing file */
- /* Mount operation factory */
- GeditMountOperationFactory mount_operation_factory;
- gpointer mount_operation_userdata;
-
guint readonly : 1;
guint externally_modified : 1;
guint deleted : 1;
@@ -1414,17 +1410,6 @@ gedit_document_get_compression_type (GeditDocument *doc)
return gtk_source_file_get_compression_type (doc->priv->file);
}
-void
-_gedit_document_set_mount_operation_factory (GeditDocument *doc,
- GeditMountOperationFactory callback,
- gpointer userdata)
-{
- g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
-
- doc->priv->mount_operation_factory = callback;
- doc->priv->mount_operation_userdata = userdata;
-}
-
#ifndef ENABLE_GVFS_METADATA
gchar *
gedit_document_get_metadata (GeditDocument *doc,
diff --git a/gedit/gedit-document.h b/gedit/gedit-document.h
index 49bde9e..ab9c818 100644
--- a/gedit/gedit-document.h
+++ b/gedit/gedit-document.h
@@ -5,6 +5,7 @@
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
* Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
* Copyright (C) 2002-2005 Paolo Maggi
+ * Copyright (C) 2014 Sébastien Wilmet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -77,6 +78,8 @@ GType gedit_document_get_type (void) G_GNUC_CONST;
GeditDocument *gedit_document_new (void);
+GtkSourceFile *gedit_document_get_file (GeditDocument *doc);
+
GFile *gedit_document_get_location (GeditDocument *doc);
void gedit_document_set_location (GeditDocument *doc,
GFile *location);
@@ -136,10 +139,13 @@ void gedit_document_set_metadata (GeditDocument *doc,
const gchar *first_key,
...);
-void gedit_document_set_search_context (GeditDocument *doc,
- GtkSourceSearchContext *search_context);
+void gedit_document_set_search_context
+ (GeditDocument *doc,
+ GtkSourceSearchContext *search_context);
-GtkSourceSearchContext *gedit_document_get_search_context (GeditDocument *doc);
+GtkSourceSearchContext
+ *gedit_document_get_search_context
+ (GeditDocument *doc);
/* Non exported functions */
@@ -147,27 +153,13 @@ glong _gedit_document_get_seconds_since_last_save_or_load
(GeditDocument *doc);
/* Note: this is a sync stat: use only on local files */
-gboolean _gedit_document_check_externally_modified
+gboolean _gedit_document_check_externally_modified
(GeditDocument *doc);
gboolean _gedit_document_needs_saving (GeditDocument *doc);
-/**
- * GeditMountOperationFactory: (skip)
- * @doc:
- * @userdata:
- */
-typedef GMountOperation *(*GeditMountOperationFactory)(GeditDocument *doc,
- gpointer userdata);
-
-void _gedit_document_set_mount_operation_factory
- (GeditDocument *doc,
- GeditMountOperationFactory callback,
- gpointer userdata);
-
-gboolean _gedit_document_get_empty_search (GeditDocument *doc);
-
-GtkSourceFile *gedit_document_get_file (GeditDocument *doc);
+gboolean _gedit_document_get_empty_search
+ (GeditDocument *doc);
G_END_DECLS
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index 92acc6a..8434705 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -103,11 +103,15 @@ static void
gedit_view_frame_dispose (GObject *object)
{
GeditViewFrame *frame = GEDIT_VIEW_FRAME (object);
+ GtkTextBuffer *buffer = NULL;
- if (frame->priv->start_mark != NULL && frame->priv->view != NULL)
+ if (frame->priv->view != NULL)
{
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (frame->priv->view));
+ }
+ if (frame->priv->start_mark != NULL && buffer != NULL)
+ {
gtk_text_buffer_delete_mark (buffer, frame->priv->start_mark);
frame->priv->start_mark = NULL;
}
@@ -130,6 +134,12 @@ gedit_view_frame_dispose (GObject *object)
frame->priv->remove_entry_tag_timeout_id = 0;
}
+ if (buffer != NULL)
+ {
+ GtkSourceFile *file = gedit_document_get_file (GEDIT_DOCUMENT (buffer));
+ gtk_source_file_set_mount_operation_factory (file, NULL, NULL, NULL);
+ }
+
g_clear_object (&frame->priv->entry_tag);
g_clear_object (&frame->priv->search_settings);
g_clear_object (&frame->priv->old_search_settings);
@@ -1449,11 +1459,11 @@ gedit_view_frame_class_init (GeditViewFrameClass *klass)
}
static GMountOperation *
-view_frame_mount_operation_factory (GeditDocument *doc,
+view_frame_mount_operation_factory (GtkSourceFile *file,
gpointer user_data)
{
- GtkWidget *frame = user_data;
- GtkWidget *window = gtk_widget_get_toplevel (frame);
+ GtkWidget *view_frame = user_data;
+ GtkWidget *window = gtk_widget_get_toplevel (view_frame);
return gtk_mount_operation_new (GTK_WINDOW (window));
}
@@ -1462,6 +1472,7 @@ static void
gedit_view_frame_init (GeditViewFrame *frame)
{
GeditDocument *doc;
+ GtkSourceFile *file;
GdkRGBA transparent = {0, 0, 0, 0};
frame->priv = gedit_view_frame_get_instance_private (frame);
@@ -1471,9 +1482,12 @@ gedit_view_frame_init (GeditViewFrame *frame)
gtk_widget_override_background_color (GTK_WIDGET (frame), 0, &transparent);
doc = gedit_view_frame_get_document (frame);
- _gedit_document_set_mount_operation_factory (doc,
+ file = gedit_document_get_file (doc);
+
+ gtk_source_file_set_mount_operation_factory (file,
view_frame_mount_operation_factory,
- frame);
+ frame,
+ NULL);
frame->priv->entry_tag = gd_tagged_entry_tag_new ("");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]