std::string buddy_get_group_name(PurpleBlistNode *p) { if (PURPLE_BLIST_NODE_IS_GROUP(p)) { return std::string(PURPLE_GROUP(p)->name ? PURPLE_GROUP(p)->name : ""); } else { if (p->parent) { return buddy_get_group_name(p->parent); } else { return ""; } } }
BuddyListGroup::BuddyListGroup(PurpleBlistNode *node_) : BuddyListNode(node_) { setColorScheme("buddylistgroup"); group = PURPLE_GROUP(blist_node); }
BuddyListGroup::GroupContextMenu::GroupContextMenu( BuddyListGroup& parent_group_) : ContextMenu(parent_group_), parent_group(&parent_group_) { appendExtendedMenu(); appendItem(_("Rename..."), sigc::mem_fun(this, &GroupContextMenu::onRename)); appendItem(_("Delete..."), sigc::mem_fun(this, &GroupContextMenu::onRemove)); if (BUDDYLIST->getGroupSortMode() == BuddyList::GROUP_SORT_BY_USER) { /* If the manual sorting is enabled then show a menu item and a submenu * for group moving. */ CppConsUI::MenuWindow *groups = new CppConsUI::MenuWindow(*this, AUTOSIZE, AUTOSIZE); groups->appendItem(_("-Top-"), sigc::bind( sigc::mem_fun(this, &GroupContextMenu::onMoveAfter), static_cast<PurpleGroup*>(NULL))); for (PurpleBlistNode *node = purple_blist_get_root(); node; node = purple_blist_node_get_sibling_next(node)) { if (!PURPLE_BLIST_NODE_IS_GROUP(node)) continue; PurpleGroup *group = PURPLE_GROUP(node); groups->appendItem(purple_group_get_name(group), sigc::bind( sigc::mem_fun(this, &GroupContextMenu::onMoveAfter), group)); } appendSubMenu(_("Move after..."), *groups); } }
static gboolean nested_group_can_add_node(PurpleBlistNode *node) { PurpleBlistNode *group; int len; if (!PURPLE_IS_GROUP(node)) return default_manager->can_add_node(node); if (default_manager->can_add_node(node)) return TRUE; len = strlen(purple_group_get_name(PURPLE_GROUP(node))); group = purple_blist_get_root(); for (; group; group = purple_blist_node_get_sibling_next(group)) { if (group == node) continue; if (strncmp(purple_group_get_name(PURPLE_GROUP(node)), purple_group_get_name(PURPLE_GROUP(group)), len) == 0 && default_manager->can_add_node(group)) return TRUE; } return FALSE; }
/* void Quit (); */ NS_IMETHODIMP purpleCoreService::Quit() { // This seems to happen when Windows is shutting down, don't know why... :( if (!mInitialized) return NS_OK; // Avoid reentering when called from the unload handler of the buddy list if (mQuitting) return NS_OK; mQuitting = PR_TRUE; nsresult rv; nsCOMPtr<nsIObserverService> os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); rv = os->RemoveObserver(this, "prpl-quit"); NS_ENSURE_SUCCESS(rv, rv); os->RemoveObserver(this, "idle-time-changed"); disconnect_blist_signals(); PurpleBlistNode *gnode; for (gnode = purple_blist_get_root(); gnode; gnode = gnode->next) { if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; imITag *tag = purpleAccountBuddy::GetTagFromPurpleGroup(PURPLE_GROUP(gnode)); NS_IF_RELEASE(tag); } mProxies.Clear(); mInitialized = PR_FALSE; purple_core_quit(); LOG(("purple_core_quit")); purpleSocketWatcher::unInit(); purpleNetworkObserver::unInit(); purpleDNS::unInit(); purpleTimer::unInit(); purpleGetText::unInit(); mQuitting = PR_FALSE; return NS_OK; }
static gpointer nested_group_find_parent(PurpleBlistNode *node) { char *name; PurpleGroup *group; char *sep; PurpleBlistNode *ret, *parent; GntTree *tree; if (!PURPLE_IS_GROUP(node)) return default_manager->find_parent(node); group = PURPLE_GROUP(node); name = g_strdup(purple_group_get_name(group)); if (!(sep = strchr(name, '/'))) { g_free(name); return default_manager->find_parent(node); } tree = finch_blist_get_tree(); parent = NULL; while (sep) { *sep = 0; if (*(sep + 1) && (ret = PURPLE_BLIST_NODE(purple_blist_find_group(name)))) { finch_blist_manager_add_node(ret); parent = ret; } else if (!(ret = g_hash_table_lookup(groups, name))) { ret = g_object_new(FINCH_TYPE_GROUPING_NODE, NULL); g_hash_table_insert(groups, g_strdup(name), ret); gnt_tree_add_row_last(tree, ret, gnt_tree_create_row(tree, name), parent); parent = ret; } *sep = '/'; sep = strchr(sep + 1, '/'); } g_free(name); return ret; }
BuddyListContact::ContactContextMenu::ContactContextMenu( BuddyListContact& parent_contact_) : ContextMenu(parent_contact_), parent_contact(&parent_contact_) { appendExtendedMenu(); if (parent_contact->isCollapsed()) appendItem(_("Expand"), sigc::bind(sigc::mem_fun(this, &ContactContextMenu::onExpandRequest), true)); else appendItem(_("Collapse"), sigc::bind(sigc::mem_fun(this, &ContactContextMenu::onExpandRequest), false)); appendItem(_("Information..."), sigc::mem_fun(this, &ContactContextMenu::onInformation)); appendItem(_("Alias..."), sigc::mem_fun(this, &ContactContextMenu::onChangeAlias)); appendItem(_("Delete..."), sigc::mem_fun(this, &ContactContextMenu::onRemove)); CppConsUI::MenuWindow *groups = new CppConsUI::MenuWindow(*this, AUTOSIZE, AUTOSIZE); for (PurpleBlistNode *node = purple_blist_get_root(); node; node = purple_blist_node_get_sibling_next(node)) { if (!PURPLE_BLIST_NODE_IS_GROUP(node)) continue; PurpleGroup *group = PURPLE_GROUP(node); CppConsUI::Button *button = groups->appendItem( purple_group_get_name(group), sigc::bind(sigc::mem_fun(this, &ContactContextMenu::onMoveTo), group)); if (purple_contact_get_group(parent_contact->getPurpleContact()) == group) button->grabFocus(); } appendSubMenu(_("Move to..."), *groups); }