[gnome-builder/wip/project-selector] libide: IdeProgress should inherit from GObject
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/project-selector] libide: IdeProgress should inherit from GObject
- Date: Wed, 8 Apr 2015 06:37:59 +0000 (UTC)
commit 6caffcdd8925671bf6dd80b536a7bd6bbb89c44f
Author: Christian Hergert <christian hergert me>
Date: Tue Apr 7 23:37:09 2015 -0700
libide: IdeProgress should inherit from GObject
No need for it to be an IdeObject, the context is inconsequential.
libide/ide-buffer-manager.c | 13 +++----------
libide/ide-progress.c | 16 +++++++++++-----
libide/ide-progress.h | 5 +++--
3 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index 4873c59..b57732f 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -673,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);
@@ -685,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);
@@ -913,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)
@@ -926,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]