|
From: <sa...@us...> - 2006-09-01 07:10:06
|
Revision: 17107
http://svn.sourceforge.net/gaim/?rev=17107&view=rev
Author: sadrul
Date: 2006-09-01 00:09:40 -0700 (Fri, 01 Sep 2006)
Log Message:
-----------
Add an option to 'Show offline buddies'.
Modified Paths:
--------------
trunk/console/gntblist.c
trunk/console/gntprefs.c
trunk/console/libgnt/gnttextview.c
Modified: trunk/console/gntblist.c
===================================================================
--- trunk/console/gntblist.c 2006-09-01 06:38:46 UTC (rev 17106)
+++ trunk/console/gntblist.c 2006-09-01 07:09:40 UTC (rev 17107)
@@ -109,11 +109,15 @@
gnt_tree_remove(GNT_TREE(ggblist->tree), node);
node->ui_data = NULL;
- if (GAIM_BLIST_NODE_IS_BUDDY(node))
- {
+ if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
GaimContact *contact = (GaimContact*)node->parent;
if (contact->online < 1)
node_remove(list, (GaimBlistNode*)contact);
+ } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
+ GaimGroup *group = (GaimGroup*)node->parent;
+ if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && group->online < 1) ||
+ group->currentsize < 1)
+ node_remove(list, node->parent);
}
draw_tooltip(ggblist);
}
@@ -136,7 +140,8 @@
if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
GaimBuddy *buddy = (GaimBuddy*)node;
- if (gaim_presence_is_online(gaim_buddy_get_presence(buddy)))
+ if (gaim_account_is_connected(buddy->account) &&
+ (GAIM_BUDDY_IS_ONLINE(buddy) || gaim_prefs_get_bool(PREF_ROOT "/showoffline")))
add_node((GaimBlistNode*)buddy, list->ui_data);
else
node_remove(gaim_get_blist(), node);
@@ -343,7 +348,6 @@
GaimBlistNode *node = (GaimBlistNode *)group;
if (node->ui_data)
return;
- gnt_tree_remove(GNT_TREE(ggblist->tree), group);
node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group,
gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL);
}
@@ -416,7 +420,6 @@
group = gaim_chat_get_group(chat);
add_node((GaimBlistNode*)group, ggblist);
- gnt_tree_remove(GNT_TREE(ggblist->tree), chat);
node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat,
gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
group, NULL);
@@ -430,15 +433,20 @@
{
GaimGroup *group;
GaimBlistNode *node = (GaimBlistNode*)contact;
+ const char *name;
if (node->ui_data)
return;
+ name = get_display_name(node);
+ if (name == NULL)
+ return;
+
group = (GaimGroup*)node->parent;
add_node((GaimBlistNode*)group, ggblist);
node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact,
- gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
+ gnt_tree_create_row(GNT_TREE(ggblist->tree), name),
group, NULL);
gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE);
@@ -455,7 +463,6 @@
contact = (GaimContact*)node->parent;
add_node((GaimBlistNode*)contact, ggblist);
- gnt_tree_remove(GNT_TREE(ggblist->tree), buddy);
node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy,
gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)),
contact, NULL);
@@ -1195,8 +1202,7 @@
gaim_get_blist()->ui_data = NULL;
node = gaim_blist_get_root();
- while (node)
- {
+ while (node) {
node->ui_data = NULL;
node = gaim_blist_node_next(node, TRUE);
}
@@ -1284,6 +1290,20 @@
items, (GDestroyNotify)destroy_status_list);
}
+static void
+redraw_blist(const char *name, GaimPrefType type, gconstpointer val, gpointer data)
+{
+ GaimBlistNode *node;
+ if (ggblist == NULL)
+ return;
+
+ gnt_tree_remove_all(GNT_TREE(ggblist->tree));
+ node = gaim_blist_get_root();
+ for (; node; node = gaim_blist_node_next(node, TRUE))
+ node->ui_data = NULL;
+ populate_buddylist();
+}
+
void gg_blist_init()
{
gaim_prefs_add_none(PREF_ROOT);
@@ -1293,9 +1313,14 @@
gaim_prefs_add_none(PREF_ROOT "/position");
gaim_prefs_add_int(PREF_ROOT "/position/x", 0);
gaim_prefs_add_int(PREF_ROOT "/position/y", 0);
+ gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE);
+ gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE);
gg_blist_show();
+ gaim_prefs_connect_callback(gg_blist_get_handle(),
+ PREF_ROOT "/showoffline", redraw_blist, NULL);
+
return;
}
Modified: trunk/console/gntprefs.c
===================================================================
--- trunk/console/gntprefs.c 2006-09-01 06:38:46 UTC (rev 17106)
+++ trunk/console/gntprefs.c 2006-09-01 07:09:40 UTC (rev 17107)
@@ -14,9 +14,6 @@
gaim_prefs_add_none("/gaim/gnt/plugins");
gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL);
- gaim_prefs_add_none("/gaim/gnt/blist");
- gaim_prefs_add_bool("/gaim/gnt/blist/idletime", TRUE);
-
gaim_prefs_add_none("/gaim/gnt/conversations");
gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE);
gaim_prefs_add_bool("/gaim/gnt/conversations/notify_typing", FALSE); /* XXX: Not functional yet */
@@ -99,6 +96,7 @@
static Prefs blist[] =
{
{GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", N_("Show Idle Time"), NULL},
+ {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/showoffline", N_("Show Offline Buddies"), NULL},
{GAIM_PREF_NONE, NULL, NULL, NULL}
};
Modified: trunk/console/libgnt/gnttextview.c
===================================================================
--- trunk/console/libgnt/gnttextview.c 2006-09-01 06:38:46 UTC (rev 17106)
+++ trunk/console/libgnt/gnttextview.c 2006-09-01 07:09:40 UTC (rev 17107)
@@ -100,7 +100,7 @@
{
if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED))
{
- gnt_widget_set_size(widget, 64, 24);
+ gnt_widget_set_size(widget, 64, 20);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|