annotate src/buddy.c @ 5186:a107115a13ae

[gaim-migrate @ 5550] don't infinite loop on unload committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sun, 20 Apr 2003 20:56:14 +0000
parents 0f31d00d2501
children 7c1c9bdc1f8e
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"
5054
abc8489b2e8f [gaim-migrate @ 5404]
Nathan Walp <nwalp@pidgin.im>
parents: 5053
diff changeset
51 #include "gtkpounce.h"
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
52 #include "gtkft.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
53
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
54 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
55 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
56 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
57
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
58 static struct gaim_gtk_buddy_list *gtkblist = NULL;
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
59
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
60 /* part of the best damn Docklet code this side of Tahiti */
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
61 static gboolean gaim_gtk_blist_obscured = FALSE;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
62
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
63 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
64 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
65 static char *gaim_get_tooltip_text(struct buddy *b);
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
66 static char *item_factory_translate_func (const char *path, gpointer func_data);
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
67
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
68 /***************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
69 * Callbacks *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
70 ***************************************************/
3869
061ed70be441 [gaim-migrate @ 4021]
Rob Flynn <gaim@robflynn.com>
parents: 3859
diff changeset
71
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
72 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
73 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
74 if (docklet_count)
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
75 gaim_blist_set_visible(FALSE);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
76 else
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
77 do_quit();
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
78
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
79 /* we handle everything, event should not propogate further */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
80 return TRUE;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
81 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
82
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
83 static gboolean gtk_blist_save_prefs_cb(gpointer data)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
84 {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
85 save_prefs();
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
86
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
87 /* only run once */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
88 return FALSE;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
89 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
90
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
91 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
92 {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
93 /* unfortunately GdkEventConfigure ignores the window gravity, but *
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
94 * the only way we have of setting the position doesn't. we have to *
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
95 * call get_position and get_size because they do pay attention to *
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
96 * the gravity. this is inefficient and I agree it sucks, but it's *
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
97 * more likely to work correctly. - Robot101 */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
98 gint x, y;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
99
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
100 /* check for visibility because when we aren't visible, this will *
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
101 * give us bogus (0,0) coordinates. - xOr */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
102 if (GTK_WIDGET_VISIBLE(w)) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
103 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
104
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
105 if (x != blist_pos.x ||
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
106 y != blist_pos.y ||
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
107 event->width != blist_pos.width ||
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
108 event->height != blist_pos.height) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
109 blist_pos.x = x;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
110 blist_pos.y = y;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
111 blist_pos.width = event->width;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
112 blist_pos.height = event->height;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
113
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
114 if (!g_main_context_find_source_by_user_data(NULL, &gtk_blist_save_prefs_cb)) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
115 g_timeout_add(5000, gtk_blist_save_prefs_cb, &gtk_blist_save_prefs_cb);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
116 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
117 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
118 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
119
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
120 /* continue to handle event normally */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
121 return FALSE;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
122 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
123
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
124 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
125 {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
126 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
127 gaim_gtk_blist_obscured = TRUE;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
128 else
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
129 gaim_gtk_blist_obscured = FALSE;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
130
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
131 /* continue to handle event normally */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
132 return FALSE;
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
133 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
134
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
135 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
136 {
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
137 serv_get_info(b->account->gc, b->name);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
138 }
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
139
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
140 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
141 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
142 gaim_conversation_new(GAIM_CONV_IM, b->account, b->name);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
143 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
144
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
145 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
146 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
147 alias_dialog_bud(b);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
148 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
149
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
150 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
151 {
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
152 gaim_gtkpounce_dialog_show(b, NULL);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
153 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
154
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
155 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
156 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
157 show_log(b->name);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
158 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
159
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
160 static void gtk_blist_show_systemlog_cb()
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
161 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
162 show_log(NULL);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
163 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
164
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
165 static void gtk_blist_show_onlinehelp_cb()
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
166 {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
167 open_url(NULL, WEBSITE "documentation.php");
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
168 }
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
169
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
170 static void gtk_blist_button_im_cb(GtkWidget *w, GtkTreeView *tv)
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
171 {
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
172 GtkTreeIter iter;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
173 GtkTreeModel *model = gtk_tree_view_get_model(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
174 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
175
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
176 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
177 GaimBlistNode *node;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
178
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
179 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
4999
abe9720a0615 [gaim-migrate @ 5334]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
180 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
181 gaim_conversation_new(GAIM_CONV_IM, ((struct buddy*)node)->account, ((struct buddy*)node)->name);
4999
abe9720a0615 [gaim-migrate @ 5334]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
182 return;
abe9720a0615 [gaim-migrate @ 5334]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
183 }
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
184 }
4999
abe9720a0615 [gaim-migrate @ 5334]
Nathan Walp <nwalp@pidgin.im>
parents: 4987
diff changeset
185 show_im_dialog();
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
186 }
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
187
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
188 static void gtk_blist_button_info_cb(GtkWidget *w, GtkTreeView *tv)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
189 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
190 GtkTreeIter iter;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
191 GtkTreeModel *model = gtk_tree_view_get_model(tv);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
192 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
193
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
194 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
195 GaimBlistNode *node;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
196
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
197 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
198 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
199 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
200 return;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
201 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
202 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
203 show_info_dialog();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
204 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
205
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
206 static void gtk_blist_button_chat_cb(GtkWidget *w, gpointer data)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
207 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
208 /* 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
209 join_chat();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
210 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
211
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
212 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
213 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
214 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
215 }
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
216
5142
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
217 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
218 GaimBlistNode *node;
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
219 GValue val = {0,};
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
220
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
221 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
222
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
223 node = g_value_get_pointer(&val);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
224
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
225 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
226 gaim_group_set_setting((struct group *)node, "collapsed", NULL);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
227 gaim_blist_save();
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
228 }
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
229 }
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
230
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
231 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
232 GaimBlistNode *node;
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
233 GValue val = {0,};
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
234
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
235 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
236
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
237 node = g_value_get_pointer(&val);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
238
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
239 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
240 gaim_group_set_setting((struct group *)node, "collapsed", "true");
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
241 gaim_blist_save();
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
242 }
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
243 }
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
244
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
245 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
246 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
247 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
248 GValue val = { 0, };
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
249
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
250 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
251
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
252 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
253 node = g_value_get_pointer(&val);
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
254
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
255 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4911
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
256 struct gaim_conversation *conv =
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
257 gaim_conversation_new(GAIM_CONV_IM, ((struct buddy*)node)->account, ((struct buddy*)node)->name);
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
258 if(conv) {
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
259 gaim_window_raise(gaim_conversation_get_window(conv));
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
260 gaim_window_switch_conversation(
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
261 gaim_conversation_get_window(conv),
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
262 gaim_conversation_get_index(conv));
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
263 }
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
264 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
265 if (gtk_tree_view_row_expanded(tv, path))
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
266 gtk_tree_view_collapse_row(tv, path);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
267 else
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
268 gtk_tree_view_expand_row(tv,path,FALSE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
269 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
270 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
271
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
272 static void gaim_gtk_blist_add_buddy_cb()
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
273 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
274 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
275 GtkTreeIter iter;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
276 GaimBlistNode *node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
277
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
278 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
279 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
280 if (GAIM_BLIST_NODE_IS_BUDDY(node))
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
281 show_add_buddy(NULL, NULL, ((struct group*)node->parent)->name, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
282 else if (GAIM_BLIST_NODE_IS_GROUP(node))
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
283 show_add_buddy(NULL, NULL, ((struct group*)node)->name, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
284 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
285 else {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
286 show_add_buddy(NULL, NULL, NULL, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
287 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
288 }
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
289
4921
d5c136474f26 [gaim-migrate @ 5255]
Nathan Walp <nwalp@pidgin.im>
parents: 4918
diff changeset
290 static void
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
291 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
292 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
293 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
294 struct buddy *b = (struct buddy*)node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
295 show_confirm_del(b->account->gc, b->name);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
296 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
297 struct group *g = (struct group*)node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
298 show_confirm_del_group(g);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
299 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
300 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
301
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
302 static void gaim_proto_menu_cb(GtkMenuItem *item, struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
303 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
304 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
305 if (pbm->callback)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
306 pbm->callback(pbm->gc, b->name);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
307 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
308
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
309 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
310 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
311 GtkTreePath *path;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
312 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
313 GValue val = { 0, };
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
314 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
315 GtkWidget *menu, *menuitem;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
316 GtkTreeSelection *sel;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
317 GList *list;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
318 struct prpl *prpl;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
319
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
320 if (event->button != 3)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
321 return FALSE;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
322
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
323 /* Here we figure out which node was clicked */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
324 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
325 return FALSE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
326 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
327 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
328 node = g_value_get_pointer(&val);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
329 menu = gtk_menu_new();
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
330
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
331 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
5156
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
332 gaim_new_item_from_stock(menu, _("_Add a Buddy"), GTK_STOCK_ADD, G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
333 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE, G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
334 gaim_new_item_from_stock(menu, _("_Rename"), NULL, G_CALLBACK(show_rename_group), node, 0, 0, NULL);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
335 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
336 /* Protocol specific options */
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
337 prpl = find_prpl(((struct buddy*)node)->account->protocol);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
338
5156
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
339 if (prpl && prpl->get_info)
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
340 gaim_new_item_from_stock(menu, _("_Get Info"), GAIM_STOCK_INFO, G_CALLBACK(gtk_blist_menu_info_cb), node, 0, 0, NULL);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
341
5156
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
342 gaim_new_item_from_stock(menu, _("_IM"), GAIM_STOCK_IM, G_CALLBACK(gtk_blist_menu_im_cb), node, 0, 0, NULL);
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
343 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL, G_CALLBACK(gtk_blist_menu_bp_cb), node, 0, 0, NULL);
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
344 gaim_new_item_from_stock(menu, _("View _Log"), NULL, G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
345
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
346 if (prpl) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
347 list = prpl->buddy_menu(((struct buddy*)node)->account->gc, ((struct buddy*)node)->name);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
348 while (list) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
349 struct proto_buddy_menu *pbm = list->data;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
350 menuitem = gtk_menu_item_new_with_mnemonic(pbm->label);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
351 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", pbm);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
352 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gaim_proto_menu_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
353 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
354 list = list->next;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
355 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
356 }
5017
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
357
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
358 plugin_event (event_draw_menu, menu, ((struct buddy *) node)->name);
5156
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
359
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
360 gaim_separator(menu);
5156
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
361 gaim_new_item_from_stock(menu, _("_Alias"), GAIM_STOCK_EDIT, G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
3db711442e0f [gaim-migrate @ 5520]
Mark Doliner <mark@kingant.net>
parents: 5151
diff changeset
362 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE, G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
363 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
364
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
365 gtk_widget_show_all(menu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
366
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
367 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
368
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
369 #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
370 * 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
371 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
372 gtk_tree_selection_select_path(sel, path);
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
373 gtk_tree_path_free(path);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
374 return TRUE;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
375 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
376 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
378 static void gaim_gtk_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item)
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
379 {
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
380 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)))
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
381 blist_options &= ~OPT_BLIST_NO_MT_GRP;
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
382 else
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
383 blist_options |= OPT_BLIST_NO_MT_GRP;
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
384 save_prefs();
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
385 gaim_gtk_blist_refresh(gaim_get_blist());
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
386 }
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
387
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
388 static void gaim_gtk_blist_edit_mode_cb(gpointer callback_data, guint callback_action,
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
389 GtkWidget *checkitem) {
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
390 if(gtkblist->window->window) {
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
391 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
392 gdk_window_set_cursor(gtkblist->window->window, cursor);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
393 while (gtk_events_pending())
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
394 gtk_main_iteration();
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
395 gdk_cursor_unref(cursor);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
396 }
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
397
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
398 if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)))
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
399 blist_options |= OPT_BLIST_SHOW_OFFLINE;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
400 else
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
401 blist_options &= ~OPT_BLIST_SHOW_OFFLINE;
4929
8a20332821b6 [gaim-migrate @ 5263]
Sean Egan <seanegan@gmail.com>
parents: 4928
diff changeset
402 save_prefs();
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
403
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
404 if(gtkblist->window->window) {
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
405 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
406 gdk_window_set_cursor(gtkblist->window->window, cursor);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
407 gdk_cursor_unref(cursor);
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
408 }
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
409
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
410 gaim_gtk_blist_refresh(gaim_get_blist());
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
411 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
412
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
413 static void gaim_gtk_blist_drag_data_get_cb (GtkWidget *widget,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
414 GdkDragContext *dc,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
415 GtkSelectionData *data,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
416 guint info,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
417 guint time,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
418 gpointer *null)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
419 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
420 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) {
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
421 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
422 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
423 GtkTreeIter iter;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
424 GaimBlistNode *node = NULL;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
425 GValue val = {0};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
426 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
427 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
428 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
429 gtk_selection_data_set (data,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
430 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
431 8, /* bits */
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
432 (void*)&node,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
433 sizeof (node));
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
434
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
435 gtk_tree_path_free(sourcerow);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
436 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
437
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
438 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
439
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
440 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
441 GtkSelectionData *sd, guint info, guint t)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
442 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
443 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
444 GaimBlistNode *n = NULL;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
445 GtkTreePath *path = NULL;
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
446 GtkTreeViewDropPosition position;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
447 memcpy(&n, sd->data, sizeof(n));
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
448 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
449 /* 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
450 GtkTreeIter iter;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
451 GaimBlistNode *node;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
452 GValue val = {0};
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
453 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
454 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
455 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
456
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
457 if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
458 struct buddy *b = (struct buddy*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
459 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
460 switch(position) {
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
461 case GTK_TREE_VIEW_DROP_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
462 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
463 gaim_blist_add_buddy(b, (struct group*)node->parent, node);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
464 break;
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
465 case GTK_TREE_VIEW_DROP_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
466 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
467 gaim_blist_add_buddy(b, (struct group*)node->parent, node->prev);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
468 break;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
469 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
470 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
471 gaim_blist_add_buddy(b, (struct group*)node, NULL);
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
472 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
473 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
474 struct group *g = (struct group*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
475 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
476 switch (position) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
477 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
478 case GTK_TREE_VIEW_DROP_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
479 gaim_blist_add_group(g, node);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
480 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
481 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
482 case GTK_TREE_VIEW_DROP_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
483 gaim_blist_add_group(g, node->prev);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
484 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
485 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
486
5055
5b1d70deda02 [gaim-migrate @ 5406]
Nathan Walp <nwalp@pidgin.im>
parents: 5054
diff changeset
487 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
5b1d70deda02 [gaim-migrate @ 5406]
Nathan Walp <nwalp@pidgin.im>
parents: 5054
diff changeset
488 gaim_blist_add_group(g, node->parent);
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
489 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
490
4777
e23a7e166680 [gaim-migrate @ 5097]
Nathan Walp <nwalp@pidgin.im>
parents: 4776
diff changeset
491 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
492
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
493 gtk_tree_path_free(path);
4970
4087669769e8 [gaim-migrate @ 5304]
Nathan Walp <nwalp@pidgin.im>
parents: 4968
diff changeset
494 gaim_blist_save();
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
495 }
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
496 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
497 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
498
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
499 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
500 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
501 GtkStyle *style;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
502 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
503 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
504 char *tooltiptext = gaim_get_tooltip_text(b);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
505
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
506 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
507 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
508 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
509 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
510 style = gtkblist->tipwindow->style;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
511
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
512 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
513 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
514
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
515 #if GTK_CHECK_VERSION(2,2,0)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
516 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
517 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
518 #else
4758
2202f056a1c9 [gaim-migrate @ 5075]
Nathan Walp <nwalp@pidgin.im>
parents: 4757
diff changeset
519 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
520 #endif
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
521
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
522 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, TRUE,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
523 NULL, gtkblist->tipwindow, "tooltip", 38, 4, layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
524
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
525 g_object_unref (pixbuf);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
526 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
527 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
528 return;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
529 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
530
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
531 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
532 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
533 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
534 GtkTreeIter iter;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
535 GaimBlistNode *node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
536 GValue val = {0};
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
537
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
538 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
539 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
540 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
541 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
542 node = g_value_get_pointer(&val);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
543
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
544 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
545 int scr_w,scr_h, w, h, x, y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
546 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
547 struct buddy *buddy = (struct buddy*)node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
548 char *tooltiptext = gaim_get_tooltip_text(buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
549 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
4907
68e2b07ef8d7 [gaim-migrate @ 5241]
Christian Hammond <chipx86@chipx86.com>
parents: 4883
diff changeset
550 gtkblist->tipwindow->parent = tv;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
551 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
552 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
553 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
554 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
555 G_CALLBACK(gaim_gtk_blist_paint_tip), buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
556 gtk_widget_ensure_style (gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
557
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
558 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
559 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
560 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
561 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
562 scr_w = gdk_screen_width();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
563 scr_h = gdk_screen_height();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
564 pango_layout_get_size (layout, &w, &h);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
565 w = PANGO_PIXELS(w) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
566 h = PANGO_PIXELS(h) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
567
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
568 /* 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
569 I should #define this or something */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
570 w = w + 38;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
571 h = MAX(h, 38);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
572
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
573 gdk_window_get_pointer(NULL, &x, &y, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
574 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
575 y+=gtkblist->window->allocation.y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
576
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
577 x -= ((w >> 1) + 4);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
578
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
579 if ((x + w) > scr_w)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
580 x -= (x + w) - scr_w;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
581 else if (x < 0)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
582 x = 0;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
583
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
584 if ((y + h + 4) > scr_h)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
585 y = y - h;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
586 else
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
587 y = y + 6;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
588 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
589 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
590 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
591 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
592 gtk_widget_show(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
593 }
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
594
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
595 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
596 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
597 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
598
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
599 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
600 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
601 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
602 if (gtkblist->timeout) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
603 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
604 return FALSE;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
605 /* 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
606 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
607 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
608 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
609 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
610
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
611 g_source_remove(gtkblist->timeout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
612 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
613
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
614 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
615 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
616 if (path)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
617 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
618 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
619 return FALSE;
4724
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 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
623 {
4978
307c16c4b57e [gaim-migrate @ 5313]
Luke Schierer <lschiere@pidgin.im>
parents: 4974
diff changeset
624 if (gtkblist->timeout) {
307c16c4b57e [gaim-migrate @ 5313]
Luke Schierer <lschiere@pidgin.im>
parents: 4974
diff changeset
625 g_source_remove(gtkblist->timeout);
307c16c4b57e [gaim-migrate @ 5313]
Luke Schierer <lschiere@pidgin.im>
parents: 4974
diff changeset
626 gtkblist->timeout = 0;
307c16c4b57e [gaim-migrate @ 5313]
Luke Schierer <lschiere@pidgin.im>
parents: 4974
diff changeset
627 }
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
628 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
629 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
630 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
631 }
4978
307c16c4b57e [gaim-migrate @ 5313]
Luke Schierer <lschiere@pidgin.im>
parents: 4974
diff changeset
632 }
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
633
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
634 /***************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
635 * Crap *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
636 ***************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
637 static GtkItemFactoryEntry blist_menu[] =
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
638 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
639 /* Buddies menu */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
640 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
641 { N_("/Buddies/New _Instant Message..."), "<CTL>I", show_im_dialog, 0, "<StockItem>", GAIM_STOCK_IM },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
642 { N_("/Buddies/Join a _Chat..."), "<CTL>C", join_chat, 0, "<StockItem>", GAIM_STOCK_CHAT },
5145
fc09679bffbe [gaim-migrate @ 5509]
Luke Schierer <lschiere@pidgin.im>
parents: 5144
diff changeset
643 { N_("/Buddies/Get _User Info..."), "<CTL>J", show_info_dialog, 0, "<StockItem>", GAIM_STOCK_INFO },
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
644 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
4983
10d7a6686c1f [gaim-migrate @ 5318]
Sean Egan <seanegan@gmail.com>
parents: 4980
diff changeset
645 { N_("/Buddies/_Show Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>"},
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
646 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>"},
4983
10d7a6686c1f [gaim-migrate @ 5318]
Sean Egan <seanegan@gmail.com>
parents: 4980
diff changeset
647 { N_("/Buddies/_Add a Buddy..."), NULL, gaim_gtk_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
10d7a6686c1f [gaim-migrate @ 5318]
Sean Egan <seanegan@gmail.com>
parents: 4980
diff changeset
648 { N_("/Buddies/Add a _Group..."), NULL, show_add_group, 0, NULL},
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
649 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
650 { N_("/Buddies/_Signoff"), "<CTL>D", signoff_all, 0, "<StockItem>", GAIM_STOCK_SIGN_OFF },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
651 { N_("/Buddies/_Quit"), "<CTL>Q", do_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
652
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
653 /* Tools */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
654 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
655 { N_("/Tools/_Away"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
656 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
657 { N_("/Tools/P_rotocol Actions"), NULL, NULL, 0, "<Branch>" },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
658 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
5053
e40d52cffd51 [gaim-migrate @ 5403]
Rob Flynn <gaim@robflynn.com>
parents: 5041
diff changeset
659 { N_("/Tools/A_ccounts..."), "<CTL>A", account_editor, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
660 { N_("/Tools/_File Transfers..."), NULL, gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
661 { N_("/Tools/Preferences..."), "<CTL>P", show_prefs, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
662 { N_("/Tools/Pr_ivacy..."), NULL, show_privacy_options, 0, "<StockItem>", GAIM_STOCK_PRIVACY },
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
663 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
664 { 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
665
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
666 /* Help */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
667 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
668 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
669 { N_("/Help/_Debug Window..."), NULL, toggle_debug, 0, NULL },
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
670 { N_("/Help/_About..."), NULL, show_about, 0, "<StockItem>", GAIM_STOCK_ABOUT },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
671 };
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
672
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
673 /*********************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
674 * Private Utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
675 *********************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
676
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
677 static char *gaim_get_tooltip_text(struct buddy *b)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
678 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
679 char *text = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
680 struct prpl* prpl = find_prpl(b->account->protocol);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
681 char *statustext = NULL;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
682 char *aliastext = NULL, *nicktext = NULL;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
683 char *warning = NULL, *idletime = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
684
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
685 if (prpl->tooltip_text) {
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
686 const char *end;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
687 statustext = prpl->tooltip_text(b);
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
688
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
689 if(statustext && !g_utf8_validate(statustext, -1, &end)) {
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
690 char *new = g_strndup(statustext,
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
691 g_utf8_pointer_to_offset(statustext, end));
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
692 g_free(statustext);
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
693 statustext = new;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
694 }
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
695 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
696
5131
feda37d46e17 [gaim-migrate @ 5494]
Mark Doliner <mark@kingant.net>
parents: 5116
diff changeset
697 if (!statustext && !GAIM_BUDDY_IS_ONLINE(b))
feda37d46e17 [gaim-migrate @ 5494]
Mark Doliner <mark@kingant.net>
parents: 5116
diff changeset
698 statustext = g_strdup(_("<b>Status:</b> Offline"));
feda37d46e17 [gaim-migrate @ 5494]
Mark Doliner <mark@kingant.net>
parents: 5116
diff changeset
699
5002
f78b24df83d5 [gaim-migrate @ 5337]
Sean Egan <seanegan@gmail.com>
parents: 5000
diff changeset
700 if (b->idle > 0) {
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
701 int ihrs, imin;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
702 time_t t;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
703 time(&t);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
704 ihrs = (t - b->idle) / 3600;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
705 imin = ((t - b->idle) / 60) % 60;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
706 if (ihrs)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
707 idletime = g_strdup_printf(_("%dh%02dm"), ihrs, imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
708 else
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
709 idletime = g_strdup_printf(_("%dm"), imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
710 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
711
4945
f5efec4603ef [gaim-migrate @ 5279]
Sean Egan <seanegan@gmail.com>
parents: 4944
diff changeset
712 if(b->alias && b->alias[0])
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
713 aliastext = g_markup_escape_text(b->alias, -1);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
714
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
715 if(b->server_alias)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
716 nicktext = g_markup_escape_text(b->server_alias, -1);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
717
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
718 if (b->evil > 0)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
719 warning = g_strdup_printf(_("%d%%"), b->evil);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
720
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
721 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
722 "%s %s" /* Alias */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
723 "%s %s" /* Nickname */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
724 "%s %s" /* Idle */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
725 "%s %s" /* Warning */
4968
804b25d09a5b [gaim-migrate @ 5302]
Rob Flynn <gaim@robflynn.com>
parents: 4964
diff changeset
726 "%s%s" /* Status */
804b25d09a5b [gaim-migrate @ 5302]
Rob Flynn <gaim@robflynn.com>
parents: 4964
diff changeset
727 "%s",
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
728 b->name,
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
729 aliastext ? _("\n<b>Alias:</b>") : "", aliastext ? aliastext : "",
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
730 nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "",
5002
f78b24df83d5 [gaim-migrate @ 5337]
Sean Egan <seanegan@gmail.com>
parents: 5000
diff changeset
731 idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "",
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
732 b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
4968
804b25d09a5b [gaim-migrate @ 5302]
Rob Flynn <gaim@robflynn.com>
parents: 4964
diff changeset
733 statustext ? "\n" : "", statustext ? statustext : "",
5116
c081a81ee013 [gaim-migrate @ 5479]
Luke Schierer <lschiere@pidgin.im>
parents: 5089
diff changeset
734 !g_ascii_strcasecmp(b->name, "robflynn") ? _("\n<b>Description:</b> Spooky") : "");
4968
804b25d09a5b [gaim-migrate @ 5302]
Rob Flynn <gaim@robflynn.com>
parents: 4964
diff changeset
735
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
736 if(warning)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
737 g_free(warning);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
738 if(idletime)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
739 g_free(idletime);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
740 if(statustext)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
741 g_free(statustext);
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
742 if(nicktext)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
743 g_free(nicktext);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
744 if(aliastext)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
745 g_free(aliastext);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
746
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
747 return text;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
748
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
749 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
750
5168
0f31d00d2501 [gaim-migrate @ 5532]
Nathan Walp <nwalp@pidgin.im>
parents: 5156
diff changeset
751 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
752 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
753 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
754 GdkPixbuf *scale = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
755 GdkPixbuf *emblem = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
756 gchar *filename = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
757 const char *protoname = NULL;
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
758
4691
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
759 char *se = NULL, *sw = NULL ,*nw = NULL ,*ne = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
760
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
761 int scalesize = 30;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
762
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
763 struct prpl* prpl = find_prpl(b->account->protocol);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
764
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
765 if (!prpl)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
766 return NULL;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
767
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
768 if (prpl->list_icon)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
769 protoname = prpl->list_icon(b->account, b);
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
770 if (b->present != GAIM_BUDDY_SIGNING_OFF && prpl->list_emblems)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
771 prpl->list_emblems(b, &se, &sw, &nw, &ne);
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
772
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
773 if (size == GAIM_STATUS_ICON_SMALL) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
774 scalesize = 15;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
775 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
776 }
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
777
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
778
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
779 if (b->present == GAIM_BUDDY_SIGNING_ON) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
780 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
781 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
782 g_free(filename);
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
783 } else if (b->present == GAIM_BUDDY_SIGNING_OFF) {
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
784 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "logout.png", NULL);
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
785 status = gdk_pixbuf_new_from_file(filename,NULL);
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
786 g_free(filename);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
787
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
788 /* "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
789 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
790 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
791 char *image = g_strdup_printf("%s.png", protoname);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
792 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
793 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
794 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
795 g_free(filename);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
796
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
797 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
798
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
799 if (!status)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
800 return NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
801
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
802 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
803
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
804 g_object_unref(G_OBJECT(status));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
805
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
806 /* Emblems */
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
807
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
808 /* 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
809 * 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
810
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
811 /* XXX Clean this crap up, yo. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
812 if (se) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
813 char *image = g_strdup_printf("%s.png", se);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
814 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
815 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
816 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
817 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
818 if (emblem) {
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
819 if (size == GAIM_STATUS_ICON_LARGE)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
820 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
821 scale, 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
822 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
823 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
824 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
825 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
826 255);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
827 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
828 gdk_pixbuf_composite (emblem,
5017
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
829 scale, 5, 5,
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
830 10, 10,
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
831 5, 5,
2f25407917f2 [gaim-migrate @ 5353]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
832 .6, .6,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
833 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
834 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
835 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
836 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
837 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
838 if (sw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
839 char *image = g_strdup_printf("%s.png", sw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
840 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
841 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
842 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
843 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
844 if (emblem) {
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
845 gdk_pixbuf_composite (emblem,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
846 scale, 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
847 15, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
848 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
849 1, 1,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
850 GDK_INTERP_BILINEAR,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
851 255);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
852 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
853 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
854 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
855 if (nw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
856 char *image = g_strdup_printf("%s.png", nw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
857 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
858 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
859 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
860 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
861 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
862 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
863 scale, 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
864 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
865 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
866 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
867 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
868 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
869 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
870 }
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 if (ne) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
873 char *image = g_strdup_printf("%s.png", ne);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
874 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
875 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
876 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
877 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
878 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
879 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
880 scale, 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
881 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
882 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
883 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
884 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
885 255);
4954
decdf19454ab [gaim-migrate @ 5288]
Nathan Walp <nwalp@pidgin.im>
parents: 4947
diff changeset
886 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
887 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
888 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
889
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
890
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
891 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
892 if (b->present == GAIM_BUDDY_OFFLINE)
4928
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
893 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
894 else if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
895 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
896 return scale;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
897 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
898
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
899 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
900 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
901 /* 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
902 char *file;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
903 GdkPixbuf *buf, *ret;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
904
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
905 if (!(blist_options & OPT_BLIST_SHOW_ICONS))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
906 return NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
907
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
908 if ((file = gaim_buddy_get_setting(b, "buddy_icon")) == NULL)
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
909 return NULL;
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
910
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
911 buf = gdk_pixbuf_new_from_file(file, NULL);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
912 g_free(file);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
913
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
914
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
915 if (buf) {
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
916 if (!GAIM_BUDDY_IS_ONLINE(b))
4928
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
917 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
918 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
919 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
920
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
921 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
922 g_object_unref(G_OBJECT(buf));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
923 return ret;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
924 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
925 return NULL;
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
926 }
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
927
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
928 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
929 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
930 char *name = gaim_get_buddy_alias(b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
931 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
932 struct prpl* prpl = find_prpl(b->account->protocol);
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
933
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
934 /* XXX Clean up this crap */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
935
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
936 int ihrs, imin;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
937 char *idletime = NULL, *warning = NULL, *statustext = NULL;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
938 time_t t;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
939
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
940 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) {
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
941 if ((b->idle && blist_options & OPT_BLIST_GREY_IDLERS && !selected) || !GAIM_BUDDY_IS_ONLINE(b)) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
942 text = g_strdup_printf("<span color='dim grey'>%s</span>",
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
943 esc);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
944 g_free(esc);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
945 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
946 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
947 return esc;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
948 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
949 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
950
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
951 time(&t);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
952 ihrs = (t - b->idle) / 3600;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
953 imin = ((t - b->idle) / 60) % 60;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
954
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
955 if (prpl && prpl->status_text) {
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
956 char *tmp = prpl->status_text(b);
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
957 const char *end;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
958
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
959 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
960 char *new = g_strndup(tmp,
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
961 g_utf8_pointer_to_offset(tmp, end));
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
962 g_free(tmp);
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
963 tmp = new;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
964 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
965
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
966 if(tmp) {
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
967 char buf[32];
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
968 char *c = tmp;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
969 int length = 0, vis=0;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
970 gboolean inside = FALSE;
4806
315ef59a5031 [gaim-migrate @ 5126]
Nathan Walp <nwalp@pidgin.im>
parents: 4797
diff changeset
971 g_strdelimit(tmp, "\n", ' ');
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
972
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
973 while(*c && vis < 20) {
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
974 if(*c == '&')
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
975 inside = TRUE;
4856
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4855
diff changeset
976 else if(*c == ';')
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4855
diff changeset
977 inside = FALSE;
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
978 if(!inside)
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
979 vis++;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
980 length++;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
981 c++; /* this is fun */
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
982 }
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
983
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
984 if(vis == 20)
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
985 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
986 else
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
987 g_snprintf(buf, sizeof(buf), "%%s ");
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
988
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
989 statustext = g_strdup_printf(buf, tmp);
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
990
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
991 g_free(tmp);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
992 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
993 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
994
5002
f78b24df83d5 [gaim-migrate @ 5337]
Sean Egan <seanegan@gmail.com>
parents: 5000
diff changeset
995 if (b->idle > 0) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
996 if (ihrs)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
997 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
998 else
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
999 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1000 }
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1001
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1002 if (b->evil > 0)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1003 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1004
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1005 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1006 statustext = g_strdup("Offline ");
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1007
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1008 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS && !selected) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1009 text = g_strdup_printf("<span color='dim grey'>%s</span>\n"
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1010 "<span color='dim grey' size='smaller'>%s%s%s</span>",
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1011 esc,
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1012 statustext != NULL ? statustext : "",
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1013 idletime != NULL ? idletime : "",
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1014 warning != NULL ? warning : "");
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
1015 } else if (statustext == NULL && idletime == NULL && warning == NULL && GAIM_BUDDY_IS_ONLINE(b)) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1016 text = g_strdup(esc);
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
1017 } else {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1018 text = g_strdup_printf("%s\n"
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1019 "<span %s size='smaller'>%s%s%s</span>", esc,
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1020 selected ? "" : "color='dim grey'",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1021 statustext != NULL ? statustext : "",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1022 idletime != NULL ? idletime : "",
5135
102135caa225 [gaim-migrate @ 5499]
Nathan Walp <nwalp@pidgin.im>
parents: 5131
diff changeset
1023 warning != NULL ? warning : "");
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
1024 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1025 if (idletime)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1026 g_free(idletime);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1027 if (warning)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1028 g_free(warning);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1029 if (statustext)
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1030 g_free(statustext);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1031 if (esc)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1032 g_free(esc);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1033
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1034 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1035 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1036
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1037 static void gaim_gtk_blist_restore_position()
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1038 {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1039 /* if the window exists, is hidden, we're saving positions, and the position is sane... */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1040 if(gtkblist && gtkblist->window &&
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1041 !GTK_WIDGET_VISIBLE(gtkblist->window) &&
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1042 blist_pos.width != 0) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1043 /* ...check position is on screen... */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1044 if (blist_pos.x >= gdk_screen_width())
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1045 blist_pos.x = gdk_screen_width() - 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1046 else if (blist_pos.x < 0)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1047 blist_pos.x = 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1048
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1049 if (blist_pos.y >= gdk_screen_height())
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1050 blist_pos.y = gdk_screen_height() - 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1051 else if (blist_pos.y < 0)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1052 blist_pos.y = 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1053
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1054 /* ...and move it back. */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1055 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_pos.x, blist_pos.y);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1056 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_pos.width, blist_pos.height);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1057 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1058 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1059
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1060 static gboolean gaim_gtk_blist_refresh_timer(struct gaim_buddy_list *list)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1061 {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1062 GaimBlistNode *group = list->root;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1063 GaimBlistNode *buddy;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1064
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1065 while (group) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1066 buddy = group->child;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1067 while (buddy) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1068 if (((struct buddy *)buddy)->idle)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1069 gaim_gtk_blist_update(list, buddy);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1070 buddy = buddy->next;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1071 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1072 group = group->next;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1073 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1074
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1075 /* keep on going */
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1076 return TRUE;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1077 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1078
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1079 /**********************************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1080 * Public API Functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1081 **********************************************************************************/
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1082 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
1083 {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1084 blist->ui_data = g_new0(struct gaim_gtk_buddy_list, 1);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1085 }
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1086
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1087 void gaim_gtk_blist_update_columns()
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1088 {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1089 if (blist_options & OPT_BLIST_SHOW_ICONS) {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1090 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1091 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1092 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1093 } else {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1094 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
1095 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
1096 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1097 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1098 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1099
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1100 enum {DRAG_BUDDY, DRAG_ROW};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1101
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1102 static char *
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1103 item_factory_translate_func (const char *path, gpointer func_data)
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1104 {
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1105 return _(path);
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1106 }
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1107
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1108 static void gaim_gtk_blist_show(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1109 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1110 GtkItemFactory *ift;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1111 GtkCellRenderer *rend;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1112 GtkTreeViewColumn *column;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1113 GtkWidget *sw;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1114 GtkWidget *button;
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1115 GtkSizeGroup *sg;
5089
29b80bc21ba7 [gaim-migrate @ 5451]
Luke Schierer <lschiere@pidgin.im>
parents: 5068
diff changeset
1116 GtkAccelGroup *accel_group;
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1117 GtkTreeSelection *selection;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1118 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
1119 {"application/x-im-contact", 0, DRAG_BUDDY}};
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1120
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1121 if (gtkblist && gtkblist->window) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1122 gtk_widget_show(gtkblist->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1123 return;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1124 }
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1125
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1126 gtkblist = GAIM_GTK_BLIST(list);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1127
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1128 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1129 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
4964
b9b2d7665721 [gaim-migrate @ 5298]
Rob Flynn <gaim@robflynn.com>
parents: 4960
diff changeset
1130 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1131
5168
0f31d00d2501 [gaim-migrate @ 5532]
Nathan Walp <nwalp@pidgin.im>
parents: 5156
diff changeset
1132 GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
0f31d00d2501 [gaim-migrate @ 5532]
Nathan Walp <nwalp@pidgin.im>
parents: 5156
diff changeset
1133
4925
d947652a0b74 [gaim-migrate @ 5259]
Mark Doliner <mark@kingant.net>
parents: 4921
diff changeset
1134 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1135 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1136
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1137 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1138 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1139 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1140 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1141
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1142 /******************************* Menu bar *************************************/
5089
29b80bc21ba7 [gaim-migrate @ 5451]
Luke Schierer <lschiere@pidgin.im>
parents: 5068
diff changeset
1143 accel_group = gtk_accel_group_new();
29b80bc21ba7 [gaim-migrate @ 5451]
Luke Schierer <lschiere@pidgin.im>
parents: 5068
diff changeset
1144 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
29b80bc21ba7 [gaim-migrate @ 5451]
Luke Schierer <lschiere@pidgin.im>
parents: 5068
diff changeset
1145 g_object_unref(accel_group);
29b80bc21ba7 [gaim-migrate @ 5451]
Luke Schierer <lschiere@pidgin.im>
parents: 5068
diff changeset
1146 ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", accel_group);
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1147 gtk_item_factory_set_translate_func (ift,
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1148 item_factory_translate_func,
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1149 NULL, NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1150 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
1151 blist_menu, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1152 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
1153
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1154 awaymenu = gtk_item_factory_get_widget(ift, N_("/Tools/Away"));
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1155 do_away_menu();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1156
5032
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
1157 gtkblist->bpmenu = gtk_item_factory_get_widget(ift, N_("/Tools/Buddy Pounce"));
cb700c07ee07 [gaim-migrate @ 5375]
Christian Hammond <chipx86@chipx86.com>
parents: 5024
diff changeset
1158 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1159
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1160 protomenu = gtk_item_factory_get_widget(ift, N_("/Tools/Protocol Actions"));
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1161 do_proto_menu();
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1162
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1163 /****************************** GtkTreeView **********************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1164 sw = gtk_scrolled_window_new(NULL,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1165 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
1166 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1167
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1168 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, G_TYPE_STRING,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1169 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
1170
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1171 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
4943
f0c7d092948d [gaim-migrate @ 5277]
Rob Flynn <gaim@robflynn.com>
parents: 4936
diff changeset
1172 gtk_widget_set_size_request(gtkblist->treeview, -1, 200);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1173
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1174 /* Set up selection stuff */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1175
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1176 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1177 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
1178
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1179
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1180 /* Set up dnd */
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1181 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
1182 2, GDK_ACTION_COPY);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1183 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
1184 GDK_ACTION_COPY | GDK_ACTION_MOVE);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1185 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
1186 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
1187
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1188 /* Tooltips */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1189 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
1190 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
1191
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1192 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
1193
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1194 column = gtk_tree_view_column_new ();
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1195
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1196 rend = gtk_cell_renderer_pixbuf_new();
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1197 gtk_tree_view_column_pack_start (column, rend, FALSE);
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1198 gtk_tree_view_column_set_attributes (column, rend,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1199 "pixbuf", STATUS_ICON_COLUMN,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1200 "visible", STATUS_ICON_VISIBLE_COLUMN,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1201 NULL);
4933
34448ffab4f1 [gaim-migrate @ 5267]
Luke Schierer <lschiere@pidgin.im>
parents: 4930
diff changeset
1202 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
1203
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1204 rend = gtk_cell_renderer_text_new();
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1205 gtk_tree_view_column_pack_start (column, rend, TRUE);
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1206 gtk_tree_view_column_set_attributes (column, rend,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1207 "markup", NAME_COLUMN,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1208 NULL);
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1209 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1210
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1211 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
1212
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1213 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1214 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
1215 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
1216 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1217
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1218 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1219 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
1220 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
1221 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1222
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1223 rend = gtk_cell_renderer_pixbuf_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1224 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
1225 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1226 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
1227
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1228 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL);
5142
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1229 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL);
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1230 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1231 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
1232
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1233 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
1234 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1235 gaim_gtk_blist_update_columns();
4934
04ca72a25f75 [gaim-migrate @ 5268]
Luke Schierer <lschiere@pidgin.im>
parents: 4933
diff changeset
1236
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1237 /* set the Show Offline Buddies option. must be done
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1238 * after the treeview or faceprint gets mad. -Robot101
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1239 */
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1240 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (ift, N_("/Buddies/Show Offline Buddies"))),
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1241 blist_options & OPT_BLIST_SHOW_OFFLINE);
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1242 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (ift, N_("/Buddies/Show Empty Groups"))),
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1243 !(blist_options & OPT_BLIST_NO_MT_GRP));
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1244
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1245 /* OK... let's show this bad boy. */
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1246 gaim_gtk_blist_refresh(list);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1247 gaim_gtk_blist_restore_position();
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1248 gtk_widget_show_all(gtkblist->window);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1249
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1250 /**************************** Button Box **************************************/
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1251 /* add this afterwards so it doesn't force up the width of the window */
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1252
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1253 gtkblist->tooltips = gtk_tooltips_new();
4973
a9b49d0e8970 [gaim-migrate @ 5308]
Luke Schierer <lschiere@pidgin.im>
parents: 4970
diff changeset
1254
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1255 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1256 gtkblist->bbox = gtk_hbox_new(TRUE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1257 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1258 gtk_widget_show(gtkblist->bbox);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1259
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1260 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
1261 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
1262 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1263 gtk_size_group_add_widget(sg, button);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
1264 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
1265 gtkblist->treeview);
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1266 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Send a message to the selected buddy"), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1267 gtk_widget_show(button);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1268
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1269 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
1270 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
1271 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1272 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1273 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
1274 gtkblist->treeview);
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1275 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Get information on the selected buddy"), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1276 gtk_widget_show(button);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1277
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1278 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
1279 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
1280 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1281 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1282 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_chat_cb), NULL);
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1283 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Join a chat room"), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1284 gtk_widget_show(button);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1285
5024
8e55a4d362a3 [gaim-migrate @ 5361]
Sean Egan <seanegan@gmail.com>
parents: 5018
diff changeset
1286 button = gaim_pixbuf_button_from_stock(_("Away"), GAIM_STOCK_ICON_AWAY, GAIM_BUTTON_VERTICAL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1287 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
1288 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1289 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1290 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_away_cb), NULL);
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1291 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Set an away message"), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1292 gtk_widget_show(button);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1293
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1294 /* this will show the right image/label widgets for us */
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1295 gaim_gtk_blist_update_toolbar();
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1296
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1297 /* start the refresh timer */
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1298 gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1299 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1300
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1301 void gaim_gtk_blist_refresh(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1302 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1303 GaimBlistNode *group = list->root;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1304 GaimBlistNode *buddy;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1305
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1306 while (group) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1307 buddy = group->child;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1308 gaim_gtk_blist_update(list, group);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1309 while (buddy) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1310 gaim_gtk_blist_update(list, buddy);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1311 buddy = buddy->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1312 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1313 group = group->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1314 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1315 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1316
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1317 static gboolean get_iter_from_node_helper(GaimBlistNode *node, GtkTreeIter *iter, GtkTreeIter *root) {
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
1318
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1319 do {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1320 GaimBlistNode *n;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1321 GtkTreeIter child;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1322
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1323 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
1324 if(n == node) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1325 *iter = *root;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1326 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1327 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1328
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1329 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
1330 if(get_iter_from_node_helper(node,iter,&child))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1331 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1332 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1333 } 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
1334
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1335 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1336 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1337
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1338 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1339 GtkTreeIter root;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1340
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1341 if (!gtkblist)
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1342 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1343
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1344 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
1345 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1346
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1347 return get_iter_from_node_helper(node, iter, &root);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1348 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1349
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1350 /*
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1351 * These state assignments suck. I'm sorry. They're for historical reasons.
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1352 * Roll on new prefs. -Robot101
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1353 *
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1354 * NO_BUTTON_TEXT && SHOW_BUTTON_XPM - image
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1355 * !NO_BUTTON_TEXT && !SHOW_BUTTON_XPM - text
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1356 * !NO_BUTTON_TEXT && SHOW_BUTTON_XPM - text & images
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1357 * NO_BUTTON_TEXT && !SHOW_BUTTON_XPM - none
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1358 */
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1359
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1360 static void gaim_gtk_blist_update_toolbar_icons (GtkWidget *widget, gpointer data) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1361 if (GTK_IS_IMAGE(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1362 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1363 gtk_widget_show(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1364 else
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1365 gtk_widget_hide(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1366 } else if (GTK_IS_LABEL(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1367 if (blist_options & OPT_BLIST_NO_BUTTON_TEXT)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1368 gtk_widget_hide(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1369 else
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1370 gtk_widget_show(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1371 } else if (GTK_IS_CONTAINER(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1372 gtk_container_foreach(GTK_CONTAINER(widget), gaim_gtk_blist_update_toolbar_icons, NULL);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1373 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1374 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1375
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1376 void gaim_gtk_blist_update_toolbar() {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1377 if (!gtkblist)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1378 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1379
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1380 if (blist_options & OPT_BLIST_NO_BUTTON_TEXT && !(blist_options & OPT_BLIST_SHOW_BUTTON_XPM))
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1381 gtk_widget_hide(gtkblist->bbox);
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1382 else {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1383 gtk_container_foreach(GTK_CONTAINER(gtkblist->bbox), gaim_gtk_blist_update_toolbar_icons, NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1384 gtk_widget_show(gtkblist->bbox);
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1385 }
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1386 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1387
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1388 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
1389 {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1390 GtkTreeIter iter;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1391
4912
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1392 /* For some reason, we're called before we have a buddy list sometimes */
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1393 if(!gtkblist)
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1394 return;
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1395
4831
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1396 if(gtkblist->selected_node == node)
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1397 gtkblist->selected_node = NULL;
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1398
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1399 if (get_iter_from_node(node, &iter)) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1400 gtk_tree_store_remove(gtkblist->treemodel, &iter);
5041
c4b691b0cc0d [gaim-migrate @ 5385]
Nathan Walp <nwalp@pidgin.im>
parents: 5032
diff changeset
1401 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
c4b691b0cc0d [gaim-migrate @ 5385]
Nathan Walp <nwalp@pidgin.im>
parents: 5032
diff changeset
1402 gaim_gtk_blist_update(list, node->parent);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1403 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1404 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1405 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1406
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1407 static gboolean do_selection_changed(GaimBlistNode *new_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1408 {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1409 GaimBlistNode *old_selection = gtkblist->selected_node;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1410
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1411 if(new_selection != gtkblist->selected_node) {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1412 gtkblist->selected_node = new_selection;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1413 if(new_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1414 gaim_gtk_blist_update(NULL, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1415 if(old_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1416 gaim_gtk_blist_update(NULL, old_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1417 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1418
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1419 return FALSE;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1420 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1421
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1422 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1423 {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1424 GaimBlistNode *new_selection = NULL;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1425 GtkTreeIter iter;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1426
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1427 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1428 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1429 NODE_COLUMN, &new_selection, -1);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1430 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1431 /* we set this up as a timeout, otherwise the blist flickers */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1432 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1433 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1434
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1435 static void make_a_group(GaimBlistNode *node, GtkTreeIter *iter) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1436 GaimBlistNode *sibling;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1437 GtkTreeIter siblingiter;
4980
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1438 struct group *group = (struct group *)node;
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1439 char *esc = g_markup_escape_text(group->name, -1);
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1440 char *mark;
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1441
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1442 if(blist_options & OPT_BLIST_SHOW_GRPNUM)
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1443 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", esc, gaim_blist_get_group_online_count(group), gaim_blist_get_group_size(group, FALSE));
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1444 else
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1445 mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1446
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1447 g_free(esc);
4980
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1448
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1449 sibling = node->prev;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1450 while (sibling && !get_iter_from_node(sibling, &siblingiter)) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1451 sibling = sibling->prev;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1452 }
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1453
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1454 gtk_tree_store_insert_after(gtkblist->treemodel, iter, NULL,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1455 sibling ? &siblingiter : NULL);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1456 gtk_tree_store_set(gtkblist->treemodel, iter,
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1457 STATUS_ICON_COLUMN, NULL,
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1458 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1459 NAME_COLUMN, mark,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1460 NODE_COLUMN, node,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1461 -1);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1462 g_free(mark);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1463 }
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1464
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1465
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1466 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
1467 {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1468 GtkTreeIter iter;
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1469 GtkTreePath *expand = NULL;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1470 gboolean new_entry = FALSE;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1471
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1472 if (!gtkblist)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1473 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1474
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1475 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
1476 new_entry = TRUE;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1477 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
1478 if (((struct buddy*)node)->present != GAIM_BUDDY_OFFLINE || ((blist_options & OPT_BLIST_SHOW_OFFLINE) && ((struct buddy*)node)->account->gc)) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1479 GtkTreeIter groupiter;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1480 GaimBlistNode *oldersibling;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1481 GtkTreeIter oldersiblingiter;
5142
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1482 char *collapsed = gaim_group_get_setting((struct group *)node->parent, "collapsed");
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1483
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1484 if(node->parent &&
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1485 !get_iter_from_node(node->parent, &groupiter)) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1486 /* This buddy's group has not yet been added.
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1487 * We do that here */
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1488 make_a_group(node->parent, &groupiter);
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1489 }
5142
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1490 if(!collapsed)
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1491 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter);
5142
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1492 else
94f11800cac5 [gaim-migrate @ 5506]
Nathan Walp <nwalp@pidgin.im>
parents: 5135
diff changeset
1493 g_free(collapsed);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1494
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1495 oldersibling = node->prev;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
1496 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter)) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1497 oldersibling = oldersibling->prev;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
1498 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1499
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1500 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
1501
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1502 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1503 gtk_window_present(GTK_WINDOW(gtkblist->window));
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1504
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1505 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1506 }
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1507 else if (GAIM_BLIST_NODE_IS_GROUP(node) &&
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1508 ((blist_options & OPT_BLIST_SHOW_OFFLINE) ||
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1509 !(blist_options & OPT_BLIST_NO_MT_GRP))) {
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1510 make_a_group(node, &iter);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1511 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1512 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1513 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
5000
17f5e6628b37 [gaim-migrate @ 5335]
Nathan Walp <nwalp@pidgin.im>
parents: 4999
diff changeset
1514 if((blist_options & OPT_BLIST_NO_MT_GRP) && !(blist_options & OPT_BLIST_SHOW_OFFLINE) && !gaim_blist_get_group_online_count((struct group *)node)) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1515 gtk_tree_store_remove(gtkblist->treemodel, &iter);
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1516 } else {
4980
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1517 struct group *group = (struct group *)node;
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1518 char *esc = g_markup_escape_text(group->name, -1);
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1519 char *mark;
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1520
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1521 if(blist_options & OPT_BLIST_SHOW_GRPNUM)
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1522 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", esc, gaim_blist_get_group_online_count(group), gaim_blist_get_group_size(group, FALSE));
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1523 else
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1524 mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1525
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1526 g_free(esc);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1527 gtk_tree_store_set(gtkblist->treemodel, &iter,
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1528 NAME_COLUMN, mark,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1529 -1);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1530 g_free(mark);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1531 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1532 }
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1533
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
1534 if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present != GAIM_BUDDY_OFFLINE || ((blist_options & OPT_BLIST_SHOW_OFFLINE) && ((struct buddy*)node)->account->gc))) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1535 GdkPixbuf *status, *avatar;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1536 char *mark;
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1537 char *warning = NULL, *idle = NULL;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1538
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1539 gboolean selected = (gtkblist->selected_node == node);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1540
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1541 status = gaim_gtk_blist_get_status_icon((struct buddy*)node,
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1542 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
1543 avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1544 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
1545
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1546 if (((struct buddy*)node)->idle > 0) {
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1547 time_t t;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1548 int ihrs, imin;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1549 time(&t);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1550 ihrs = (t - ((struct buddy *)node)->idle) / 3600;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1551 imin = ((t - ((struct buddy*)node)->idle) / 60) % 60;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1552 if(ihrs > 0)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1553 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1554 else
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1555 idle = g_strdup_printf("(%d)", imin);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1556 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1557
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1558 if (((struct buddy*)node)->evil > 0)
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1559 warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1560
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1561
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1562 if((blist_options & OPT_BLIST_GREY_IDLERS)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1563 && ((struct buddy *)node)->idle) {
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1564 if(warning && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1565 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1566 warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1567 g_free(warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1568 warning = w2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1569 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1570
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1571 if(idle && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1572 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1573 idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1574 g_free(idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1575 idle = i2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1576 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1577 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1578
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1579 gtk_tree_store_set(gtkblist->treemodel, &iter,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1580 STATUS_ICON_COLUMN, status,
5060
db4280b42f2f [gaim-migrate @ 5411]
Sean Egan <seanegan@gmail.com>
parents: 5055
diff changeset
1581 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1582 NAME_COLUMN, mark,
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1583 WARNING_COLUMN, warning,
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1584 IDLE_COLUMN, idle,
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1585 BUDDY_ICON_COLUMN, avatar,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1586 NODE_COLUMN, node,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1587 -1);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1588
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1589 g_free(mark);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1590 if (idle)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1591 g_free(idle);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1592 if (warning)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1593 g_free(warning);
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1594
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1595 if (status != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1596 g_object_unref(status);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1597
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1598 if (avatar != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1599 g_object_unref(avatar);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1600
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1601 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1602 gaim_gtk_blist_remove(list, node);
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1603 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1604 gtk_window_present(GTK_WINDOW(gtkblist->window));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1605 }
4980
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1606 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1607
4974
0581a59c9492 [gaim-migrate @ 5309]
Luke Schierer <lschiere@pidgin.im>
parents: 4973
diff changeset
1608
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1609 if(expand) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1610 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, TRUE);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1611 gtk_tree_path_free(expand);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1612 }
4980
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1613
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1614 if(GAIM_BLIST_NODE_IS_BUDDY(node))
06baf1e9094c [gaim-migrate @ 5315]
Nathan Walp <nwalp@pidgin.im>
parents: 4978
diff changeset
1615 gaim_gtk_blist_update(list, node->parent);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1616 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1617
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1618 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1619 {
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1620 if (!gtkblist)
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1621 return;
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1622
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1623 gtk_widget_destroy(gtkblist->window);
5018
f82e6763e039 [gaim-migrate @ 5354]
Nathan Walp <nwalp@pidgin.im>
parents: 5017
diff changeset
1624 gtk_object_sink(GTK_OBJECT(gtkblist->tooltips));
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1625
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1626 if (gtkblist->refresh_timer)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1627 g_source_remove(gtkblist->refresh_timer);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1628 if (gtkblist->timeout)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1629 g_source_remove(gtkblist->timeout);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1630
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1631 gtkblist->refresh_timer = 0;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1632 gtkblist->timeout = 0;
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1633 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1634 gtkblist->treemodel = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1635 gtkblist->idle_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1636 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1637 gtkblist->bbox = gtkblist->tipwindow = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1638 protomenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1639 awaymenu = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1640 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1641
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1642 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
1643 {
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1644 if (!(gtkblist && gtkblist->window))
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1645 return;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1646
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1647 if (show) {
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1648 gaim_gtk_blist_restore_position();
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1649 gtk_window_present(GTK_WINDOW(gtkblist->window));
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1650 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1651 if (!connections || docklet_count) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1652 #ifdef _WIN32
4711
0c1f3e651d3e [gaim-migrate @ 5022]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4706
diff changeset
1653 wgaim_systray_minimize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1654 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1655 gtk_widget_hide(gtkblist->window);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1656 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1657 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1658 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1659 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1660 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1661
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1662 void gaim_gtk_blist_docklet_toggle() {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1663 /* 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
1664 /* 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
1665 buddy list/login window--depending on which is active */
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1666 if (connections) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1667 if (gtkblist && gtkblist->window) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1668 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1669 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gaim_gtk_blist_obscured);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1670 } else {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1671 #if _WIN32
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1672 wgaim_systray_maximize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1673 #endif
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1674 gaim_blist_set_visible(TRUE);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1675 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1676 } else {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1677 /* we're logging in or something... do nothing */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1678 /* or should I make the blist? */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1679 debug_printf("docklet_toggle called with connections but no blist!\n");
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1680 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1681 } else if (mainwindow) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1682 if (GTK_WIDGET_VISIBLE(mainwindow)) {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1683 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1684 gtk_window_present(GTK_WINDOW(mainwindow));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1685 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1686 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1687 wgaim_systray_minimize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1688 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1689 gtk_widget_hide(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1690 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1691 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1692 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1693 wgaim_systray_maximize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1694 #endif
4833
a6960b4b0c9b [gaim-migrate @ 5158]
Mark Doliner <mark@kingant.net>
parents: 4831
diff changeset
1695 show_login();
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1696 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1697 } else {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1698 show_login();
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1699 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1700 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1701
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1702 void gaim_gtk_blist_docklet_add()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1703 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1704 docklet_count++;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1705 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1706
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1707 void gaim_gtk_blist_docklet_remove()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1708 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1709 docklet_count--;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1710 if (!docklet_count) {
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1711 if (connections)
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1712 gaim_blist_set_visible(TRUE);
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1713 else if (mainwindow)
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1714 gtk_window_present(GTK_WINDOW(mainwindow));
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1715 else
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1716 show_login();
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1717 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1718 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1719
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1720 static struct gaim_blist_ui_ops blist_ui_ops =
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1721 {
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1722 gaim_gtk_blist_new_list,
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5060
diff changeset
1723 NULL,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1724 gaim_gtk_blist_show,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1725 gaim_gtk_blist_update,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1726 gaim_gtk_blist_remove,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1727 gaim_gtk_blist_destroy,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1728 gaim_gtk_blist_set_visible
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1729 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1730
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1731
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1732 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
1733 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1734 return &blist_ui_ops;
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1735 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1736
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1737
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1738
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1739 /*********************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1740 * Public utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1741 *********************************************************************/
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1742
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1743 GdkPixbuf *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1744 create_prpl_icon(struct gaim_account *account)
4553
d03fcb3f4be2 [gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents: 4525
diff changeset
1745 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1746 struct prpl *prpl = find_prpl(account->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1747 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1748 char *filename = NULL;
5151
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1749 const char *protoname = NULL;
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1750
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1751 /* this is so we can get the icon when the prpl isn't loaded.
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1752 * it's not as bad as it looks, since most of the time this function
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1753 * is called, the prpl is already loaded, so it'll just increment and
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1754 * decrement the refcount, won't have to go through the hassle of
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1755 * actually loading and unloading the prpl. the few times it actually
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1756 * does that, it saves us from crashing */
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1757 if(prpl && prpl->list_icon) {
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1758 ref_protocol(prpl);
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1759 protoname = prpl->list_icon(account, NULL);
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1760 unref_protocol(prpl);
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1761 }
ab2ae9dc9370 [gaim-migrate @ 5515]
Nathan Walp <nwalp@pidgin.im>
parents: 5147
diff changeset
1762
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1763 /* "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
1764 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1765 if (!strcmp(protoname, "aim")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1766 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
1767 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1768 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1769 } else if (!strcmp(protoname, "yahoo")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1770 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
1771 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1772 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1773 } else if (!strcmp(protoname, "msn")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1774 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
1775 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1776 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1777 } else if (!strcmp(protoname, "jabber")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1778 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
1779 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1780 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1781 } else if (!strcmp(protoname, "icq")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1782 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
1783 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1784 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1785 } else if (!strcmp(protoname, "gadu-gadu")) {
4987
1f92610b0772 [gaim-migrate @ 5322]
Mark Doliner <mark@kingant.net>
parents: 4985
diff changeset
1786 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "gadu-gadu.png", NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1787 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1788 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1789 } else if (!strcmp(protoname, "napster")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1790 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
1791 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1792 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1793 } else if (!strcmp(protoname, "irc")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1794 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
1795 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1796 g_free(filename);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
1797 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1798 return status;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1799 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1800