[rygel-gst-0-10-plugins] Cleanup of some smaller classes.



commit 2c8c7c7d284714332589cf8ca9c2ccebbe9c2d8d
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Thu Jan 17 11:46:17 2013 +0100

    Cleanup of some smaller classes.

 src/media-export/rygel-media-export-sql-function.c |   69 +++++++-------------
 src/media-export/rygel-media-export-sql-function.h |   14 ++--
 src/media-export/rygel-media-export-sql-operator.c |   16 +++++
 src/media-export/rygel-media-export-sql-operator.h |    6 ++
 4 files changed, 55 insertions(+), 50 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-sql-function.c b/src/media-export/rygel-media-export-sql-function.c
index 6508a8f..801e505 100644
--- a/src/media-export/rygel-media-export-sql-function.c
+++ b/src/media-export/rygel-media-export-sql-function.c
@@ -24,55 +24,36 @@
 
 #include "rygel-media-export-sql-function.h"
 
-G_DEFINE_TYPE (RygelMediaExportSqlFunction, rygel_media_export_sql_function, RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR)
-
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_construct (GType object_type, const gchar* name, const gchar* arg);
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_new (const gchar* name, const gchar* arg, const gchar* collate);
-RygelMediaExportSqlOperator* rygel_media_export_sql_operator_construct (GType object_type, const gchar* name, const gchar* arg, const gchar* collate);
-static gchar* rygel_media_export_sql_function_real_to_string (RygelMediaExportSqlOperator* base);
-
-
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_construct (GType object_type, const gchar* name, const gchar* arg) {
-	RygelMediaExportSqlFunction * self = NULL;
-	const gchar* _tmp0_;
-	const gchar* _tmp1_;
-	g_return_val_if_fail (name != NULL, NULL);
-	g_return_val_if_fail (arg != NULL, NULL);
-	_tmp0_ = name;
-	_tmp1_ = arg;
-	self = (RygelMediaExportSqlFunction*) rygel_media_export_sql_operator_construct (object_type, _tmp0_, _tmp1_, "");
-	return self;
+G_DEFINE_TYPE (RygelMediaExportSqlFunction,
+               rygel_media_export_sql_function,
+               RYGEL_MEDIA_EXPORT_TYPE_SQL_OPERATOR)
+
+RygelMediaExportSqlFunction *
+rygel_media_export_sql_function_new (const gchar *name,
+                                     const gchar *arg) {
+  g_return_val_if_fail (name != NULL, NULL);
+  g_return_val_if_fail (arg != NULL, NULL);
+
+  return RYGEL_MEDIA_EXPORT_SQL_FUNCTION (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION,
+                                                        "name", name,
+                                                        "arg", arg,
+                                                        "collate", "",
+                                                        NULL));
 }
 
