pidgin/plugins/disco/xmppdiscoservice.c

Tue, 02 Jan 2024 00:36:32 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 02 Jan 2024 00:36:32 -0600
changeset 42562
f02878f30f91
parent 42090
a109a8cc8059
child 42573
9dc369a7d7da
permissions
-rw-r--r--

Create a full widget for the new instant message window

This now uses AdwMessageDialog and is self contained but PidginApplication
manages a singleton of it.

Previously this used the request api. I'm not sure why, as the request fields
were created by the ui itself.

Testing Done:
Created an im with `Echo` on a `demo` account and was able to send and receive messages.

Reviewed at https://reviews.imfreedom.org/r/2896/

42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
1 /*
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
2 * Purple - XMPP Service Disco Browser
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
4 *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
7 * source distribution.
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
8 *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
12 * (at your option) any later version.
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
13 *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
17 * GNU General Public License for more details.
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
18 *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
21 */
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
22
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
24
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
25 #include "xmppdiscoservice.h"
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
26 #include "xmppdiscoenums.h"
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
27
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
28 struct _XmppDiscoService {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
29 GObject parent;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
30
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
31 PidginDiscoList *list;
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
32 GListStore *children;
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
33 char *name;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
34 char *description;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
35
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
36 char *gateway_type;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
37 XmppDiscoServiceType type;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
38 XmppDiscoServiceFlags flags;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
39
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
40 char *jid;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
41 char *node;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
42 gboolean expanded;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
43 };
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
44
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
45 enum {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
46 PROP_0,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
47 PROP_LIST,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
48 PROP_NAME,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
49 PROP_DESCRIPTION,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
50 PROP_SERVICE_TYPE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
51 PROP_GATEWAY_TYPE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
52 PROP_FLAGS,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
53 PROP_JID,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
54 PROP_NODE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
55 PROP_EXPANDED,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
56 PROP_ICON_NAME,
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
57 PROP_CHILD_MODEL,
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
58 PROP_LAST
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
59 };
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
60
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
61 static GParamSpec *properties[PROP_LAST] = {NULL};
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
62
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
63 /******************************************************************************
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
64 * Helpers
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
65 *****************************************************************************/
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
66 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
67 xmpp_disco_service_set_list(XmppDiscoService *service, PidginDiscoList *list) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
68 service->list = list;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
69
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
70 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_LIST]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
71 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
72
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
73 static void
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
74 xmpp_disco_service_refresh_child_model(GObject *obj,
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
75 G_GNUC_UNUSED GParamSpec *pspec,
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
76 G_GNUC_UNUSED gpointer data)
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
77 {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
78 XmppDiscoService *service = XMPP_DISCO_SERVICE(obj);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
79 gboolean changed = FALSE;
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
80
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
81 if((service->flags & XMPP_DISCO_BROWSE) != 0) {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
82 if(service->children == NULL) {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
83 service->children = g_list_store_new(XMPP_DISCO_TYPE_SERVICE);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
84 changed = TRUE;
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
85 }
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
86 } else {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
87 changed = service->children != NULL;
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
88 g_clear_object(&service->children);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
89 }
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
90
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
91 if(changed) {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
92 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_CHILD_MODEL]);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
93 }
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
94 }
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
95
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
96 /******************************************************************************
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
97 * GObject implementation
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
98 *****************************************************************************/
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
99 G_DEFINE_DYNAMIC_TYPE(XmppDiscoService, xmpp_disco_service, G_TYPE_OBJECT)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
100
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
101 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
102 xmpp_disco_service_get_property(GObject *object, guint prop_id, GValue *value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
103 GParamSpec *pspec)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
104 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
105 XmppDiscoService *service = XMPP_DISCO_SERVICE(object);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
106
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
107 switch(prop_id) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
108 case PROP_LIST:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
109 g_value_set_pointer(value, xmpp_disco_service_get_list(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
110 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
111 case PROP_NAME:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
112 g_value_set_string(value, xmpp_disco_service_get_name(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
113 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
114 case PROP_DESCRIPTION:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
115 g_value_set_string(value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
116 xmpp_disco_service_get_description(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
117 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
118 case PROP_SERVICE_TYPE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
119 g_value_set_enum(value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
120 xmpp_disco_service_get_service_type(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
121 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
122 case PROP_GATEWAY_TYPE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
123 g_value_set_string(value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
124 xmpp_disco_service_get_gateway_type(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
125 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
126 case PROP_FLAGS:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
127 g_value_set_flags(value, xmpp_disco_service_get_flags(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
128 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
129 case PROP_JID:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
130 g_value_set_string(value, xmpp_disco_service_get_jid(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
131 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
132 case PROP_NODE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
133 g_value_set_string(value, xmpp_disco_service_get_node(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
134 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
135 case PROP_EXPANDED:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
136 g_value_set_boolean(value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
137 xmpp_disco_service_get_expanded(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
138 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
139 case PROP_ICON_NAME:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
140 g_value_take_string(value,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
141 xmpp_disco_service_get_icon_name(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
142 break;
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
143 case PROP_CHILD_MODEL:
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
144 g_value_set_object(value,
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
145 xmpp_disco_service_get_child_model(service));
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
146 break;
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
147 default:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
148 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
149 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
150 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
151 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
152
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
153 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
154 xmpp_disco_service_set_property(GObject *object, guint prop_id,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
155 const GValue *value, GParamSpec *pspec)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
156 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
157 XmppDiscoService *service = XMPP_DISCO_SERVICE(object);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
158
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
159 switch(prop_id) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
160 case PROP_LIST:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
161 xmpp_disco_service_set_list(service, g_value_get_pointer(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
162 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
163 case PROP_NAME:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
164 xmpp_disco_service_set_name(service, g_value_get_string(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
165 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
166 case PROP_DESCRIPTION:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
167 xmpp_disco_service_set_description(service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
168 g_value_get_string(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
169 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
170 case PROP_SERVICE_TYPE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
171 xmpp_disco_service_set_service_type(service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
172 g_value_get_enum(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
173 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
174 case PROP_GATEWAY_TYPE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
175 xmpp_disco_service_set_gateway_type(service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
176 g_value_get_string(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
177 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
178 case PROP_FLAGS:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
179 xmpp_disco_service_set_flags(service, g_value_get_flags(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
180 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
181 case PROP_JID:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
182 xmpp_disco_service_set_jid(service, g_value_get_string(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
183 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
184 case PROP_NODE:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
185 xmpp_disco_service_set_node(service, g_value_get_string(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
186 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
187 case PROP_EXPANDED:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
188 xmpp_disco_service_set_expanded(service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
189 g_value_get_boolean(value));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
190 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
191 default:
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
192 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
193 break;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
194 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
195 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
196
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
197 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
198 xmpp_disco_service_finalize(GObject *obj) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
199 XmppDiscoService *service = XMPP_DISCO_SERVICE(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
200
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
201 g_clear_pointer(&service->name, g_free);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
202 g_clear_pointer(&service->description, g_free);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
203 g_clear_pointer(&service->gateway_type, g_free);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
204 g_clear_pointer(&service->jid, g_free);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
205 g_clear_pointer(&service->node, g_free);
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
206 g_clear_object(&service->children);
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
207
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
208 G_OBJECT_CLASS(xmpp_disco_service_parent_class)->finalize(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
209 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
210
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
211 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
212 xmpp_disco_service_class_init(XmppDiscoServiceClass *klass)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
213 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
214 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
215
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
216 /* Properties */
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
217 obj_class->get_property = xmpp_disco_service_get_property;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
218 obj_class->set_property = xmpp_disco_service_set_property;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
219 obj_class->finalize = xmpp_disco_service_finalize;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
220
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
221 properties[PROP_LIST] = g_param_spec_pointer(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
222 "list", "list", "The list displaying this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
223 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
224
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
225 properties[PROP_NAME] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
226 "name", "name", "The name of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
227 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
228 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
229
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
230 properties[PROP_DESCRIPTION] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
231 "description", "description", "The description of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
232 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
233 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
234
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
235 properties[PROP_SERVICE_TYPE] = g_param_spec_enum(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
236 "service-type", "service-type", "The service type of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
237 XMPP_DISCO_TYPE_SERVICE_TYPE, XMPP_DISCO_SERVICE_TYPE_UNSET,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
238 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
239
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
240 properties[PROP_GATEWAY_TYPE] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
241 "gateway-type", "gateway-type", "The gateway type of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
242 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
243 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
244
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
245 properties[PROP_FLAGS] = g_param_spec_flags(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
246 "flags", "flags", "The flags of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
247 XMPP_DISCO_TYPE_SERVICE_FLAGS, XMPP_DISCO_NONE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
248 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
249
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
250 properties[PROP_JID] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
251 "jid", "jid", "The jid of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
252 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
253 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
254
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
255 properties[PROP_NODE] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
256 "node", "node", "The node of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
257 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
258 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
259
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
260 properties[PROP_EXPANDED] = g_param_spec_boolean(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
261 "expanded", "expanded", "Whether this service expanded.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
262 FALSE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
263 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
264
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
265 properties[PROP_ICON_NAME] = g_param_spec_string(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
266 "icon-name", "icon-name", "The icon name of this service.",
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
267 NULL,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
268 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
269
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
270 properties[PROP_CHILD_MODEL] = g_param_spec_object(
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
271 "child-model", "child-model",
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
272 "The model containing children of this service.",
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
273 G_TYPE_LIST_MODEL,
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
274 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
275
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
276 g_object_class_install_properties(obj_class, PROP_LAST, properties);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
277 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
278
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
279 static void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
280 xmpp_disco_service_class_finalize(G_GNUC_UNUSED XmppDiscoServiceClass *klass) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
281 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
282
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
283 static void
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
284 xmpp_disco_service_init(XmppDiscoService *service) {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
285 g_signal_connect(service, "notify::flags",
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
286 G_CALLBACK(xmpp_disco_service_refresh_child_model), NULL);
42037
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
287 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
288
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
289 /******************************************************************************
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
290 * Public API
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
291 *****************************************************************************/
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
292
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
293 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
294 xmpp_disco_service_register(PurplePlugin *plugin) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
295 xmpp_disco_service_register_type(G_TYPE_MODULE(plugin));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
296 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
297
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
298 XmppDiscoService *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
299 xmpp_disco_service_new(PidginDiscoList *list) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
300 return g_object_new(
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
301 XMPP_DISCO_TYPE_SERVICE,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
302 "list", list,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
303 NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
304 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
305
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
306 PidginDiscoList *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
307 xmpp_disco_service_get_list(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
308 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
309
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
310 return service->list;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
311 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
312
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
313 const char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
314 xmpp_disco_service_get_name(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
315 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
316
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
317 return service->name;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
318 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
319
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
320 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
321 xmpp_disco_service_set_name(XmppDiscoService *service, const char *name) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
322 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
323
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
324 g_free(service->name);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
325 service->name = g_strdup(name);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
326
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
327 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_NAME]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
328 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
329
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
330 const char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
331 xmpp_disco_service_get_description(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
332 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
333
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
334 return service->description;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
335 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
336
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
337 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
338 xmpp_disco_service_set_description(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
339 const char *description)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
340 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
341 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
342
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
343 g_free(service->description);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
344 service->description = g_strdup(description);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
345
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
346 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_DESCRIPTION]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
347 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
348
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
349 XmppDiscoServiceType
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
350 xmpp_disco_service_get_service_type(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
351 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service),
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
352 XMPP_DISCO_SERVICE_TYPE_UNSET);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
353
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
354 return service->type;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
355 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
356
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
357 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
358 xmpp_disco_service_set_service_type(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
359 XmppDiscoServiceType type)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
360 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
361 GObject *obj = NULL;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
362 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
363
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
364 service->type = type;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
365
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
366 obj = G_OBJECT(service);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
367 g_object_freeze_notify(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
368 g_object_notify_by_pspec(obj, properties[PROP_SERVICE_TYPE]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
369 g_object_notify_by_pspec(obj, properties[PROP_ICON_NAME]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
370 g_object_thaw_notify(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
371 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
372
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
373 const char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
374 xmpp_disco_service_get_gateway_type(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
375 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
376
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
377 return service->gateway_type;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
378 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
379
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
380 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
381 xmpp_disco_service_set_gateway_type(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
382 const char *gateway_type)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
383 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
384 GObject *obj = NULL;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
385 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
386
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
387 g_free(service->gateway_type);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
388 service->gateway_type = g_strdup(gateway_type);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
389
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
390 obj = G_OBJECT(service);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
391 g_object_freeze_notify(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
392 g_object_notify_by_pspec(obj, properties[PROP_GATEWAY_TYPE]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
393 g_object_notify_by_pspec(obj, properties[PROP_ICON_NAME]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
394 g_object_thaw_notify(obj);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
395 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
396
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
397 XmppDiscoServiceFlags
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
398 xmpp_disco_service_get_flags(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
399 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), XMPP_DISCO_NONE);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
400
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
401 return service->flags;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
402 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
403
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
404 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
405 xmpp_disco_service_set_flags(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
406 XmppDiscoServiceFlags flags)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
407 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
408 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
409
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
410 service->flags = flags;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
411
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
412 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_FLAGS]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
413 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
414
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
415 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
416 xmpp_disco_service_add_flags(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
417 XmppDiscoServiceFlags flags)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
418 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
419 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
420
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
421 service->flags |= flags;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
422
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
423 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_FLAGS]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
424 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
425
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
426 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
427 xmpp_disco_service_remove_flags(XmppDiscoService *service,
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
428 XmppDiscoServiceFlags flags)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
429 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
430 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
431
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
432 service->flags &= ~flags;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
433
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
434 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_FLAGS]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
435 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
436
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
437 const char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
438 xmpp_disco_service_get_jid(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
439 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
440
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
441 return service->jid;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
442 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
443
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
444 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
445 xmpp_disco_service_set_jid(XmppDiscoService *service, const char *jid) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
446 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
447
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
448 g_free(service->jid);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
449 service->jid = g_strdup(jid);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
450
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
451 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_JID]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
452 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
453
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
454 const char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
455 xmpp_disco_service_get_node(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
456 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
457
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
458 return service->node;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
459 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
460
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
461 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
462 xmpp_disco_service_set_node(XmppDiscoService *service, const char *node) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
463 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
464
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
465 g_free(service->node);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
466 service->node = g_strdup(node);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
467
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
468 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_NODE]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
469 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
470
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
471 gboolean
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
472 xmpp_disco_service_get_expanded(XmppDiscoService *service) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
473 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), FALSE);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
474
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
475 return service->expanded;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
476 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
477
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
478 void
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
479 xmpp_disco_service_set_expanded(XmppDiscoService *service, gboolean expanded) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
480 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
481
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
482 service->expanded = expanded;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
483
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
484 g_object_notify_by_pspec(G_OBJECT(service), properties[PROP_EXPANDED]);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
485 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
486
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
487 char *
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
488 xmpp_disco_service_get_icon_name(XmppDiscoService *service)
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
489 {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
490 char *icon_name = NULL;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
491
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
492 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
493
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
494 if(service->type == XMPP_DISCO_SERVICE_TYPE_GATEWAY && service->gateway_type != NULL) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
495 icon_name = g_strconcat("im-", service->gateway_type, NULL);
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
496 #if 0
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
497 } else if(service->type == XMPP_DISCO_SERVICE_TYPE_USER) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
498 icon_name = g_strdup("person");
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
499 #endif
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
500 } else if(service->type == XMPP_DISCO_SERVICE_TYPE_CHAT) {
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
501 icon_name = g_strdup("chat");
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
502 }
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
503
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
504 return icon_name;
af20db93f2c2 Convert XmppDiscoService into a GObject
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
diff changeset
505 }
42090
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
506
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
507 GListModel *
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
508 xmpp_disco_service_get_child_model(XmppDiscoService *service) {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
509 g_return_val_if_fail(XMPP_DISCO_IS_SERVICE(service), NULL);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
510
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
511 return G_LIST_MODEL(service->children);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
512 }
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
513
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
514 void
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
515 xmpp_disco_service_add_child(XmppDiscoService *service,
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
516 XmppDiscoService *child)
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
517 {
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
518 g_return_if_fail(XMPP_DISCO_IS_SERVICE(service));
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
519 g_return_if_fail(XMPP_DISCO_IS_SERVICE(child));
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
520 g_return_if_fail((service->flags & XMPP_DISCO_BROWSE) != 0);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
521
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
522 g_list_store_append(service->children, child);
a109a8cc8059 Convert XMPP Service Discovery to GtkColumnView
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 42037
diff changeset
523 }

mercurial