[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Workman-devel] [PATCH 5/7] Replace get_[persistent|active] with get_state



Replace workman_consumer_get_persistent() and
workman_consumer_get_active() with workman_object_get_state().  This is
more consistent with the rest of the API: using the WorkmanState enum
rather than exposing its enum values in the interfaces.

Also move get_state() up to the WorkmanObject parent class, since any
object can be persistent and/or active.
---
 workman/libworkman.sym     |  3 +--
 workman/workman-consumer.c | 15 ---------------
 workman/workman-consumer.h | 12 ++++--------
 workman/workman-object.c   |  9 +++++++++
 workman/workman-object.h   |  9 +++++++++
 5 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/workman/libworkman.sym b/workman/libworkman.sym
index fb97503..e1f6827 100644
--- a/workman/libworkman.sym
+++ b/workman/libworkman.sym
@@ -8,6 +8,7 @@ LIBworkman_0.0.1 {
         workman_object_get_type;
         workman_object_refresh_attributes;
         workman_object_save_attributes;
+        workman_object_get_state;
 
         workman_attribute_get_name;
         workman_attribute_get_type;
@@ -32,9 +33,7 @@ LIBworkman_0.0.1 {
         workman_partition_get_subdivisions;
         workman_partition_get_type;
 
-        workman_consumer_get_active;
         workman_consumer_get_partition;
-        workman_consumer_get_persistent;
         workman_consumer_get_processes;
         workman_consumer_get_type;
         workman_consumer_set_partition;
diff --git a/workman/workman-consumer.c b/workman/workman-consumer.c
index dc21a66..5f42694 100644
--- a/workman/workman-consumer.c
+++ b/workman/workman-consumer.c
@@ -74,21 +74,6 @@ WorkmanPartition *workman_consumer_get_partition(WorkmanConsumer *consumer,
 }
 
 
-gboolean workman_consumer_get_persistent(WorkmanConsumer *consumer,
-                                         GError **error)
-{
-    WorkmanConsumerClass *klass = WORKMAN_CONSUMER_GET_CLASS(consumer);
-    return klass->get_persistent(consumer, error);
-}
-
-gboolean workman_consumer_get_active(WorkmanConsumer *consumer,
-                                     GError **error)
-{
-    WorkmanConsumerClass *klass = WORKMAN_CONSUMER_GET_CLASS(consumer);
-    return klass->get_active(consumer, error);
-}
-
-
 /**
  * workman_consumer_get_processes:
  *
diff --git a/workman/workman-consumer.h b/workman/workman-consumer.h
index f483f57..cd2e613 100644
--- a/workman/workman-consumer.h
+++ b/workman/workman-consumer.h
@@ -59,6 +59,8 @@ struct _WorkmanConsumerClass
     /*< private >*/
     WorkmanObjectClass parent_class;
 
+
+    /* class members */
     WorkmanPartition *(*get_partition)(WorkmanConsumer *consumer,
                                        WorkmanState state,
                                        GError **error);
@@ -68,13 +70,12 @@ struct _WorkmanConsumerClass
                               GError **error);
     gboolean (*get_persistent)(WorkmanConsumer *consumer,
                                GError **error);
-    gboolean (*get_active)(WorkmanConsumer *consumer,
-                           GError **error);
 
     GList *(*get_processes)(WorkmanConsumer *consumer,
                             GError **error);
 
-    /* class members */
+
+    /* Remove from padding when adding new virtual functions */
     gpointer padding[20];
 };
 
@@ -90,11 +91,6 @@ WorkmanPartition *workman_consumer_get_partition(WorkmanConsumer *consumer,
                                                  WorkmanState state,
                                                  GError **error);
 
-gboolean workman_consumer_get_persistent(WorkmanConsumer *consumer,
-                                         GError **error);
-gboolean workman_consumer_get_active(WorkmanConsumer *consumer,
-                                     GError **error);
-
 GList *workman_consumer_get_processes(WorkmanConsumer *consumer,
                                       GError **error);
 
diff --git a/workman/workman-object.c b/workman/workman-object.c
index f1c85cc..de504c2 100644
--- a/workman/workman-object.c
+++ b/workman/workman-object.c
@@ -115,6 +115,15 @@ gboolean workman_object_save_attributes(WorkmanObject *obj,
     return klass->save_attributes(obj, state, error);
 }
 
+
+WorkmanState workman_object_get_state(WorkmanObject *self,
+                                      GError **error)
+{
+    WorkmanObjectClass *obj_class = WORKMAN_OBJECT_GET_CLASS(self);
+    return obj_class->get_state(self, error);
+}
+
+
 /*
  * Local variables:
  *  indent-tabs-mode: nil
diff --git a/workman/workman-object.h b/workman/workman-object.h
index 69f4513..c84e2a7 100644
--- a/workman/workman-object.h
+++ b/workman/workman-object.h
@@ -64,6 +64,7 @@ struct _WorkmanObjectClass
     /*< private >*/
     GObjectClass parent_class;
 
+
     /* class members */
     GList *(*get_attributes)(WorkmanObject *obj,
                              WorkmanState state,
@@ -79,6 +80,10 @@ struct _WorkmanObjectClass
                                 WorkmanState state,
                                 GError **error);
 
+    WorkmanState (*get_state)(WorkmanObject *self,
+                              GError **error);
+
+
     /* Remove from padding when adding new virtual functions */
     gpointer padding[20];
 };
@@ -104,6 +109,10 @@ gboolean workman_object_save_attributes(WorkmanObject *obj,
                                         WorkmanState state,
                                         GError **error);
 
+WorkmanState workman_object_get_state(WorkmanObject *obj,
+                                      GError **error);
+
+
 G_END_DECLS
 
 #endif /* __WORKMAN_OBJECT_H__ */
-- 
1.7.11.7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]