-
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_new (const gchar* name, const gchar* arg) {
-	return rygel_media_export_sql_function_construct (RYGEL_MEDIA_EXPORT_TYPE_SQL_FUNCTION, name, arg);
+static gchar *
+rygel_media_export_sql_function_real_to_string (RygelMediaExportSqlOperator *base) {
+  return g_strdup_printf ("%s(%s,?)",
+                          rygel_media_export_sql_operator_get_name (base),
+                          rygel_media_export_sql_operator_get_arg (base));
 }
 
+static void
+rygel_media_export_sql_function_class_init (RygelMediaExportSqlFunctionClass *function_class) {
+  RygelMediaExportSqlOperatorClass operator_class = RYGEL_MEDIA_EXPORT_SQL_OPERATOR_CLASS (function_class);
 
-static gchar* rygel_media_export_sql_function_real_to_string (RygelMediaExportSqlOperator* base) {
-	RygelMediaExportSqlFunction * self;
-	gchar* result = NULL;
-	const gchar* _tmp0_;
-	const gchar* _tmp1_;
-	gchar* _tmp2_ = NULL;
-	self = (RygelMediaExportSqlFunction*) base;
-	_tmp0_ = ((RygelMediaExportSqlOperator*) self)->name;
-	_tmp1_ = ((RygelMediaExportSqlOperator*) self)->arg;
-	_tmp2_ = g_strdup_printf ("%s(%s,?)", _tmp0_, _tmp1_);
-	result = _tmp2_;
-	return result;
+  function_class->to_string = rygel_media_export_sql_function_real_to_string;
 }
 
-
-static void rygel_media_export_sql_function_class_init (RygelMediaExportSqlFunctionClass * klass) {
-	rygel_media_export_sql_function_parent_class = g_type_class_peek_parent (klass);
-	RYGEL_MEDIA_EXPORT_SQL_OPERATOR_CLASS (klass)->to_string = rygel_media_export_sql_function_real_to_string;
+static void rygel_media_export_sql_function_init (RygelMediaExportSqlFunction *self G_GNUC_UNUSED) {
 }
-
-
-static void rygel_media_export_sql_function_init (RygelMediaExportSqlFunction * self) {
-}
-
-
-
diff --git a/src/media-export/rygel-media-export-sql-function.h b/src/media-export/rygel-media-export-sql-function.h
index dc92142..9c09a76 100644
--- a/src/media-export/rygel-media-export-sql-function.h
+++ b/src/media-export/rygel-media-export-sql-function.h
@@ -38,18 +38,20 @@ typedef struct _RygelMediaExportSqlFunctionClass RygelMediaExportSqlFunctionClas
 typedef struct _RygelMediaExportSqlFunctionPrivate RygelMediaExportSqlFunctionPrivate;
 
 struct _RygelMediaExportSqlFunction {
-	RygelMediaExportSqlOperator parent_instance;
-	RygelMediaExportSqlFunctionPrivate * priv;
+  RygelMediaExportSqlOperator parent_instance;
+  RygelMediaExportSqlFunctionPrivate * priv;
 };
 
 struct _RygelMediaExportSqlFunctionClass {
-	RygelMediaExportSqlOperatorClass parent_class;
+  RygelMediaExportSqlOperatorClass parent_class;
 };
 
-GType rygel_media_export_sql_function_get_type (void) G_GNUC_CONST;
-
-RygelMediaExportSqlFunction* rygel_media_export_sql_function_new (const gchar* name, const gchar* arg);
+GType
+rygel_media_export_sql_function_get_type (void) G_GNUC_CONST;
 
+RygelMediaExportSqlFunction *
+rygel_media_export_sql_function_new (const gchar *name,
+                                     const gchar *arg);
 
 G_END_DECLS
 
diff --git a/src/media-export/rygel-media-export-sql-operator.c b/src/media-export/rygel-media-export-sql-operator.c
index 652a4ee..0a2aaec 100644
--- a/src/media-export/rygel-media-export-sql-operator.c
+++ b/src/media-export/rygel-media-export-sql-operator.c
@@ -227,3 +227,19 @@ rygel_media_export_sql_operator_class_init (RygelMediaExportSqlOperatorClass *op
 static void rygel_media_export_sql_operator_init (RygelMediaExportSqlOperator *self) {
   self->priv = RYGEL_MEDIA_EXPORT_SQL_OPERATOR_GET_PRIVATE (self);
 }
+
+const gchar *
+rygel_media_export_sql_operator_get_name (RygelMediaExportSqlOperator *self)
+{
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_SQL_OPERATOR (self), NULL);
+
+  return self->priv->name;
+}
+
+const gchar *
+rygel_media_export_sql_operator_get_arg (RygelMediaExportSqlOperator *self)
+{
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_SQL_OPERATOR (self), NULL);
+
+  return self->priv->arg;
+}
diff --git a/src/media-export/rygel-media-export-sql-operator.h b/src/media-export/rygel-media-export-sql-operator.h
index a6e231a..04eb37b 100644
--- a/src/media-export/rygel-media-export-sql-operator.h
+++ b/src/media-export/rygel-media-export-sql-operator.h
@@ -70,6 +70,12 @@ rygel_media_export_sql_operator_new_from_search_criteria_op (GUPnPSearchCriteria
 gchar *
 rygel_media_export_sql_operator_to_string (RygelMediaExportSqlOperator *self);
 
+const gchar *
+rygel_media_export_sql_operator_get_name (RygelMediaExportSqlOperator *self);
+
+const gchar *
+rygel_media_export_sql_operator_get_arg (RygelMediaExportSqlOperator *self);
+
 G_END_DECLS
 
 #endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_SQL_OPERATOR_H__ */



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