annotate src/buddy.c @ 4810:0abbbeec0ee8

[gaim-migrate @ 5130] This will make grey text revert back to the "normal" color when you click on it, which lets gtk handle making it legible. Or something cool like that. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 17 Mar 2003 07:21:13 +0000
parents 315ef59a5031
children f9cc606607dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
22 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2048
diff changeset
23 #include <config.h>
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
24 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
25 #ifdef GAIM_PLUGINS
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
26 #ifndef _WIN32
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
27 #include <dlfcn.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
28 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
29 #endif /* GAIM_PLUGINS */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <stdlib.h>
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3154
diff changeset
33 #include <ctype.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <math.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <time.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
36 #include <ctype.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
37
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
38 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
39 #include <gdk/gdkwin32.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
40 #else
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1230
diff changeset
41 #include <unistd.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
42 #include <gdk/gdkx.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
43 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
45 #include <gdk/gdkkeysyms.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <gtk/gtk.h>
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
47 #include "prpl.h"
4561
9df99116840a [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4553
diff changeset
48 #include "sound.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 #include "gaim.h"
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
50 #include "gtklist.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
51 #include "gtkft.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
52
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
53 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
54 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
55 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
56
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
57 static struct gaim_gtk_buddy_list *gtkblist = NULL;
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
58
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
59 /* Docklet nonsense */
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
60 static gboolean gaim_gtk_blist_obscured = FALSE;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
61
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
62 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
63 static void gaim_gtk_blist_update(struct gaim_buddy_list *list, GaimBlistNode *node);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
64 static char *gaim_get_tooltip_text(struct buddy *b);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
65 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
66
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
67 /***************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
68 * Callbacks *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
69 ***************************************************/
3869
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
70
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
71 static void gaim_gtk_blist_destroy_cb()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
72 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
73 if (docklet_count)
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
74 gaim_blist_set_visible(FALSE);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
75 else
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
76 do_quit();
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
77 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
78
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
79 static void gtk_blist_menu_info_cb(GtkWidget *w, struct buddy *b)
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
80 {
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
81 serv_get_info(b->account->gc, b->name);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
82 }
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
83
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
84 static void gtk_blist_menu_im_cb(GtkWidget *w, struct buddy *b)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
85 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
86 gaim_conversation_new(GAIM_CONV_IM, b->account, b->name);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
87 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
88
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
89 static void gtk_blist_menu_alias_cb(GtkWidget *w, struct buddy *b)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
90 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
91 alias_dialog_bud(b);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
92 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
93
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
94 static void gtk_blist_menu_bp_cb(GtkWidget *w, struct buddy *b)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
95 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
96 show_new_bp(b->name, b->account->gc, b->idle,
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
97 b->uc & UC_UNAVAILABLE, NULL);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
98 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
99
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
100 static void gtk_blist_menu_showlog_cb(GtkWidget *w, struct buddy *b)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
101 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
102 show_log(b->name);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
103 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
104
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
105 static void gtk_blist_show_systemlog_cb()
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
106 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
107 show_log(NULL);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
108 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
109
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
110 static void gtk_blist_show_onlinehelp_cb()
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
111 {
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
112 open_url(NULL, "http://gaim.sourceforge.net/documentation.php");
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
113 }
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
114
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
115 static void gtk_blist_button_im_cb(GtkWidget *w, GtkTreeView *tv)
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
116 {
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
117 GtkTreeIter iter;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
118 GtkTreeModel *model = gtk_tree_view_get_model(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
119 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
120
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
121 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
122 GaimBlistNode *node;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
123
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
124 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
125 if (GAIM_BLIST_NODE_IS_BUDDY(node))
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
126 gaim_conversation_new(GAIM_CONV_IM, ((struct buddy*)node)->account, ((struct buddy*)node)->name);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
127 }
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
128 }
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
129
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
130 static void gtk_blist_button_info_cb(GtkWidget *w, GtkTreeView *tv)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
131 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
132 GtkTreeIter iter;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
133 GtkTreeModel *model = gtk_tree_view_get_model(tv);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
134 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
135
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
136 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
137 GaimBlistNode *node;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
138
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
139 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
140 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
141 serv_get_info(((struct buddy*)node)->account->gc, ((struct buddy*)node)->name);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
142 return;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
143 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
144 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
145 show_info_dialog();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
146 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
147
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
148 static void gtk_blist_button_chat_cb(GtkWidget *w, gpointer data)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
149 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
150 /* FIXME: someday, we can check to see if we've selected a chat node */
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
151 join_chat();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
152 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
153
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
154 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
155 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
156 gtk_menu_popup(GTK_MENU(awaymenu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
157 }
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
158
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
159 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
160 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
161 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
162 GValue val = { 0, };
3154
a0a0b00f214b [gaim-migrate @ 3170]
Sean Egan <seanegan@gmail.com>
parents: 3152
diff changeset
163
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
164 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
165
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
166 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
167 node = g_value_get_pointer(&val);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
168
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
169 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
170 gaim_conversation_new(GAIM_CONV_IM, ((struct buddy*)node)->account, ((struct buddy*)node)->name);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
171 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
172 if (gtk_tree_view_row_expanded(tv, path))
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
173 gtk_tree_view_collapse_row(tv, path);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
174 else
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
175 gtk_tree_view_expand_row(tv,path,FALSE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
176 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
177 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
178
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
179 static void gaim_proto_menu_cb(GtkMenuItem *item, struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
180 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
181 struct proto_buddy_menu *pbm = g_object_get_data(G_OBJECT(item), "gaimcallback");
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
182 if (pbm->callback)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
183 pbm->callback(pbm->gc, b->name);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
184 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
185
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
186 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer null)
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
187 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
188 GtkTreePath *path;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
189 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
190 GValue val = { 0, };
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
191 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
192 GtkWidget *menu, *menuitem;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
193 GtkWidget *image;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
194 GtkTreeSelection *sel;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
195 GList *list;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
196 struct prpl *prpl;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
197
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
198 if (event->button != 3)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
199 return FALSE;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
200
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
201 /* Here we figure out which node was clicked */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
202 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
203 return FALSE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
204 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
205 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
206 node = g_value_get_pointer(&val);
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
207
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
208 if (!GAIM_BLIST_NODE_IS_BUDDY(node)) {
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
209 gtk_tree_path_free(path);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
210 return FALSE;
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
211 }
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
212
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
213 menu = gtk_menu_new();
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
214
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
215 /* Protocol specific options */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
216 prpl = find_prpl(((struct buddy*)node)->account->protocol);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
217
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
218 if(prpl && prpl->get_info) {
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
219 menuitem = gtk_image_menu_item_new_with_mnemonic("_Get Info");
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
220 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_info_cb), node);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
221 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
222 }
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
223
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
224 menuitem = gtk_image_menu_item_new_with_mnemonic("_IM");
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
225 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_im_cb), node);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
226 image = gtk_image_new_from_stock(GAIM_STOCK_IM, GTK_ICON_SIZE_MENU);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
227 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
228 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
229
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
230 menuitem = gtk_image_menu_item_new_with_mnemonic("_Alias");
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
231 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_alias_cb), node);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
232 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
233
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
234 menuitem = gtk_image_menu_item_new_with_mnemonic("Add Buddy _Pounce");
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
235 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_bp_cb), node);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
236 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
237
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
238 menuitem = gtk_image_menu_item_new_with_mnemonic("View _Log");
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
239 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_showlog_cb), node);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
240 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
241
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
242 if (prpl) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
243 list = prpl->buddy_menu(((struct buddy*)node)->account->gc, ((struct buddy*)node)->name);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
244 while (list) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
245 struct proto_buddy_menu *pbm = list->data;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
246 menuitem = gtk_menu_item_new_with_mnemonic(pbm->label);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
247 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", pbm);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
248 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gaim_proto_menu_cb), node);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
249 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
250 list = list->next;
3313
b0d5ce77f7dd [gaim-migrate @ 3331]
Jim Seymour <jseymour>
parents: 3279
diff changeset
251 }
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
252 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
253
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
254 gtk_widget_show_all(menu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
255
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
256 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
257
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
258 #if (1) /* This code only exists because GTK doesn't work. If we return FALSE here, as would be normal
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
259 * the event propoagates down and somehow gets interpreted as the start of a drag event. */
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
260 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
261 gtk_tree_selection_select_path(sel, path);
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
262 gtk_tree_path_free(path);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
263 return TRUE;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
264 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
265 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
266
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
267 /* This is called 10 seconds after the buddy logs in. It removes the "logged in" icon and replaces it with
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
268 * the normal status icon */
1072
81d19577285a [gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1070
diff changeset
269
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
270 static gboolean gaim_reset_present_icon(GaimBlistNode *b)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
271 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
272 ((struct buddy*)b)->present = 1;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
273 gaim_gtk_blist_update(NULL, b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
274 return FALSE;
577
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
275 }
aa9a8bcddd80 [gaim-migrate @ 587]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 544
diff changeset
276
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
277 static void gaim_gtk_blist_add_buddy_cb()
935
5e6ca3dd4d02 [gaim-migrate @ 945]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 921
diff changeset
278 {
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
279 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
280 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
281 GaimBlistNode *node;
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
282
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
283 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
284 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
4691
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
285 if (GAIM_BLIST_NODE_IS_BUDDY(node))
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
286 show_add_buddy(NULL, NULL, ((struct group*)node->parent)->name, NULL);
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
287 else if (GAIM_BLIST_NODE_IS_GROUP(node))
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
288 show_add_buddy(NULL, NULL, ((struct group*)node)->name, NULL);
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
289 }
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
290 else {
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
291 show_add_buddy(NULL, NULL, NULL, NULL);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
292 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
293 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
294
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
295 static void gaim_gtk_blist_update_toolbar_icons (GtkWidget *widget, gpointer data) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
296 if (GTK_IS_IMAGE(widget)) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
297 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
298 gtk_widget_show(widget);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
299 else
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
300 gtk_widget_hide(widget);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
301 } else if (GTK_IS_CONTAINER(widget)) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
302 gtk_container_foreach(GTK_CONTAINER(widget), gaim_gtk_blist_update_toolbar_icons, NULL);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
303 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
304 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
306 static void gaim_gtk_blist_drag_data_get_cb (GtkWidget *widget,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
307 GdkDragContext *dc,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
308 GtkSelectionData *data,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
309 guint info,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
310 guint time,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
311 gpointer *null)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
312 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
313 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) {
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
314 GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
315 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
316 GtkTreeIter iter;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
317 GaimBlistNode *node = NULL;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
318 GValue val = {0};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
319 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
320 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
321 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
322 gtk_selection_data_set (data,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
323 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
324 8, /* bits */
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
325 (void*)&node,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
326 sizeof (node));
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
327
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
328 gtk_tree_path_free(sourcerow);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
329 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
330
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
331 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
332
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
333 static void gaim_gtk_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
334 GtkSelectionData *sd, guint info, guint t)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
335 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
336 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
337 GaimBlistNode *n = NULL;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
338 GtkTreePath *path = NULL;
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
339 GtkTreeViewDropPosition position;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
340 memcpy(&n, sd->data, sizeof(n));
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
341 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
342 /* if we're here, I think it means the drop is ok */
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
343 GtkTreeIter iter;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
344 GaimBlistNode *node;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
345 GValue val = {0};
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
346 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
347 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
348 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
349
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
350 if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
351 struct buddy *b = (struct buddy*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
352 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
353 switch(position) {
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
354 case GTK_TREE_VIEW_DROP_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
355 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
356 gaim_blist_add_buddy(b, (struct group*)node->parent, node);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
357 break;
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
358 case GTK_TREE_VIEW_DROP_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
359 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
360 gaim_blist_add_buddy(b, (struct group*)node->parent, node->prev);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
361 break;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
362 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
363 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
364 gaim_blist_add_buddy(b, (struct group*)node, NULL);
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
365 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
366 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
367 struct group *g = (struct group*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
368 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
369 switch (position) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
370 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
371 case GTK_TREE_VIEW_DROP_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
372 gaim_blist_add_group(g, node);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
373 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
374 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
375 case GTK_TREE_VIEW_DROP_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
376 gaim_blist_add_group(g, node->prev);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
377 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
378 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
379
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
380 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
381
4777
e23a7e166680 [gaim-migrate @ 5097]
Nathan Walp <nwalp@pidgin.im>
parents: 4776
diff changeset
382 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
383
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
384 gtk_tree_path_free(path);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
385 }
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
386 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
387 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
388
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
389 static void gaim_gtk_blist_paint_tip(GtkWidget *widget, GdkEventExpose *event, struct buddy *b)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
390 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
391 GtkStyle *style;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
392 GdkPixbuf *pixbuf = gaim_gtk_blist_get_status_icon(b, GAIM_STATUS_ICON_LARGE);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
393 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
394 char *tooltiptext = gaim_get_tooltip_text(b);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
395
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
396 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
397 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
398 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
399 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
400 style = gtkblist->tipwindow->style;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
401
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
402 gtk_paint_flat_box (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
403 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
404
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
405 #if GTK_CHECK_VERSION(2,2,0)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
406 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
407 0, 0, 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
408 #else
4758
2202f056a1c9 [gaim-migrate @ 5075]
Nathan Walp <nwalp@pidgin.im>
parents: 4757
diff changeset
409 gdk_pixbuf_render_to_drawable(pixbuf, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
410 #endif
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
411
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
412 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, TRUE,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
413 NULL, gtkblist->tipwindow, "tooltip", 38, 4, layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
414
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
415 g_object_unref (pixbuf);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
416 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
417 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
418 return;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
419 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
420
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
421 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
422 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
423 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
424 GtkTreeIter iter;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
425 GaimBlistNode *node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
426 GValue val = {0};
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
427
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
428 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->rect.x, gtkblist->rect.y, &path, NULL, NULL, NULL))
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
429 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
430 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
431 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
432 node = g_value_get_pointer(&val);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
433
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
434 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
435 int scr_w,scr_h, w, h, x, y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
436 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
437 struct buddy *buddy = (struct buddy*)node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
438 char *tooltiptext = gaim_get_tooltip_text(buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
439 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
440 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
441 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
442 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
443 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
444 G_CALLBACK(gaim_gtk_blist_paint_tip), buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
445 gtk_widget_ensure_style (gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
446
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
447 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
448 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
449 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
450 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
451 scr_w = gdk_screen_width();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
452 scr_h = gdk_screen_height();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
453 pango_layout_get_size (layout, &w, &h);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
454 w = PANGO_PIXELS(w) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
455 h = PANGO_PIXELS(h) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
456
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
457 /* 38 is the size of a large status icon plus 4 pixels padding on each side.
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
458 I should #define this or something */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
459 w = w + 38;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
460 h = MAX(h, 38);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
461
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
462 gdk_window_get_pointer(NULL, &x, &y, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
463 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
464 y+=gtkblist->window->allocation.y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
465
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
466 x -= ((w >> 1) + 4);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
467
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
468 if ((x + w) > scr_w)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
469 x -= (x + w) - scr_w;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
470 else if (x < 0)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
471 x = 0;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
472
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
473 if ((y + h + 4) > scr_h)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
474 y = y - h;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
475 else
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
476 y = y + 6;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
477 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
478 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
479 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
480 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
481 gtk_widget_show(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
482 }
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
483
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
484 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
485 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
486 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
487
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
488 static gboolean gaim_gtk_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
489 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
490 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
491
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
492 if (gtkblist->timeout) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
493 if ((event->y > gtkblist->rect.y) && ((event->y - gtkblist->rect.height) < gtkblist->rect.y))
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
494 return FALSE;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
495 /* We've left the cell. Remove the timeout and create a new one below */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
496 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
497 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
498 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
499 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
500
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
501 g_source_remove(gtkblist->timeout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
502 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
503
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
504 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
505 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->rect);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
506 if (path)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
507 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
508 gtkblist->timeout = g_timeout_add(500, (GSourceFunc)gaim_gtk_blist_tooltip_timeout, tv);
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
509 return FALSE;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
510 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
511
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
512 static void gaim_gtk_blist_leave_cb (GtkWidget *w, GdkEventCrossing *e, gpointer n)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
513 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
514 if (gtkblist->timeout == 0)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
515 return;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
516 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
517 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
518 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
519 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
520 g_source_remove(gtkblist->timeout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
521 gtkblist->timeout = 0;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
522 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
523
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
524 /***************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
525 * Crap *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
526 ***************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
527 static GtkItemFactoryEntry blist_menu[] =
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
528 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
529 /* Buddies menu */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
530 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
531 { N_("/Buddies/_Add A Buddy..."), "<CTL>B", gaim_gtk_blist_add_buddy_cb, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
532 "<StockItem>", GTK_STOCK_ADD },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
533 { N_("/Buddies/New _Instant Message..."), "<CTL>I", show_im_dialog, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
534 "<StockItem>", GAIM_STOCK_IM },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
535 { N_("/Buddies/Join a _Chat..."), "<CTL>C", join_chat, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
536 "<StockItem>", GAIM_STOCK_CHAT },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
537 { N_("/Buddies/sep1"), NULL, NULL, 0, "<Separator>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
538 { N_("/Buddies/Get _User Info..."), "<CTL>J", show_info_dialog, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
539 "<StockItem>", GAIM_STOCK_INFO },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
540 { N_("/Buddies/sep2"), NULL, NULL, 0, "<Separator>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
541 { N_("/Buddies/_Signoff"), "<CTL>D", signoff_all, 0, NULL },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
542 { N_("/Buddies/_Quit"), "<CTL>Q", do_quit, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
543 "<StockItem>", GTK_STOCK_QUIT },
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
544
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
545 /* Tools */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
546 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
547 { N_("/Tools/_Away"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
548 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
549 { N_("/Tools/sep1"), NULL, NULL, 0, "<Separator>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
550 { N_("/Tools/A_ccounts"), "<CTL>A", account_editor, 0, NULL },
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
551 { N_("/Tools/Preferences"), "<CTL>P", show_prefs, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
552 "<StockItem>", GTK_STOCK_PREFERENCES },
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
553 { N_("/Tools/_File Transfers"), NULL, gaim_show_xfer_dialog, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
554 "<StockItem>", GTK_STOCK_REVERT_TO_SAVED },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
555 { N_("/Tools/sep2"), NULL, NULL, 0, "<Separator>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
556 { N_("/Tools/P_rotocol Actions"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
557 { N_("/Tools/Pr_ivacy"), NULL, show_privacy_options, 0, NULL },
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
558 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL },
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
559
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
560 /* Help */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
561 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
562 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
563 "<StockItem>", GTK_STOCK_HELP },
4755
54fbd9769677 [gaim-migrate @ 5072]
Mark Doliner <mark@kingant.net>
parents: 4745
diff changeset
564 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
565 { N_("/Help/_About"), NULL, show_about, 0, NULL },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
566
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
567 };
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
568
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
569 /*********************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
570 * Private Utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
571 *********************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
572
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
573 static char *gaim_get_tooltip_text(struct buddy *b)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
574 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
575 char *text = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
576 struct prpl* prpl = find_prpl(b->account->protocol);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
577 char *statustext = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
578 char *warning = NULL, *idletime = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
579
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
580 if (prpl->tooltip_text) {
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
581 statustext = prpl->tooltip_text(b);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
582 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
583
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
584 if (b->idle) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
585 int ihrs, imin;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
586 time_t t;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
587 time(&t);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
588 ihrs = (t - b->idle) / 3600;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
589 imin = ((t - b->idle) / 60) % 60;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
590 if (ihrs)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
591 idletime = g_strdup_printf(_("%dh%02dm"), ihrs, imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
592 else
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
593 idletime = g_strdup_printf(_("%dm"), imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
594 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
595
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
596 if (b->evil > 0)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
597 warning = g_strdup_printf(_("%d%%"), b->evil);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
598
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
599 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>"
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
600 "%s %s" /* Alias */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
601 "%s %s" /* Nickname */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
602 "%s %s" /* Idle */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
603 "%s %s" /* Warning */
4741
dbd0761f8814 [gaim-migrate @ 5056]
Sean Egan <seanegan@gmail.com>
parents: 4737
diff changeset
604 "%s%s", /* Status */
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
605 b->name,
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
606 b->alias && b->alias[0] ? _("\n<b>Alias:</b>") : "", b->alias ? b->alias : "",
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
607 b->server_alias ? _("\n<b>Nickname:</b>") : "", b->server_alias ? b->server_alias : "",
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
608 b->idle ? _("\n<b>Idle:</b>") : "", b->idle ? idletime : "",
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
609 b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
610 statustext ? "\n" : "", statustext ? statustext : "");
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
611 if(warning)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
612 g_free(warning);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
613 if(idletime)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
614 g_free(idletime);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
615 if(statustext)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
616 g_free(statustext);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
617
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
618 return text;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
619
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
620 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
621
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
622 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
623 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
624 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
625 GdkPixbuf *scale = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
626 GdkPixbuf *emblem = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
627 gchar *filename = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
628 const char *protoname = NULL;
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
629
4691
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
630 char *se = NULL, *sw = NULL ,*nw = NULL ,*ne = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
631
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
632 int scalesize = 30;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
633
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
634 struct prpl* prpl = find_prpl(b->account->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
635 if (prpl->list_icon)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
636 protoname = prpl->list_icon(b->account, b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
637 if (prpl->list_emblems)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
638 prpl->list_emblems(b, &se, &sw, &nw, &ne);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
639
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
640 if (size == GAIM_STATUS_ICON_SMALL) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
641 scalesize = 15;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
642 sw = nw = ne = NULL; /* So that only the se icon will composite */
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
643 }
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
644
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
645
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
646 if (b->present == 2) {
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
647 struct gaim_gtk_blist_node *gtknode;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
648 /* If b->present is 2, that means this buddy has just signed on. We use the "login" icon for the
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
649 * status, and we set a timeout to change it to a normal icon after 10 seconds. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
650 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
651 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
652 g_free(filename);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
653
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
654 gtknode = GAIM_GTK_BLIST_NODE((GaimBlistNode*)b);
4773
75f0c2799664 [gaim-migrate @ 5092]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
655 if (gtknode->timer > 0)
75f0c2799664 [gaim-migrate @ 5092]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
656 g_source_remove(gtknode->timer);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
657 gtknode->timer = g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
658
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
659 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
660 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
661 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
662 char *image = g_strdup_printf("%s.png", protoname);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
663 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
664 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
665 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
666 g_free(filename);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
667
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
668 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
669
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
670 if (!status)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
671 return NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
672
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
673 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize, GDK_INTERP_BILINEAR);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
674
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
675 g_object_unref(G_OBJECT(status));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
676
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
677 /* Emblems */
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
678
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
679 /* Each protocol can specify up to four "emblems" to composite over the base icon. "away", "busy", "mobile user"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
680 * are all examples of states represented by emblems. I'm not even really sure I like this yet. */
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
681
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
682 /* XXX Clean this crap up, yo. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
683 if (se) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
684 char *image = g_strdup_printf("%s.png", se);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
685 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
686 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
687 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
688 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
689 if (emblem) {
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
690 if (size == GAIM_STATUS_ICON_LARGE)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
691 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
692 scale, 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
693 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
694 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
695 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
696 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
697 255);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
698 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
699 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
700 scale, 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
701 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
702 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
703 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
704 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
705 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
706 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
707 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
708 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
709 if (sw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
710 char *image = g_strdup_printf("%s.png", sw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
711 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
712 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
713 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
714 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
715 if (emblem) {
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
716 gdk_pixbuf_composite (emblem,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
717 scale, 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
718 15, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
719 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
720 1, 1,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
721 GDK_INTERP_BILINEAR,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
722 255);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
723 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
724 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
725 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
726 if (nw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
727 char *image = g_strdup_printf("%s.png", nw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
728 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
729 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
730 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
731 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
732 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
733 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
734 scale, 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
735 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
736 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
737 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
738 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
739 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
740 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
741 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
742 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
743 if (ne) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
744 char *image = g_strdup_printf("%s.png", ne);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
745 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
746 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
747 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
748 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
749 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
750 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
751 scale, 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
752 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
753 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
754 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
755 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
756 255);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
757 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
758 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
759
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
760
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
761 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
762 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
763 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0, FALSE);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
764 return scale;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
765 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
766
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
767 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
768 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
769 /* This just opens a file from ~/.gaim/icons/screenname. This needs to change to be more gooder. */
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
770 char *file;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
771 GdkPixbuf *buf, *ret;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
772
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
773 if (!(blist_options & OPT_BLIST_SHOW_ICONS))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
774 return NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
775
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
776 if ((file = gaim_buddy_get_setting(b, "buddy_icon")) == NULL)
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
777 return NULL;
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
778
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
779 buf = gdk_pixbuf_new_from_file(file, NULL);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
780 g_free(file);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
781
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
782
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
783 if (buf) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
784 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
785 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0, FALSE);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
786 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
787 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
788 g_object_unref(G_OBJECT(buf));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
789 return ret;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
790 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
791 return NULL;
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
792 }
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
793
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
794 static gchar *gaim_gtk_blist_get_name_markup(struct buddy *b, gboolean selected)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
795 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
796 char *name = gaim_get_buddy_alias(b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
797 char *esc = g_markup_escape_text(name, strlen(name)), *text = NULL;
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
798 struct prpl* prpl = find_prpl(b->account->protocol);
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
799
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
800 /* XXX Clean up this crap */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
801
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
802 int ihrs, imin;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
803 char *idletime = NULL, *warning = NULL, *statustext = NULL;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
804 time_t t;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
805
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
806 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) {
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
807 if (b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
808 text = g_strdup_printf("<span color='dim grey'>%s</span>",
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
809 esc);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
810 g_free(esc);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
811 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
812 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
813 return esc;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
814 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
815 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
816
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
817 time(&t);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
818 ihrs = (t - b->idle) / 3600;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
819 imin = ((t - b->idle) / 60) % 60;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
820
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
821 if (prpl->status_text) {
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
822 char *tmp = prpl->status_text(b);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
823
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
824 if(tmp) {
4806
315ef59a5031 [gaim-migrate @ 5126]
Nathan Walp <nwalp@pidgin.im>
parents: 4797
diff changeset
825 g_strdelimit(tmp, "\n", ' ');
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
826 if(strlen(tmp) > 20)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
827 statustext = g_strdup_printf("%.20s... ", tmp);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
828 else
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
829 statustext = g_strdup_printf("%s ", tmp);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
830 g_free(tmp);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
831 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
832 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
833
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
834 if (b->idle) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
835 if (ihrs)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
836 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
837 else
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
838 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
839 }
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
840
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
841 if (b->evil > 0)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
842 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
843
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
844 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS && !selected) {
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
845 text = g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s%s%s</span>",
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
846 esc,
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
847 statustext != NULL ? statustext : "",
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
848 idletime != NULL ? idletime : "",
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
849 warning != NULL ? warning : "");
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
850 } else if (statustext == NULL && idletime == NULL && warning == NULL) {
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
851 text = g_strdup_printf("%s", esc);
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
852 } else {
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
853 text = g_strdup_printf("%s\n<span %s size='smaller'>%s%s%s</span>", esc,
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
854 selected ? "" : "color='dim grey'",
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
855 statustext != NULL ? statustext : "",
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
856 idletime != NULL ? idletime : "",
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
857 warning != NULL ? warning : "");
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
858 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
859 if (idletime)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
860 g_free(idletime);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
861 if (warning)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
862 g_free(warning);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
863 if (statustext)
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
864 g_free(statustext);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
865 if (esc)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
866 g_free(esc);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
867
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
868 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
869 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
870
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
871 /**********************************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
872 * Public API Functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
873 **********************************************************************************/
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
874 static void gaim_gtk_blist_new_list(struct gaim_buddy_list *blist)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
875 {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
876 blist->ui_data = g_new0(struct gaim_gtk_buddy_list, 1);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
877 }
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
878
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
879 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
880 {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
881 node->ui_data = g_new0(struct gaim_gtk_blist_node, 1);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
882 }
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
883
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
884 void gaim_gtk_blist_update_columns()
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
885 {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
886 if (blist_options & OPT_BLIST_SHOW_ICONS) {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
887 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
888 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
889 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
890 } else {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
891 gtk_tree_view_column_set_visible(gtkblist->idle_column, blist_options & OPT_BLIST_SHOW_IDLETIME);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
892 gtk_tree_view_column_set_visible(gtkblist->warning_column, blist_options & OPT_BLIST_SHOW_WARN);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
893 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
894 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
895 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
896
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
897 enum {DRAG_BUDDY, DRAG_ROW};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
898
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
899 static void gaim_gtk_blist_show(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
900 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
901 GtkItemFactory *ift;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
902 GtkCellRenderer *rend;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
903 GtkTreeViewColumn *column;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
904 GtkWidget *sw;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
905 GtkWidget *button;
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
906 GtkSizeGroup *sg;
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
907 GtkTreeSelection *selection;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
908 GtkTargetEntry gte[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
909 {"application/x-im-contact", 0, DRAG_BUDDY}};
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
910
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
911 if (gtkblist && gtkblist->window) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
912 gtk_widget_show(gtkblist->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
913 return;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
914 }
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
915
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
916 gtkblist = GAIM_GTK_BLIST(list);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
917
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
918 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
919 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
920
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
921 gtkblist->vbox = gtk_vbox_new(FALSE, 6);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
922 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
923
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
924 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gaim_gtk_blist_destroy_cb), NULL);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
925
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
926 /******************************* Menu bar *************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
927 ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
928 gtk_item_factory_create_items(ift, sizeof(blist_menu) / sizeof(*blist_menu),
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
929 blist_menu, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
930 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtk_item_factory_get_widget(ift, "<GaimMain>"), FALSE, FALSE, 0);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
931
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
932 awaymenu = gtk_item_factory_get_widget(ift, "/Tools/Away");
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
933 do_away_menu();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
934
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
935 bpmenu = gtk_item_factory_get_widget(ift, "/Tools/Buddy Pounce");
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
936 do_bp_menu();
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
937
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
938 protomenu = gtk_item_factory_get_widget(ift, "/Tools/Protocol Actions");
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
939 do_proto_menu();
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
940
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
941 /****************************** GtkTreeView **********************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
942 sw = gtk_scrolled_window_new(NULL,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
943 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
944 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
945 gtk_widget_set_size_request(sw, 200, 200);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
946
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
947 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
948 G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
949
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
950 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
951
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
952 /* Set up selection stuff */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
953
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
954 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
955 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(gaim_gtk_blist_selection_changed), NULL);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
956
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
957
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
958 /* Set up dnd */
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
959 gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview), GDK_BUTTON1_MASK, gte,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
960 2, GDK_ACTION_COPY);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
961 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview), gte, 2,
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
962 GDK_ACTION_COPY | GDK_ACTION_MOVE);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
963 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-received", G_CALLBACK(gaim_gtk_blist_drag_data_rcv_cb), NULL);
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
964 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(gaim_gtk_blist_drag_data_get_cb), NULL);
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
965
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
966 /* Tooltips */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
967 g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(gaim_gtk_blist_motion_cb), NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
968 g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(gaim_gtk_blist_leave_cb), NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
969
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
970 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
971
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
972 rend = gtk_cell_renderer_pixbuf_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
973 column = gtk_tree_view_column_new_with_attributes("Status", rend, "pixbuf", STATUS_ICON_COLUMN, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
974 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
4796
15f4f0ae5d5e [gaim-migrate @ 5116]
Rob Flynn <gaim@robflynn.com>
parents: 4795
diff changeset
975 g_object_set(rend, "ypad", 0, NULL);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
976
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
977 rend = gtk_cell_renderer_text_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
978 column = gtk_tree_view_column_new_with_attributes("Name", rend, "markup", NAME_COLUMN, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
979 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
980 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
981
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
982 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
983 gtkblist->warning_column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL);
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
984 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->warning_column);
4796
15f4f0ae5d5e [gaim-migrate @ 5116]
Rob Flynn <gaim@robflynn.com>
parents: 4795
diff changeset
985 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
986
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
987 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
988 gtkblist->idle_column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL);
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
989 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->idle_column);
4796
15f4f0ae5d5e [gaim-migrate @ 5116]
Rob Flynn <gaim@robflynn.com>
parents: 4795
diff changeset
990 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
991
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
992 rend = gtk_cell_renderer_pixbuf_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
993 gtkblist->buddy_icon_column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL);
4796
15f4f0ae5d5e [gaim-migrate @ 5116]
Rob Flynn <gaim@robflynn.com>
parents: 4795
diff changeset
994 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
995 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->buddy_icon_column);
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
996
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
997 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
998 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
999
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1000 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1001 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1002 gaim_gtk_blist_update_columns();
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1003 /**************************** Button Box **************************************/
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1004
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1005 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1006 gtkblist->bbox = gtk_hbox_new(TRUE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1007 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1008 button = gaim_pixbuf_button_from_stock(_("IM"), GAIM_STOCK_IM, GAIM_BUTTON_VERTICAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1009 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1010 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1011 gtk_size_group_add_widget(sg, button);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
1012 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_im_cb),
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1013 gtkblist->treeview);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1014
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1015 button = gaim_pixbuf_button_from_stock(_("Get Info"), GAIM_STOCK_INFO, GAIM_BUTTON_VERTICAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1016 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1017 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1018 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1019 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_info_cb),
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1020 gtkblist->treeview);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1021
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1022 button = gaim_pixbuf_button_from_stock(_("Chat"), GAIM_STOCK_CHAT, GAIM_BUTTON_VERTICAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1023 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1024 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1025 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1026 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_chat_cb), NULL);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1027
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1028 button = gaim_pixbuf_button_from_stock(_("Away"), GAIM_STOCK_AWAY, GAIM_BUTTON_VERTICAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1029 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1030 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1031 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1032 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_away_cb), NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1033
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1034 /* OK... let's show this bad boy. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1035 gaim_gtk_blist_refresh(list);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1036 gtk_widget_show_all(gtkblist->window);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1037
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1038 gaim_gtk_blist_update_toolbar();
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1039
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1040 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1041
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1042 void gaim_gtk_blist_refresh(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1043 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1044 GaimBlistNode *group = list->root;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1045 GaimBlistNode *buddy;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1046
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1047 while (group) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1048 gaim_gtk_blist_update(list, group);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1049 buddy = group->child;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1050 while (buddy) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1051 gaim_gtk_blist_update(list, buddy);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1052 buddy = buddy->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1053 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1054 group = group->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1055 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1056 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1057
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1058 static gboolean get_iter_from_node_helper(GaimBlistNode *node, GtkTreeIter *iter, GtkTreeIter *root) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1059 do {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1060 GaimBlistNode *n;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1061 GtkTreeIter child;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1062
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1063 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), root, NODE_COLUMN, &n, -1);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1064 if(n == node) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1065 *iter = *root;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1066 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1067 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1068
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1069 if(gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &child, root)) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1070 if(get_iter_from_node_helper(node,iter,&child))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1071 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1072 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1073 } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel), root));
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1074
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1075 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1076 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1077
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1078 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1079 GtkTreeIter root;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1080
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1081 if (!gtkblist)
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1082 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1083
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1084 if(!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(gtkblist->treemodel), &root))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1085 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1086
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1087 return get_iter_from_node_helper(node, iter, &root);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1088 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1089
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1090 void gaim_gtk_blist_update_toolbar() {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1091 if (!gtkblist)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1092 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1093
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1094 gtk_container_foreach(GTK_CONTAINER(gtkblist->bbox), gaim_gtk_blist_update_toolbar_icons, NULL);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1095
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1096 if (blist_options & OPT_BLIST_NO_BUTTONS)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1097 gtk_widget_hide(gtkblist->bbox);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1098 else
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1099 gtk_widget_show_all(gtkblist->bbox);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1100 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1101
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1102 static void gaim_gtk_blist_remove(struct gaim_buddy_list *list, GaimBlistNode *node)
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1103 {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1104 struct gaim_gtk_blist_node *gtknode;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1105 GtkTreeIter iter;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1106
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1107 if (!node->ui_data)
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1108 return;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1109
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1110 gtknode = (struct gaim_gtk_blist_node *)node->ui_data;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1111
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1112 if (gtknode->timer > 0) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1113 g_source_remove(gtknode->timer);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1114 gtknode->timer = 0;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1115 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1116
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1117 if (get_iter_from_node(node, &iter)) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1118 gtk_tree_store_remove(gtkblist->treemodel, &iter);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1119 if(GAIM_BLIST_NODE_IS_BUDDY(node) && gaim_blist_get_group_online_count((struct group *)node->parent) == 0) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1120 GtkTreeIter groupiter;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1121 if(get_iter_from_node(node->parent, &groupiter))
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1122 gtk_tree_store_remove(gtkblist->treemodel, &groupiter);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1123 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1124 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1125 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1126
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1127 static gboolean do_selection_changed(GaimBlistNode *new_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1128 {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1129 GaimBlistNode *old_selection = gtkblist->selected_node;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1130
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1131 if(new_selection != gtkblist->selected_node) {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1132 gtkblist->selected_node = new_selection;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1133 if(new_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1134 gaim_gtk_blist_update(NULL, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1135 if(old_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1136 gaim_gtk_blist_update(NULL, old_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1137 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1138
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1139 return FALSE;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1140 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1141
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1142 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1143 {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1144 GaimBlistNode *new_selection = NULL;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1145 GtkTreeIter iter;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1146
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1147 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1148 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1149 NODE_COLUMN, &new_selection, -1);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1150 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1151 /* we set this up as a timeout, otherwise the blist flickers */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1152 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1153 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1154
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1155
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1156 static void gaim_gtk_blist_update(struct gaim_buddy_list *list, GaimBlistNode *node)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1157 {
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1158 struct gaim_gtk_blist_node *gtknode;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1159 GtkTreeIter iter;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1160 gboolean expand = FALSE;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1161 gboolean new_entry = FALSE;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1162
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1163 if (!gtkblist)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1164 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1165
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1166 gtknode = GAIM_GTK_BLIST_NODE(node);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1167
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1168
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1169 if (!get_iter_from_node(node, &iter)) { /* This is a newly added node */
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1170 new_entry = TRUE;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1171 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1172 if (((struct buddy*)node)->present) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1173 GtkTreeIter groupiter;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1174 GaimBlistNode *oldersibling;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1175 GtkTreeIter oldersiblingiter;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1176
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1177 if(node->parent && !get_iter_from_node(node->parent, &groupiter)) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1178 /* This buddy's group has not yet been added. We do that here */
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1179 GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview,
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1180 GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
4794
642444078976 [gaim-migrate @ 5114]
Nathan Walp <nwalp@pidgin.im>
parents: 4786
diff changeset
1181 char *esc = g_markup_escape_text(((struct group*)node->parent)->name, -1);
642444078976 [gaim-migrate @ 5114]
Nathan Walp <nwalp@pidgin.im>
parents: 4786
diff changeset
1182 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
642444078976 [gaim-migrate @ 5114]
Nathan Walp <nwalp@pidgin.im>
parents: 4786
diff changeset
1183 g_free(esc);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1184 oldersibling = node->parent->prev;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1185
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1186 /* We traverse backwards through the buddy list to find the node in the tree to insert it after */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1187 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1188 oldersibling = oldersibling->prev;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1189
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1190 /* This is where we create the node and add it. */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1191 gtk_tree_store_insert_after(gtkblist->treemodel, &groupiter, NULL, oldersibling ? &oldersiblingiter : NULL);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1192 gtk_tree_store_set(gtkblist->treemodel, &groupiter,
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1193 STATUS_ICON_COLUMN, groupicon,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1194 NAME_COLUMN, mark,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1195 NODE_COLUMN, node->parent,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1196 -1);
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1197
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1198 g_free(mark);
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1199 g_object_unref(G_OBJECT(groupicon));
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1200
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1201 expand = TRUE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1202 }
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1203
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1204 oldersibling = node->prev;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1205 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1206 oldersibling = oldersibling->prev;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1207
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1208 gtk_tree_store_insert_after(gtkblist->treemodel, &iter, &groupiter, oldersibling ? &oldersiblingiter : NULL);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1209
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1210 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1211 gtk_window_present(GTK_WINDOW(gtkblist->window));
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1212
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1213 if (expand) { /* expand was set to true if this is the first element added to a group. In such case
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1214 * we expand the group node */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1215 GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1216 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), path, TRUE);
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
1217 gtk_tree_path_free(path);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1218 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1219 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1220 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1221 }
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1222
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1223 if (GAIM_BLIST_NODE_IS_BUDDY(node) && ((struct buddy*)node)->present) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1224 GdkPixbuf *status, *avatar;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1225 char *mark;
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1226 char *warning = NULL, *idle = NULL;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1227
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1228 gboolean selected = (gtkblist->selected_node == node);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1229
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1230 status = gaim_gtk_blist_get_status_icon((struct buddy*)node,
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1231 blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1232 avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1233 mark = gaim_gtk_blist_get_name_markup((struct buddy*)node, selected);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1234
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1235 if (((struct buddy*)node)->idle > 0) {
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1236 time_t t;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1237 int ihrs, imin;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1238 time(&t);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1239 ihrs = (t - ((struct buddy *)node)->idle) / 3600;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1240 imin = ((t - ((struct buddy*)node)->idle) / 60) % 60;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1241 if(ihrs > 0)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1242 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1243 else
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1244 idle = g_strdup_printf("(%d)", imin);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1245 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1246
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1247 if (((struct buddy*)node)->evil > 0)
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1248 warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1249
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1250
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1251 if((blist_options & OPT_BLIST_GREY_IDLERS)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1252 && ((struct buddy *)node)->idle) {
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1253 if(warning && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1254 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1255 warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1256 g_free(warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1257 warning = w2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1258 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1259
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1260 if(idle && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1261 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1262 idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1263 g_free(idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1264 idle = i2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1265 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1266 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1267
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1268
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1269 gtk_tree_store_set(gtkblist->treemodel, &iter,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1270 STATUS_ICON_COLUMN, status,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1271 NAME_COLUMN, mark,
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1272 WARNING_COLUMN, warning,
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1273 IDLE_COLUMN, idle,
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1274 BUDDY_ICON_COLUMN, avatar,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1275 NODE_COLUMN, node,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1276 -1);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1277
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1278 g_free(mark);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1279 if (idle)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1280 g_free(idle);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1281 if (warning)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1282 g_free(warning);
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1283
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1284 if (status != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1285 g_object_unref(status);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1286
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1287 if (avatar != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1288 g_object_unref(avatar);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1289
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1290 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1291 gaim_gtk_blist_remove(list, node);
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1292 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1293 gtk_window_present(GTK_WINDOW(gtkblist->window));
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1294 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1295 GaimBlistNode *afsad = node->child;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1296 while (afsad) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1297 gaim_gtk_blist_update(list, afsad);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1298 afsad = afsad->next;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1299 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1300 }
4786
01e349782075 [gaim-migrate @ 5106]
Nathan Walp <nwalp@pidgin.im>
parents: 4785
diff changeset
1301 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1302 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1303
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1304 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1305 {
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1306 if (!gtkblist)
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1307 return;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1308 gtk_widget_destroy(gtkblist->window);
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1309
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1310 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1311 gtkblist->treemodel = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1312 gtkblist->idle_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1313 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1314 gtkblist->bbox = gtkblist->tipwindow = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1315 protomenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1316 awaymenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1317 bpmenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1318
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1319 gtkblist->timeout = 0;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1320 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1321
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1322 static void gaim_gtk_blist_set_visible(struct gaim_buddy_list *list, gboolean show)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1323 {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1324 if (show) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1325 gtk_window_present(GTK_WINDOW(gtkblist->window));
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1326 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1327 if (!connections || docklet_count) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1328 #ifdef _WIN32
4711
0c1f3e651d3e [gaim-migrate @ 5022]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4706
diff changeset
1329 wgaim_systray_minimize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1330 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1331 gtk_widget_hide(gtkblist->window);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1332 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1333 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1334 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1335 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1336 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1337
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1338 void gaim_gtk_blist_docklet_toggle() {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1339 /* Useful for the docklet plugin and also for the win32 tray icon*/
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1340 /* This is called when one of those is clicked--it will show/hide the
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1341 buddy list/login window--depending on which is active */
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1342 if (connections && gtkblist) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1343 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1344 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gaim_gtk_blist_obscured);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1345 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1346 #if _WIN32
4711
0c1f3e651d3e [gaim-migrate @ 5022]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4706
diff changeset
1347 wgaim_systray_maximize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1348 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1349 gaim_blist_set_visible(TRUE);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1350 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1351 } else if (connections) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1352 /* we're logging in or something... do nothing */
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1353 debug_printf("docklet_toggle called with connections but no blist!\n");
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1354 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1355 if (GTK_WIDGET_VISIBLE(mainwindow)) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1356 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1357 gtk_window_present(GTK_WINDOW(mainwindow));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1358 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1359 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1360 wgaim_systray_minimize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1361 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1362 gtk_widget_hide(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1363 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1364 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1365 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1366 wgaim_systray_maximize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1367 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1368 gtk_window_present(GTK_WINDOW(mainwindow));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1369 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1370 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1371 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1372
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1373 void gaim_gtk_blist_docklet_add()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1374 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1375 docklet_count++;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1376 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1377
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1378 void gaim_gtk_blist_docklet_remove()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1379 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1380 docklet_count--;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1381 if (!docklet_count) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1382 if (connections) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1383 gaim_blist_set_visible(TRUE);
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1384 } else if(gtkblist && gtkblist->window) {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1385 gtk_window_present(GTK_WINDOW(gtkblist->window));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1386 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1387 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1388 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1389
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1390 static struct gaim_blist_ui_ops blist_ui_ops =
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1391 {
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1392 gaim_gtk_blist_new_list,
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1393 gaim_gtk_blist_new_node,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1394 gaim_gtk_blist_show,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1395 gaim_gtk_blist_update,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1396 gaim_gtk_blist_remove,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1397 gaim_gtk_blist_destroy,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1398 gaim_gtk_blist_set_visible
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1399 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1400
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1401
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1402 struct gaim_blist_ui_ops *gaim_get_gtk_blist_ui_ops()
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1403 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1404 return &blist_ui_ops;
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1405 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1406
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1407
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1408
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1409 /*********************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1410 * Public utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1411 *********************************************************************/
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1412
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1413 GdkPixbuf *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1414 create_prpl_icon(struct gaim_account *account)
4553
d03fcb3f4be2 [gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents: 4525
diff changeset
1415 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1416 struct prpl *prpl = find_prpl(account->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1417 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1418 char *filename = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1419 const char *protoname = prpl->list_icon(account, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1420 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1421 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1422 if (!strcmp(protoname, "aim")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1423 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "aim.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1424 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1425 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1426 } else if (!strcmp(protoname, "yahoo")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1427 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "yahoo.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1428 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1429 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1430 } else if (!strcmp(protoname, "msn")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1431 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "msn.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1432 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1433 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1434 } else if (!strcmp(protoname, "jabber")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1435 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "jabber.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1436 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1437 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1438 } else if (!strcmp(protoname, "icq")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1439 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "icq.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1440 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1441 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1442 } else if (!strcmp(protoname, "gadu-gadu")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1443 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "gadugadu.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1444 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1445 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1446 } else if (!strcmp(protoname, "napster")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1447 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "napster.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1448 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1449 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1450 } else if (!strcmp(protoname, "irc")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1451 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "irc.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1452 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1453 g_free(filename);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
1454 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1455 return status;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1456 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1457