| 110 |
118 |
| 111 G_OBJECT_CLASS(purple_protocol_manager_parent_class)->finalize(obj); |
119 G_OBJECT_CLASS(purple_protocol_manager_parent_class)->finalize(obj); |
| 112 } |
120 } |
| 113 |
121 |
| 114 static void |
122 static void |
| |
123 purple_protocol_manager_get_property(GObject *obj, guint param_id, |
| |
124 GValue *value, GParamSpec *pspec) |
| |
125 { |
| |
126 PurpleProtocolManager *manager = PURPLE_PROTOCOL_MANAGER(obj); |
| |
127 |
| |
128 switch(param_id) { |
| |
129 case PROP_ITEM_TYPE: |
| |
130 g_value_set_gtype(value, |
| |
131 purple_protocol_manager_get_item_type(G_LIST_MODEL(manager))); |
| |
132 break; |
| |
133 case PROP_N_ITEMS: |
| |
134 g_value_set_uint(value, |
| |
135 purple_protocol_manager_get_n_items(G_LIST_MODEL(manager))); |
| |
136 break; |
| |
137 default: |
| |
138 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); |
| |
139 break; |
| |
140 } |
| |
141 } |
| |
142 |
| |
143 static void |
| 115 purple_protocol_manager_init(PurpleProtocolManager *manager) { |
144 purple_protocol_manager_init(PurpleProtocolManager *manager) { |
| 116 manager->protocols = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
145 manager->protocols = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
| 117 g_object_unref); |
146 g_object_unref); |
| 118 manager->list = g_ptr_array_new(); |
147 manager->list = g_ptr_array_new(); |
| 119 } |
148 } |
| 121 static void |
150 static void |
| 122 purple_protocol_manager_class_init(PurpleProtocolManagerClass *klass) { |
151 purple_protocol_manager_class_init(PurpleProtocolManagerClass *klass) { |
| 123 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
152 GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
| 124 |
153 |
| 125 obj_class->finalize = purple_protocol_manager_finalize; |
154 obj_class->finalize = purple_protocol_manager_finalize; |
| |
155 obj_class->get_property = purple_protocol_manager_get_property; |
| |
156 |
| |
157 /** |
| |
158 * PurpleProtocolManager:item-type: |
| |
159 * |
| |
160 * The type of items. See [iface@Gio.ListModel.get_item_type]. |
| |
161 * |
| |
162 * Since: 3.0 |
| |
163 */ |
| |
164 properties[PROP_ITEM_TYPE] = g_param_spec_gtype( |
| |
165 "item-type", "item-type", |
| |
166 "The type of the contained items.", |
| |
167 G_TYPE_OBJECT, |
| |
168 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
| |
169 |
| |
170 /** |
| |
171 * PurpleProtocolManager:n-items: |
| |
172 * |
| |
173 * The number of items. See [iface@Gio.ListModel.get_n_items]. |
| |
174 * |
| |
175 * Since: 3.0 |
| |
176 */ |
| |
177 properties[PROP_N_ITEMS] = g_param_spec_uint( |
| |
178 "n-items", "n-items", |
| |
179 "The number of contained items.", |
| |
180 0, G_MAXUINT, 0, |
| |
181 G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); |
| |
182 |
| |
183 g_object_class_install_properties(obj_class, N_PROPERTIES, properties); |
| 126 |
184 |
| 127 /** |
185 /** |
| 128 * PurpleProtocolManager::registered: |
186 * PurpleProtocolManager::registered: |
| 129 * @manager: The #PurpleProtocolManager instance. |
187 * @manager: The #PurpleProtocolManager instance. |
| 130 * @protocol: The #PurpleProtocol that was registered. |
188 * @protocol: The #PurpleProtocol that was registered. |