summaryrefslogtreecommitdiff
path: root/src/kindling-roomlist-channel.c
blob: 4f95a1d0354954da2ef8c9d5152f275b3dafee93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * telepathy-kindling
 * Copyright (C) Joe Barnett 2012 <jbarnett@taplop>
 * 
telepathy-kindling is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * telepathy-kindling 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 Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.";
 */

#include "kindling-roomlist-channel.h"
#include "kindling-connection.h"
#include <telepathy-glib/svc-channel.h>
#include <telepathy-glib/interfaces.h>


static void roomlist_iface_init (gpointer, gpointer);

G_DEFINE_TYPE_WITH_CODE (KindlingRoomlistChannel, kindling_roomlist_channel, 
                         TP_TYPE_BASE_CHANNEL,
                         G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CHANNEL_TYPE_ROOM_LIST, roomlist_iface_init));

enum {
	PROP_CONNECTION = 1,
	LAST_PROPERTY_ENUM
};

typedef struct _KindlingRoomlistChannelPrivate KindlingRoomlistChannelPrivate;
struct _KindlingRoomlistChannelPrivate {
        KindlingConnection *conn;
	
};
#define KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), KINDLING_TYPE_ROOMLIST_CHANNEL, KindlingRoomlistChannelPrivate))

static void kindling_roomlist_channel_set_property(GObject *obj, guint prop_id, const GValue *value, GParamSpec *pspec) {
		g_printf("roomlist-channel set prop %d\n", prop_id);
	KindlingRoomlistChannelPrivate *priv = KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj);
	switch (prop_id) {
		case PROP_CONNECTION:
			priv->conn = g_value_get_object(value);
			break;
		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
            break;
	}
}

static void kindling_roomlist_channel_get_property(GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) {
		g_printf("roomlist-channel get prop %d\n", prop_id);
	KindlingRoomlistChannelPrivate *priv = KINDLING_ROOMLIST_CHANNEL_GET_PRIVATE(obj);
	switch (prop_id) {
		case PROP_CONNECTION:
			g_value_set_object(value, priv->conn);
			break;
		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop_id, pspec);
            break;
	}
			
}
static void
kindling_roomlist_channel_init (KindlingRoomlistChannel *kindling_roomlist_channel)
{

    g_printf("roomlist init\n");

	/* TODO: Add initialization code here */
}

static void
kindling_roomlist_channel_finalize (GObject *object)
{
	/* TODO: Add deinitalization code here */
    g_printf("roomlist finalize\n");

	G_OBJECT_CLASS (kindling_roomlist_channel_parent_class)->finalize (object);
}
static const gchar *kindling_roomlist_channel_interfaces[] = {
    NULL
};

static void
kindling_roomlist_channel_class_init (KindlingRoomlistChannelClass *klass)
{
    g_printf("roomlist class init\n");
	GObjectClass* object_class = G_OBJECT_CLASS (klass);
	TpBaseChannelClass* parent_class = TP_BASE_CHANNEL_CLASS (klass);
	GParamSpec *param_spec;
	g_type_class_add_private (klass, sizeof(KindlingRoomlistChannelPrivate));
	
	object_class->set_property = kindling_roomlist_channel_set_property;
	object_class->get_property = kindling_roomlist_channel_get_property;
	object_class->finalize = kindling_roomlist_channel_finalize;
	parent_class->channel_type = TP_IFACE_CHANNEL_TYPE_ROOM_LIST;
	parent_class->interfaces = kindling_roomlist_channel_interfaces;
	param_spec = g_param_spec_object
		("connection", "connection", "connection", KINDLING_TYPE_CONNECTION, G_PARAM_READWRITE);
	g_object_class_install_property (object_class, PROP_CONNECTION, param_spec);
}

static void
kindling_roomlist_channel_stop_listing (TpSvcChannelTypeRoomList *iface,
                                      DBusGMethodInvocation *context) {
    g_printf("roomlist stop listing\n");
}

static void
kindling_roomlist_channel_list_rooms (TpSvcChannelTypeRoomList *iface,
                                      DBusGMethodInvocation *context) {
    g_printf("roomlist list rooms\n");
}

static void
kindling_roomlist_channel_get_listing_rooms (TpSvcChannelTypeRoomList *iface,
                                      DBusGMethodInvocation *context) {
    g_printf("roomlist is listing?\n");
}

static void roomlist_iface_init (gpointer g_iface, gpointer iface_data) {
	TpSvcChannelTypeRoomListClass *klass = (TpSvcChannelTypeRoomListClass *) g_iface;
	tp_svc_channel_type_room_list_implement_get_listing_rooms (klass, kindling_roomlist_channel_get_listing_rooms);
	tp_svc_channel_type_room_list_implement_list_rooms (klass, kindling_roomlist_channel_list_rooms);
	tp_svc_channel_type_room_list_implement_stop_listing (klass, kindling_roomlist_channel_stop_listing);
}