[gnome-builder] progress: IdeProgress should inherit from GObject
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] progress: IdeProgress should inherit from GObject
- Date: Wed, 8 Apr 2015 07:25:55 +0000 (UTC)
commit 50f4dc531972b8ae0caa7642d55d4ce7d146e4be
Author: Christian Hergert <christian hergert me>
Date: Tue Apr 7 23:54:53 2015 -0700
progress: IdeProgress should inherit from GObject
No need to inherit from IdeObject, the context is inconsequential.
libide/ide-buffer-manager.c | 14 ++++----------
libide/ide-progress.c | 16 +++++++++++-----
libide/ide-progress.h | 5 +++--
3 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index f0753d1..b57732f 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -30,6 +30,7 @@
#include "ide-doc-seq.h"
#include "ide-file.h"
#include "ide-file-settings.h"
+#include "ide-global.h"
#include "ide-internal.h"
#include "ide-progress.h"
#include "ide-source-location.h"
@@ -672,7 +673,6 @@ ide_buffer_manager_load_file_async (IdeBufferManager *self,
{
if (progress)
*progress = g_object_new (IDE_TYPE_PROGRESS,
- "context", context,
"fraction", 1.0,
NULL);
g_task_return_pointer (task, g_object_ref (buffer), g_object_unref);
@@ -684,9 +684,8 @@ ide_buffer_manager_load_file_async (IdeBufferManager *self,
state = g_slice_new0 (LoadState);
state->is_new = (buffer == NULL);
state->file = g_object_ref (file);
- state->progress = g_object_new (IDE_TYPE_PROGRESS,
- "context", context,
- NULL);
+ state->progress = ide_progress_new ();
+
if (buffer)
{
state->buffer = g_object_ref (buffer);
@@ -912,7 +911,6 @@ ide_buffer_manager_save_file_async (IdeBufferManager *self,
gpointer user_data)
{
g_autoptr(GTask) task = NULL;
- IdeContext *context;
SaveState *state;
if (progress)
@@ -925,14 +923,10 @@ ide_buffer_manager_save_file_async (IdeBufferManager *self,
task = g_task_new (self, cancellable, callback, user_data);
- context = ide_object_get_context (IDE_OBJECT (self));
-
state = g_slice_new0 (SaveState);
state->file = g_object_ref (file);
state->buffer = g_object_ref (buffer);
- state->progress = g_object_new (IDE_TYPE_PROGRESS,
- "context", context,
- NULL);
+ state->progress = ide_progress_new ();
g_task_set_task_data (task, state, save_state_free);
diff --git a/libide/ide-progress.c b/libide/ide-progress.c
index fe5d8c6..4fa74d5 100644
--- a/libide/ide-progress.c
+++ b/libide/ide-progress.c
@@ -24,14 +24,14 @@
struct _IdeProgress
{
- IdeObject parent_instance;
+ GObject parent_instance;
- gchar *message;
- gdouble fraction;
- guint completed : 1;
+ gchar *message;
+ gdouble fraction;
+ guint completed : 1;
};
-G_DEFINE_TYPE (IdeProgress, ide_progress, IDE_TYPE_OBJECT)
+G_DEFINE_TYPE (IdeProgress, ide_progress, G_TYPE_OBJECT)
enum {
PROP_0,
@@ -239,3 +239,9 @@ static void
ide_progress_init (IdeProgress *self)
{
}
+
+IdeProgress *
+ide_progress_new (void)
+{
+ return g_object_new (IDE_TYPE_PROGRESS, NULL);
+}
diff --git a/libide/ide-progress.h b/libide/ide-progress.h
index c61344c..1064b73 100644
--- a/libide/ide-progress.h
+++ b/libide/ide-progress.h
@@ -19,14 +19,15 @@
#ifndef IDE_PROGRESS_H
#define IDE_PROGRESS_H
-#include "ide-object.h"
+#include <glib-object.h>
G_BEGIN_DECLS
#define IDE_TYPE_PROGRESS (ide_progress_get_type())
-G_DECLARE_FINAL_TYPE (IdeProgress, ide_progress, IDE, PROGRESS, IdeObject)
+G_DECLARE_FINAL_TYPE (IdeProgress, ide_progress, IDE, PROGRESS, GObject)
+IdeProgress *ide_progress_new (void);
gdouble ide_progress_get_fraction (IdeProgress *self);
const gchar *ide_progress_get_message (IdeProgress *self);
void ide_progress_set_fraction (IdeProgress *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]