libpurple/group.c

changeset 39675
583e2ba6e78e
parent 39665
2172e3b8eeef
child 39676
1e8394d47205
equal deleted inserted replaced
39666:da453f59d2f7 39675:583e2ba6e78e
95 95
96 /* 96 /*
97 * TODO: If merging, prompt the user if they want to merge. 97 * TODO: If merging, prompt the user if they want to merge.
98 */ 98 */
99 void purple_group_set_name(PurpleGroup *source, const char *name) { 99 void purple_group_set_name(PurpleGroup *source, const char *name) {
100 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
101 PurpleGroup *dest; 100 PurpleGroup *dest;
102 gchar *old_name; 101 gchar *old_name;
103 gchar *new_name; 102 gchar *new_name;
104 GList *moved_buddies = NULL; 103 GList *moved_buddies = NULL;
105 GSList *accts; 104 GSList *accts;
175 174
176 g_object_notify_by_pspec(G_OBJECT(source), properties[GROUP_PROP_NAME]); 175 g_object_notify_by_pspec(G_OBJECT(source), properties[GROUP_PROP_NAME]);
177 } 176 }
178 177
179 /* Save our changes */ 178 /* Save our changes */
180 if (ops && ops->save_node) 179 purple_blist_save_node(PURPLE_BLIST_NODE(source));
181 ops->save_node(PURPLE_BLIST_NODE(source));
182 180
183 /* Update the UI */ 181 /* Update the UI */
184 if (ops && ops->update) { 182 purple_blist_update_node(purple_blist_get_default(),
185 ops->update(purple_blist_get_default(), 183 PURPLE_BLIST_NODE(source));
186 PURPLE_BLIST_NODE(source));
187 }
188 184
189 /* Notify all protocols */ 185 /* Notify all protocols */
190 /* TODO: Is this condition needed? Seems like it would always be TRUE */ 186 /* TODO: Is this condition needed? Seems like it would always be TRUE */
191 if(old_name && !purple_strequal(priv->name, old_name)) { 187 if(old_name && !purple_strequal(priv->name, old_name)) {
192 for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) { 188 for (accts = purple_group_get_accounts(source); accts; accts = g_slist_remove(accts, accts->data)) {
293 /* Called when done constructing */ 289 /* Called when done constructing */
294 static void 290 static void
295 purple_group_constructed(GObject *object) { 291 purple_group_constructed(GObject *object) {
296 PurpleGroup *group = PURPLE_GROUP(object); 292 PurpleGroup *group = PURPLE_GROUP(object);
297 PurpleGroupPrivate *priv = purple_group_get_instance_private(group); 293 PurpleGroupPrivate *priv = purple_group_get_instance_private(group);
298 PurpleBlistUiOps *ops = purple_blist_get_ui_ops();
299 294
300 G_OBJECT_CLASS(purple_group_parent_class)->constructed(object); 295 G_OBJECT_CLASS(purple_group_parent_class)->constructed(object);
301 296
302 if (ops && ops->new_node) 297 purple_blist_new_node(PURPLE_BLIST_NODE(group));
303 ops->new_node(PURPLE_BLIST_NODE(group));
304 298
305 priv->is_constructed = TRUE; 299 priv->is_constructed = TRUE;
306 } 300 }
307 301
308 /* GObject finalize function */ 302 /* GObject finalize function */

mercurial