Commit 4d453f4b authored by Bob Ham's avatar Bob Ham
Browse files

dummy-{provider,origin,calls}: Fix up dummy provider

* Implement CallsMessageSource
* Fix Provider object creation
* Add calls_dummy_provider_add_origin
parent 4e604b77
......@@ -23,6 +23,7 @@
*/
#include "calls-dummy-call.h"
#include "calls-message-source.h"
#include "calls-call.h"
#include <glib/gi18n.h>
......@@ -35,9 +36,12 @@ struct _CallsDummyCall
CallsCallState state;
};
static void calls_dummy_call_message_source_interface_init (CallsCallInterface *iface);
static void calls_dummy_call_call_interface_init (CallsCallInterface *iface);
G_DEFINE_TYPE_WITH_CODE (CallsDummyCall, calls_dummy_call, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_dummy_call_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_CALL,
calls_dummy_call_call_interface_init))
......@@ -192,6 +196,13 @@ calls_dummy_call_call_interface_init (CallsCallInterface *iface)
iface->tone_stop = tone_stop;
}
static void
calls_dummy_call_message_source_interface_init (CallsCallInterface *iface)
{
}
static void
calls_dummy_call_init (CallsDummyCall *self)
{
......
......@@ -23,6 +23,7 @@
*/
#include "calls-dummy-origin.h"
#include "calls-message-source.h"
#include "calls-origin.h"
#include "calls-dummy-call.h"
......@@ -37,9 +38,12 @@ struct _CallsDummyOrigin
GList *calls;
};
static void calls_dummy_origin_message_source_interface_init (CallsOriginInterface *iface);
static void calls_dummy_origin_origin_interface_init (CallsOriginInterface *iface);
G_DEFINE_TYPE_WITH_CODE (CallsDummyOrigin, calls_dummy_origin, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_dummy_origin_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_ORIGIN,
calls_dummy_origin_origin_interface_init))
......@@ -150,36 +154,9 @@ dial (CallsOrigin *origin, const gchar *number)
CallsDummyOrigin *
calls_dummy_origin_new (const gchar *name)
{
/*
guint n_properties, i;
const gchar *names[1] = { NULL };
GValue values[1] = { G_VALUE_INIT };
GObject *object;
if (name == NULL)
{
n_properties = 0;
}
else
{
n_properties = 1;
names[0] = "name";
g_value_init (&values[0], G_TYPE_STRING);
g_value_set_string (&values[0], name);
}
object = g_object_new_with_properties (CALLS_TYPE_DUMMY_ORIGIN,
n_properties, names, values);
for (i = 0; i < n_properties; ++i)
{
g_value_unset (&values[i]);
}
return CALLS_DUMMY_ORIGIN(object);
*/
// FIXME
return NULL;
return g_object_new (CALLS_TYPE_DUMMY_ORIGIN,
"name", name,
NULL);
}
......@@ -247,6 +224,12 @@ calls_dummy_origin_class_init (CallsDummyOriginClass *klass)
}
static void
calls_dummy_origin_message_source_interface_init (CallsOriginInterface *iface)
{
}
static void
calls_dummy_origin_origin_interface_init (CallsOriginInterface *iface)
{
......
......@@ -23,6 +23,7 @@
*/
#include "calls-dummy-provider.h"
#include "calls-message-source.h"
#include "calls-provider.h"
#include "calls-dummy-origin.h"
......@@ -33,18 +34,23 @@ struct _CallsDummyProvider
GList *origins;
};
static void calls_dummy_provider_message_source_interface_init (CallsProviderInterface *iface);
static void calls_dummy_provider_provider_interface_init (CallsProviderInterface *iface);
G_DEFINE_TYPE_WITH_CODE (CallsDummyProvider, calls_dummy_provider, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
calls_dummy_provider_message_source_interface_init)
G_IMPLEMENT_INTERFACE (CALLS_TYPE_PROVIDER,
calls_dummy_provider_provider_interface_init))
static const gchar *
get_name (CallsProvider *iface)
{
return "Dummy provider";
}
static GList *
get_origins (CallsProvider *iface)
{
......@@ -52,6 +58,7 @@ get_origins (CallsProvider *iface)
return g_list_copy (self->origins);
}
CallsDummyProvider *
calls_dummy_provider_new ()
{
......@@ -71,6 +78,7 @@ dispose (GObject *object)
parent_class->dispose (object);
}
static void
calls_dummy_provider_class_init (CallsDummyProviderClass *klass)
{
......@@ -79,6 +87,13 @@ calls_dummy_provider_class_init (CallsDummyProviderClass *klass)
object_class->dispose = dispose;
}
static void
calls_dummy_provider_message_source_interface_init (CallsProviderInterface *iface)
{
}
static void
calls_dummy_provider_provider_interface_init (CallsProviderInterface *iface)
{
......@@ -86,11 +101,17 @@ calls_dummy_provider_provider_interface_init (CallsProviderInterface *iface)
iface->get_origins = get_origins;
}
static void
calls_dummy_provider_init (CallsDummyProvider *self)
{
}
void
calls_dummy_provider_add_origin (CallsDummyProvider *self,
const gchar *name)
{
self->origins = g_list_append (self->origins,
calls_dummy_origin_new (NULL));
self->origins = g_list_append (self->origins,
calls_dummy_origin_new ("Dummy origin 2"));
calls_dummy_origin_new (name));
}
......@@ -33,7 +33,9 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (CallsDummyProvider, calls_dummy_provider, CALLS, DUMMY_PROVIDER, GObject);
CallsDummyProvider *calls_dummy_provider_new ();
CallsDummyProvider *calls_dummy_provider_new ();
void calls_dummy_provider_add_origin (CallsDummyProvider *self,
const gchar *name);
G_END_DECLS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment