[gnome-builder] document: remove unneeded properties and funcs from document.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] document: remove unneeded properties and funcs from document.
- Date: Mon, 8 Sep 2014 06:27:38 +0000 (UTC)
commit a8fc952d343539b599168c1143034838e2d23991
Author: Christian Hergert <christian hergert me>
Date: Sun Sep 7 23:27:13 2014 -0700
document: remove unneeded properties and funcs from document.
This stuff will live outside of the document, in the editor tab using
newer GtkSourceView components like GtkSourceFile.
src/editor/gb-editor-document.c | 125 ++-------------------------------------
src/editor/gb-editor-document.h | 36 +-----------
2 files changed, 8 insertions(+), 153 deletions(-)
---
diff --git a/src/editor/gb-editor-document.c b/src/editor/gb-editor-document.c
index a86653f..e22d80a 100644
--- a/src/editor/gb-editor-document.c
+++ b/src/editor/gb-editor-document.c
@@ -16,30 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <glib/gi18n.h>
-
#include "gb-editor-document.h"
-struct _GbEditorDocumentPrivate
-{
- GFile *file;
-};
-
-enum {
- PROP_0,
- PROP_FILE,
- LAST_PROP
-};
-
enum {
CURSOR_MOVED,
LAST_SIGNAL
};
-G_DEFINE_TYPE_WITH_PRIVATE (GbEditorDocument, gb_editor_document, GTK_SOURCE_TYPE_BUFFER)
+G_DEFINE_TYPE (GbEditorDocument, gb_editor_document, GTK_SOURCE_TYPE_BUFFER)
-static GParamSpec * gParamSpecs[LAST_PROP];
-static guint gSignals[LAST_SIGNAL];
+static guint gSignals [LAST_SIGNAL];
GbEditorDocument *
gb_editor_document_new (void)
@@ -47,41 +33,6 @@ gb_editor_document_new (void)
return g_object_new (GB_TYPE_EDITOR_DOCUMENT, NULL);
}
-/**
- * gb_editor_document_get_file:
- * @document: A #GbEditorDocument.
- *
- * Returns the file backing the document.
- *
- * Returns: (transfer none): A #GFile.
- */
-GFile *
-gb_editor_document_get_file (GbEditorDocument *document)
-{
- g_return_val_if_fail (GB_IS_EDITOR_DOCUMENT (document), NULL);
-
- return document->priv->file;
-}
-
-void
-gb_editor_document_set_file (GbEditorDocument *document,
- GFile *file)
-{
- GbEditorDocumentPrivate *priv;
-
- g_return_if_fail (GB_IS_EDITOR_DOCUMENT (document));
- g_return_if_fail (!file || G_IS_FILE (file));
-
- priv = document->priv;
-
- g_clear_object (&priv->file);
-
- if (file)
- priv->file = g_object_ref (file);
-
- g_object_notify_by_pspec (G_OBJECT (document), gParamSpecs[PROP_FILE]);
-}
-
static void
gb_editor_document_mark_set (GtkTextBuffer *buffer,
const GtkTextIter *iter,
@@ -97,86 +48,22 @@ gb_editor_document_mark_set (GtkTextBuffer *buffer,
static void
gb_editor_document_changed (GtkTextBuffer *buffer)
{
+ g_assert (GB_IS_EDITOR_DOCUMENT (buffer));
+
g_signal_emit (buffer, gSignals[CURSOR_MOVED], 0);
GTK_TEXT_BUFFER_CLASS (gb_editor_document_parent_class)->changed (buffer);
}
static void
-gb_editor_document_finalize (GObject *object)
-{
- GbEditorDocumentPrivate *priv;
-
- priv = GB_EDITOR_DOCUMENT (object)->priv;
-
- g_clear_object (&priv->file);
-
- G_OBJECT_CLASS (gb_editor_document_parent_class)->finalize (object);
-}
-
-static void
-gb_editor_document_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GbEditorDocument *document = GB_EDITOR_DOCUMENT (object);
-
- switch (prop_id)
- {
- case PROP_FILE:
- g_value_set_object (value, gb_editor_document_get_file (document));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-gb_editor_document_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GbEditorDocument *document = GB_EDITOR_DOCUMENT (object);
-
- switch (prop_id)
- {
- case PROP_FILE:
- gb_editor_document_set_file (document, g_value_get_object (value));
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
gb_editor_document_class_init (GbEditorDocumentClass *klass)
{
- GObjectClass *object_class;
- GtkTextBufferClass *text_buffer_class;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkTextBufferClass *text_buffer_class = GTK_TEXT_BUFFER_CLASS (klass);
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = gb_editor_document_finalize;
- object_class->get_property = gb_editor_document_get_property;
- object_class->set_property = gb_editor_document_set_property;
-
- text_buffer_class = GTK_TEXT_BUFFER_CLASS (klass);
text_buffer_class->mark_set = gb_editor_document_mark_set;
text_buffer_class->changed = gb_editor_document_changed;
- gParamSpecs[PROP_FILE] =
- g_param_spec_object ("file",
- _ ("File"),
- _ ("The file backing the document."),
- G_TYPE_FILE,
- (G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class, PROP_FILE,
- gParamSpecs[PROP_FILE]);
-
gSignals[CURSOR_MOVED] =
g_signal_new ("cursor-moved",
G_OBJECT_CLASS_TYPE (object_class),
diff --git a/src/editor/gb-editor-document.h b/src/editor/gb-editor-document.h
index 513ab0d..2ba022a 100644
--- a/src/editor/gb-editor-document.h
+++ b/src/editor/gb-editor-document.h
@@ -50,40 +50,8 @@ struct _GbEditorDocumentClass
void (*cursor_moved) (GbEditorDocument *document);
};
-GbEditorDocument *gb_editor_document_new (void);
-GType gb_editor_document_get_type (void) G_GNUC_CONST;
-GFile *gb_editor_document_get_file (GbEditorDocument *document);
-void gb_editor_document_set_file (GbEditorDocument *document,
- GFile *file);
-void gb_editor_document_load_async (GbEditorDocument *document,
- GFile *file,
- GCancellable *cancellable,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean gb_editor_document_load_finish (GbEditorDocument *document,
- GAsyncResult *result,
- GError **error);
-void gb_editor_document_save_async (GbEditorDocument *document,
- GCancellable *cancellable,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean gb_editor_document_save_finish (GbEditorDocument *document,
- GAsyncResult *result,
- GError **error);
-void gb_editor_document_save_as_async (GbEditorDocument *document,
- GFile *file,
- GCancellable *cancellable,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean gb_editor_document_save_as_finish (GbEditorDocument *document,
- GAsyncResult *result,
- GError **error);
+GbEditorDocument *gb_editor_document_new (void);
+GType gb_editor_document_get_type (void) G_GNUC_CONST;
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]