Movie Info Provider: First gobject version
authorSimón Pena <spenap@gmail.com>
Sun, 16 May 2010 09:41:43 +0000 (11:41 +0200)
committerSimón Pena <spenap@gmail.com>
Sun, 16 May 2010 11:33:41 +0000 (13:33 +0200)
A GObject skeleton is created for the Movie Info provider. While it
is far from ready, it will replace the old versions (which had
no GObject support, didn't follow any namespaces guidelines and all
that)

src/mvs-minfo-provider.c [new file with mode: 0644]
src/mvs-minfo-provider.h [new file with mode: 0644]

diff --git a/src/mvs-minfo-provider.c b/src/mvs-minfo-provider.c
new file mode 100644 (file)
index 0000000..98bb1f8
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * mvs-minfo-provider.c
+ *
+ * This file is part of maevies
+ * Copyright (C) 2010 Simón Pena <spenap@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include "mvs-minfo-provider.h"
+
+G_DEFINE_TYPE (MvsMInfoProvider, mvs_minfo_provider, G_TYPE_OBJECT)
+
+enum {
+        PROP_0,
+        PROP_QUERY,
+};
+
+#define GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), MVS_TYPE_MINFO_PROVIDER, MvsMInfoProviderPrivate))
+
+struct _MvsMInfoProviderPrivate {
+        gchar *query;
+};
+
+static void
+mvs_minfo_provider_get_property (GObject *object, guint property_id,
+                         GValue *value, GParamSpec *pspec)
+{
+        MvsMInfoProvider *self = MVS_MINFO_PROVIDER (object);
+
+        switch (property_id) {
+        /*case PROP_QUERY:
+                g_value_set_string (value, self->priv->query);
+                break;*/
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        }
+}
+
+static void
+mvs_minfo_provider_set_property (GObject *object, guint property_id,
+                         const GValue *value, GParamSpec *pspec)
+{
+        MvsMInfoProvider *self = MVS_MINFO_PROVIDER (object);
+
+        switch (property_id) {
+        default:
+                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        }
+}
+
+static void
+mvs_minfo_provider_finalize (GObject *object)
+{
+        MvsMInfoProvider *self = MVS_MINFO_PROVIDER (object);
+        g_free (self->priv->query);
+
+        G_OBJECT_CLASS (mvs_minfo_provider_parent_class)->finalize (object);
+}
+
+static void
+mvs_minfo_provider_class_init (MvsMInfoProviderClass *klass)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+        g_type_class_add_private (klass, sizeof (MvsMInfoProviderPrivate));
+
+        object_class->get_property = mvs_minfo_provider_get_property;
+        object_class->set_property = mvs_minfo_provider_set_property;
+        object_class->finalize = mvs_minfo_provider_finalize;
+
+        /* g_object_class_install_property
+                (object_class, PROP_QUERY,
+                 g_param_spec_string ("query", "The query", "The query",
+                                      NULL,
+                                      G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+                                      */
+}
+
+static void
+mvs_minfo_provider_init (MvsMInfoProvider *self)
+{
+        self->priv = GET_PRIVATE (self);
+        self->priv->query = NULL;
+}
+
+MvsMInfoProvider*
+mvs_minfo_provider_new (void)
+{
+        return g_object_new (MVS_TYPE_MINFO_PROVIDER, NULL);
+}
+
+gboolean
+mvs_minfo_provider_query (MvsMInfoProvider *self,
+                          const gchar *query)
+{
+        return FALSE;
+}
diff --git a/src/mvs-minfo-provider.h b/src/mvs-minfo-provider.h
new file mode 100644 (file)
index 0000000..89007e7
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * mvs-minfo-provider.h
+ *
+ * This file is part of maevies
+ * Copyright (C) 2010 Simón Pena <spenap@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef _MVS_MINFO_PROVIDER
+#define _MVS_MINFO_PROVIDER
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MVS_TYPE_MINFO_PROVIDER mvs_minfo_provider_get_type()
+#define MVS_MINFO_PROVIDER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), MVS_TYPE_MINFO_PROVIDER, MvsMInfoProvider))
+#define MVS_MINFO_PROVIDER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), MVS_TYPE_MINFO_PROVIDER, MvsMInfoProviderClass))
+#define MVS_IS_MINFO_PROVIDER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MVS_TYPE_MINFO_PROVIDER))
+#define MVS_IS_MINFO_PROVIDER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), MVS_TYPE_MINFO_PROVIDER))
+#define MVS_MINFO_PROVIDER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), MVS_TYPE_MINFO_PROVIDER, MvsMInfoProviderClass))
+
+typedef struct _MvsMInfoProviderPrivate MvsMInfoProviderPrivate;
+
+typedef struct {
+        GObject parent;
+
+        /* <private> */
+        MvsMInfoProviderPrivate *priv;
+} MvsMInfoProvider;
+
+typedef struct {
+        GObjectClass parent_class;
+} MvsMInfoProviderClass;
+
+GType mvs_minfo_provider_get_type (void);
+MvsMInfoProvider* mvs_minfo_provider_new (void);
+
+gboolean mvs_minfo_provider_query (MvsMInfoProvider *self,
+                                   const gchar *query);
+
+G_END_DECLS
+
+#endif /* _MVS_MINFO_PROVIDER */