[nautilus/wip/ernestask/tasks: 2/7] Add task manager
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/tasks: 2/7] Add task manager
- Date: Wed, 31 May 2017 12:30:12 +0000 (UTC)
commit 57b9e2a6d8972579bbb3df399ad67b4be56f0d19
Author: Ernestas Kulik <ernestask gnome org>
Date: Thu May 11 16:29:20 2017 +0300
Add task manager
src/meson.build | 2 +
src/nautilus-task-manager.c | 66 +++++++++++++++++++++++++++++++++++++++++++
src/nautilus-task-manager.h | 20 +++++++++++++
3 files changed, 88 insertions(+), 0 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 5f4b22b..9c31ffd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -258,6 +258,8 @@ libnautilus_sources = [
'nautilus-file-undo-manager.h',
'nautilus-task.c',
'nautilus-task.h',
+ 'nautilus-task-manager.c',
+ 'nautilus-task-manager.h'
]
if get_option ('enable-tracker')
diff --git a/src/nautilus-task-manager.c b/src/nautilus-task-manager.c
new file mode 100644
index 0000000..f3e383a
--- /dev/null
+++ b/src/nautilus-task-manager.c
@@ -0,0 +1,66 @@
+#include "nautilus-task-manager.h"
+
+struct _NautilusTaskManager
+{
+ GObject parent_instance;
+};
+
+G_DEFINE_TYPE (NautilusTaskManager, nautilus_task_manager, G_TYPE_OBJECT)
+
+static NautilusTaskManager *instance = NULL;
+
+static GObject *
+constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ static GMutex mutex;
+ GObjectClass *parent_class;
+
+ g_mutex_lock (&mutex);
+
+ if (instance != NULL)
+ {
+ return g_object_ref (instance);
+ }
+
+ parent_class = G_OBJECT_CLASS (nautilus_task_manager_parent_class);
+ instance = NAUTILUS_TASK_MANAGER (parent_class->constructor (type,
+ n_construct_properties,
+ construct_properties));
+
+ g_object_add_weak_pointer (G_OBJECT (instance), (gpointer *) &instance);
+
+ g_mutex_unlock (&mutex);
+
+ return G_OBJECT (instance);
+}
+
+static void
+nautilus_task_manager_init (NautilusTaskManager *self)
+{
+}
+
+static void
+nautilus_task_manager_class_init (NautilusTaskManagerClass *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructor = constructor;
+}
+
+void
+nautilus_task_manager_queue_task (NautilusTask *task,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+}
+
+NautilusTaskManager *
+nautilus_task_manager_dup_singleton (void)
+{
+ return g_object_new (NAUTILUS_TYPE_TASK_MANAGER, NULL);
+}
+
diff --git a/src/nautilus-task-manager.h b/src/nautilus-task-manager.h
new file mode 100644
index 0000000..7fa5ce3
--- /dev/null
+++ b/src/nautilus-task-manager.h
@@ -0,0 +1,20 @@
+#ifndef NAUTILUS_TASK_MANAGER_H
+#define NAUTILUS_TASK_MANAGER_H
+
+#include "nautilus-task.h"
+
+#include <glib-object.h>
+
+#define NAUTILUS_TYPE_TASK_MANAGER (nautilus_task_manager_get_type ())
+
+G_DECLARE_FINAL_TYPE (NautilusTaskManager, nautilus_task_manager,
+ NAUTILUS, TASK_MANAGER,
+ GObject)
+
+void nautilus_task_manager_queue_task (NautilusTask *task,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+NautilusTaskManager *nautilus_task_manager_dup_singleton (void);
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]