annotate src/buddy.c @ 4962:b6fd57ba76e8

[gaim-migrate @ 5296] I was looking at faceprint's patch and decided this might be a good idea. I think it probably is. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 02 Apr 2003 09:08:32 +0000
parents 42bd8ab53234
children b9b2d7665721
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
22 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2048
diff changeset
23 #include <config.h>
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 342
diff changeset
24 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
25 #ifdef GAIM_PLUGINS
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
26 #ifndef _WIN32
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
27 #include <dlfcn.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
28 #endif
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
29 #endif /* GAIM_PLUGINS */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
30 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
32 #include <stdlib.h>
3159
fce1883cc608 [gaim-migrate @ 3175]
Sean Egan <seanegan@gmail.com>
parents: 3154
diff changeset
33 #include <ctype.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
34 #include <math.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <time.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
36 #include <ctype.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
37
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
38 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
39 #include <gdk/gdkwin32.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
40 #else
1233
728a90516211 [gaim-migrate @ 1243]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1230
diff changeset
41 #include <unistd.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
42 #include <gdk/gdkx.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
43 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
1634
d029dc28a61e [gaim-migrate @ 1644]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1625
diff changeset
45 #include <gdk/gdkkeysyms.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <gtk/gtk.h>
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1002
diff changeset
47 #include "prpl.h"
4561
9df99116840a [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4553
diff changeset
48 #include "sound.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 #include "gaim.h"
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
50 #include "gtklist.h"
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
51 #include "gtkft.h"
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
52
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
53 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
54 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
55 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3570
diff changeset
56
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
57 static struct gaim_gtk_buddy_list *gtkblist = NULL;
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
58
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
59 /* 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
60 static gboolean gaim_gtk_blist_obscured = FALSE;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
61
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
62 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
63 static void gaim_gtk_blist_update(struct gaim_buddy_list *list, GaimBlistNode *node);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
64 static char *gaim_get_tooltip_text(struct buddy *b);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
65 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size);
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 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
152 show_new_bp(b->name, b->account->gc, b->idle,
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
153 b->uc & UC_UNAVAILABLE, NULL);
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
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
156 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
157 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
158 show_log(b->name);
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
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
161 static void gtk_blist_show_systemlog_cb()
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
162 {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
163 show_log(NULL);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
164 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
165
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
166 static void gtk_blist_show_onlinehelp_cb()
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
167 {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
168 open_url(NULL, WEBSITE "documentation.php");
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
169 }
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
170
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
171 static void gtk_blist_button_im_cb(GtkWidget *w, GtkTreeView *tv)
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
172 {
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
173 GtkTreeIter iter;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
174 GtkTreeModel *model = gtk_tree_view_get_model(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
175 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
176
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
177 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
178 GaimBlistNode *node;
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
179
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
180 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
181 if (GAIM_BLIST_NODE_IS_BUDDY(node))
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
182 gaim_conversation_new(GAIM_CONV_IM, ((struct buddy*)node)->account, ((struct buddy*)node)->name);
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
183 }
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
184 }
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
185
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
186 static void gtk_blist_button_info_cb(GtkWidget *w, GtkTreeView *tv)
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
187 {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
188 GtkTreeIter iter;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
189 GtkTreeModel *model = gtk_tree_view_get_model(tv);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
190 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
191
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
192 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
193 GaimBlistNode *node;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
194
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
195 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
196 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
197 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
198 return;
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
199 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
200 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
201 show_info_dialog();
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
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
204 static void gtk_blist_button_chat_cb(GtkWidget *w, gpointer data)
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 /* 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
207 join_chat();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
208 }
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
209
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
210 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
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 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
213 }
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
214
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
215 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
216 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
217 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
218 GValue val = { 0, };
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
219
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
220 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
221
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
222 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
223 node = g_value_get_pointer(&val);
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
224
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
225 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4911
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
226 struct gaim_conversation *conv =
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
227 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
228 if(conv) {
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
229 gaim_window_raise(gaim_conversation_get_window(conv));
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
230 gaim_window_switch_conversation(
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
231 gaim_conversation_get_window(conv),
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
232 gaim_conversation_get_index(conv));
50b77ae4cacf [gaim-migrate @ 5245]
Luke Schierer <lschiere@pidgin.im>
parents: 4907
diff changeset
233 }
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
234 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
235 if (gtk_tree_view_row_expanded(tv, path))
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
236 gtk_tree_view_collapse_row(tv, path);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
237 else
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
238 gtk_tree_view_expand_row(tv,path,FALSE);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
239 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
240 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
241
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
242 static void gaim_gtk_blist_add_buddy_cb()
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
243 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
244 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
245 GtkTreeIter iter;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
246 GaimBlistNode *node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
247
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
248 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
249 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
250 if (GAIM_BLIST_NODE_IS_BUDDY(node))
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
251 show_add_buddy(NULL, NULL, ((struct group*)node->parent)->name, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
252 else if (GAIM_BLIST_NODE_IS_GROUP(node))
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
253 show_add_buddy(NULL, NULL, ((struct group*)node)->name, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
254 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
255 else {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
256 show_add_buddy(NULL, NULL, NULL, NULL);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
257 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
258 }
4921
d5c136474f26 [gaim-migrate @ 5255]
Nathan Walp <nwalp@pidgin.im>
parents: 4918
diff changeset
259 static void
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
260 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
261 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
262 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
263 struct buddy *b = (struct buddy*)node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
264 show_confirm_del(b->account->gc, b->name);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
265 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
266 struct group *g = (struct group*)node;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
267 show_confirm_del_group(g);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
268 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
269 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
270
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
271 static void gaim_proto_menu_cb(GtkMenuItem *item, struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
272 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
273 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
274 if (pbm->callback)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
275 pbm->callback(pbm->gc, b->name);
1396
df7c3cacac92 [gaim-migrate @ 1406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1392
diff changeset
276 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
278 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
279 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
280 GtkTreePath *path;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
281 GaimBlistNode *node;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
282 GValue val = { 0, };
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
283 GtkTreeIter iter;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
284 GtkWidget *menu, *menuitem;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
285 GtkWidget *image;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
286 GtkTreeSelection *sel;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
287 GList *list;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
288 struct prpl *prpl;
1391
d606da211acb [gaim-migrate @ 1401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
289
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
290 if (event->button != 3)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
291 return FALSE;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
292
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
293 /* Here we figure out which node was clicked */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
294 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
295 return FALSE;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
296 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
297 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
298 node = g_value_get_pointer(&val);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
299 menu = gtk_menu_new();
3251
b3c7af7286de [gaim-migrate @ 3269]
Jim Seymour <jseymour>
parents: 3204
diff changeset
300
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
301 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
302 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Add a Buddy"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
303 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
304 image = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
305 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
306 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
307
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
308 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Delete Group"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
309 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gaim_gtk_blist_remove_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
310 image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
311 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
312 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
313
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
314 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Rename"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
315 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(show_rename_group), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
316 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
317 } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
318 /* Protocol specific options */
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
319 prpl = find_prpl(((struct buddy*)node)->account->protocol);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
320
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
321 if(prpl && prpl->get_info) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
322 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Get Info"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
323 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_info_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
324 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
325 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
326
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
327 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_IM"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
328 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_im_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
329 image = gtk_image_new_from_stock(GAIM_STOCK_IM, GTK_ICON_SIZE_MENU);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
330 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
331 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
332
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
333 menuitem = gtk_image_menu_item_new_with_mnemonic(_("Add Buddy _Pounce"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
334 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_bp_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
335 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
336
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
337 menuitem = gtk_image_menu_item_new_with_mnemonic(_("View _Log"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
338 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_showlog_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
339 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
340
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
341 if (prpl) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
342 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
343 while (list) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
344 struct proto_buddy_menu *pbm = list->data;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
345 menuitem = gtk_menu_item_new_with_mnemonic(pbm->label);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
346 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", pbm);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
347 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
348 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
349 list = list->next;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
350 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
351 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
352
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
353 gaim_separator(menu);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
354
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
355 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Alias"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
356 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gtk_blist_menu_alias_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
357 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
358
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
359 menuitem = gtk_image_menu_item_new_with_mnemonic(_("_Remove"));
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
360 g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(gaim_gtk_blist_remove_cb), node);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
361 image = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
362 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
363 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
364 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
365
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
366 gtk_widget_show_all(menu);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
367
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
368 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
369
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
370 #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
371 * 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
372 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
373 gtk_tree_selection_select_path(sel, path);
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
374 gtk_tree_path_free(path);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
375 return TRUE;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
376 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
377 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
378
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
379 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
380 GtkWidget *checkitem) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
381 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
382 gdk_window_set_cursor(gtkblist->window->window, cursor);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
383 while (gtk_events_pending())
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
384 gtk_main_iteration();
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
385 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
386 blist_options |= OPT_BLIST_SHOW_OFFLINE;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
387 else
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
388 blist_options &= ~OPT_BLIST_SHOW_OFFLINE;
4929
8a20332821b6 [gaim-migrate @ 5263]
Sean Egan <seanegan@gmail.com>
parents: 4928
diff changeset
389 save_prefs();
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
390 gdk_cursor_unref(cursor);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
391 cursor = gdk_cursor_new(GDK_LEFT_PTR);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
392 gdk_window_set_cursor(gtkblist->window->window, cursor);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
393 gdk_cursor_unref(cursor);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
394 gaim_gtk_blist_refresh(gaim_get_blist());
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
395 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4349
diff changeset
396
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
397 /* This is called 10 seconds after the buddy logs in. It removes the "logged in" icon and replaces it with
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
398 * the normal status icon. Make sure they didn't sign off in the mean-time though. */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
399
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
400 static gboolean gaim_reset_present_icon (GaimBlistNode *b)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
401 {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
402 if (((struct buddy *)b)->present == 2) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
403 ((struct buddy *)b)->present = 1;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
404 gaim_gtk_blist_update(NULL, b);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
405 }
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
406
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
407 return FALSE;
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
408 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
409
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
410 static void gaim_gtk_blist_drag_data_get_cb (GtkWidget *widget,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
411 GdkDragContext *dc,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
412 GtkSelectionData *data,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
413 guint info,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
414 guint time,
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
415 gpointer *null)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
416 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
417 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) {
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
418 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
419 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
420 GtkTreeIter iter;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
421 GaimBlistNode *node = NULL;
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
422 GValue val = {0};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
423 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
424 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
425 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
426 gtk_selection_data_set (data,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
427 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
428 8, /* bits */
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
429 (void*)&node,
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
430 sizeof (node));
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
431
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
432 gtk_tree_path_free(sourcerow);
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
433 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
434
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
435 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
436
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
437 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
438 GtkSelectionData *sd, guint info, guint t)
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
439 {
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
440 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
441 GaimBlistNode *n = NULL;
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
442 GtkTreePath *path = NULL;
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
443 GtkTreeViewDropPosition position;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
444 memcpy(&n, sd->data, sizeof(n));
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
445 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
446 /* 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
447 GtkTreeIter iter;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
448 GaimBlistNode *node;
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
449 GValue val = {0};
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
450 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
451 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
452 node = g_value_get_pointer(&val);
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
453
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
454 if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
455 struct buddy *b = (struct buddy*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
456 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
457 switch(position) {
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
458 case GTK_TREE_VIEW_DROP_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
459 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
460 gaim_blist_add_buddy(b, (struct group*)node->parent, node);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
461 break;
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
462 case GTK_TREE_VIEW_DROP_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
463 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
464 gaim_blist_add_buddy(b, (struct group*)node->parent, node->prev);
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
465 break;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
466 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
467 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
468 gaim_blist_add_buddy(b, (struct group*)node, NULL);
4795
433ff974bee6 [gaim-migrate @ 5115]
Nathan Walp <nwalp@pidgin.im>
parents: 4794
diff changeset
469 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
470 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
471 struct group *g = (struct group*)n;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
472 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
473 switch (position) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
474 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
475 case GTK_TREE_VIEW_DROP_AFTER:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
476 gaim_blist_add_group(g, node);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
477 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
478 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
479 case GTK_TREE_VIEW_DROP_BEFORE:
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
480 gaim_blist_add_group(g, node->prev);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
481 break;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
482 }
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
483
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
484 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
485
4777
e23a7e166680 [gaim-migrate @ 5097]
Nathan Walp <nwalp@pidgin.im>
parents: 4776
diff changeset
486 }
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
487
4721
91ef4fae4a49 [gaim-migrate @ 5033]
Nathan Walp <nwalp@pidgin.im>
parents: 4718
diff changeset
488 gtk_tree_path_free(path);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
489 }
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
490 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
491 }
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
492
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
493 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
494 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
495 GtkStyle *style;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
496 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
497 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
498 char *tooltiptext = gaim_get_tooltip_text(b);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
499
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
500 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
501 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
502 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
503 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
504 style = gtkblist->tipwindow->style;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
505
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
506 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
507 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
508
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
509 #if GTK_CHECK_VERSION(2,2,0)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
510 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
511 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
512 #else
4758
2202f056a1c9 [gaim-migrate @ 5075]
Nathan Walp <nwalp@pidgin.im>
parents: 4757
diff changeset
513 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
514 #endif
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
515
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
516 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, TRUE,
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
517 NULL, gtkblist->tipwindow, "tooltip", 38, 4, layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
518
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
519 g_object_unref (pixbuf);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
520 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
521 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
522 return;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
523 }
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 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
526 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
527 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
528 GtkTreeIter iter;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
529 GaimBlistNode *node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
530 GValue val = {0};
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
531
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
532 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
533 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
534 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
535 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
536 node = g_value_get_pointer(&val);
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 (GAIM_BLIST_NODE_IS_BUDDY(node)) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
539 int scr_w,scr_h, w, h, x, y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
540 PangoLayout *layout;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
541 struct buddy *buddy = (struct buddy*)node;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
542 char *tooltiptext = gaim_get_tooltip_text(buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
543 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
4907
68e2b07ef8d7 [gaim-migrate @ 5241]
Christian Hammond <chipx86@chipx86.com>
parents: 4883
diff changeset
544 gtkblist->tipwindow->parent = tv;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
545 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
546 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
547 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
4883
3c3bafae42e8 [gaim-migrate @ 5213]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4879
diff changeset
548 gtk_widget_realize(gtkblist->tipwindow);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
549 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
550 G_CALLBACK(gaim_gtk_blist_paint_tip), buddy);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
551 gtk_widget_ensure_style (gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
552
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
553 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
4733
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
554 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
76ccf9740183 [gaim-migrate @ 5048]
Sean Egan <seanegan@gmail.com>
parents: 4732
diff changeset
555 pango_layout_set_width(layout, 300000);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
556 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
557 scr_w = gdk_screen_width();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
558 scr_h = gdk_screen_height();
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
559 pango_layout_get_size (layout, &w, &h);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
560 w = PANGO_PIXELS(w) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
561 h = PANGO_PIXELS(h) + 8;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
562
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
563 /* 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
564 I should #define this or something */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
565 w = w + 38;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
566 h = MAX(h, 38);
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 gdk_window_get_pointer(NULL, &x, &y, NULL);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
569 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
570 y+=gtkblist->window->allocation.y;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
571
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
572 x -= ((w >> 1) + 4);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
573
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
574 if ((x + w) > scr_w)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
575 x -= (x + w) - scr_w;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
576 else if (x < 0)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
577 x = 0;
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 ((y + h + 4) > scr_h)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
580 y = y - h;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
581 else
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
582 y = y + 6;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
583 g_object_unref (layout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
584 g_free(tooltiptext);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
585 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
586 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
587 gtk_widget_show(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
588 }
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
589
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
590 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
591 return FALSE;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
592 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
593
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
594 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
595 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
596 GtkTreePath *path;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
597 if (gtkblist->timeout) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
598 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
599 return FALSE;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
600 /* 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
601 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
602 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
603 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
604 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
605
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
606 g_source_remove(gtkblist->timeout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
607 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
608
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
609 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
610 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
611 if (path)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
612 gtk_tree_path_free(path);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
613 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
614 return FALSE;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
615 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
616
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
617 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
618 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
619 if (gtkblist->timeout == 0)
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
620 return;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
621 if (gtkblist->tipwindow) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
622 gtk_widget_destroy(gtkblist->tipwindow);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
623 gtkblist->tipwindow = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
624 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
625 g_source_remove(gtkblist->timeout);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
626 gtkblist->timeout = 0;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
627 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
628
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
629 /***************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
630 * Crap *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
631 ***************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
632 static GtkItemFactoryEntry blist_menu[] =
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
633 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
634 /* Buddies menu */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
635 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
636 { N_("/Buddies/New _Instant Message..."), "<CTL>I", show_im_dialog, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
637 "<StockItem>", GAIM_STOCK_IM },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
638 { N_("/Buddies/Join a _Chat..."), "<CTL>C", join_chat, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
639 "<StockItem>", GAIM_STOCK_CHAT },
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
640 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
641 { N_("/Buddies/Get _User Info..."), "<CTL>J", show_info_dialog, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
642 "<StockItem>", GAIM_STOCK_INFO },
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
643 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
644 { N_("/Buddies/_Signoff"), "<CTL>D", signoff_all, 0, NULL },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
645 { N_("/Buddies/_Quit"), "<CTL>Q", do_quit, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
646 "<StockItem>", GTK_STOCK_QUIT },
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
647
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
648 /* Edit menu */
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
649 { N_("/_Edit"), NULL, NULL, 0, "<Branch>" },
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
650 { N_("/Edit/_Show Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>"},
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
651 { N_("/Edit/_Add a Buddy..."), NULL, gaim_gtk_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
652 { N_("/Edit/Add a _Group..."), NULL, show_add_group, 0, NULL},
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
653 { "/Edit/sep", NULL, NULL, 0, "<Separator>" },
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
654 { N_("/Edit/A_ccounts"), "<CTL>A", account_editor, 0, NULL },
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
655 { N_("/Edit/Preferences"), "<CTL>P", show_prefs, 0,
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
656 "<StockItem>", GTK_STOCK_PREFERENCES },
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
657 { N_("/Edit/Pr_ivacy"), NULL, show_privacy_options, 0, NULL },
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
658
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
659 /* Tools */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
660 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
661 { N_("/Tools/_Away"), NULL, NULL, 0, "<Branch>" },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
662 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
663 { N_("/Tools/sep1"), NULL, NULL, 0, "<Separator>" },
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
664 { N_("/Tools/_File Transfers"), NULL, gaim_show_xfer_dialog, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
665 "<StockItem>", GTK_STOCK_REVERT_TO_SAVED },
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
666 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
667 { N_("/Tools/P_rotocol Actions"), NULL, NULL, 0, "<Branch>" },
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
668 { 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
669
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
670 /* Help */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
671 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
4776
6219ffd18c63 [gaim-migrate @ 5096]
Mark Doliner <mark@kingant.net>
parents: 4773
diff changeset
672 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
673 "<StockItem>", GTK_STOCK_HELP },
4755
54fbd9769677 [gaim-migrate @ 5072]
Mark Doliner <mark@kingant.net>
parents: 4745
diff changeset
674 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
675 { N_("/Help/_About"), NULL, show_about, 0, NULL },
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
676
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
677 };
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
678
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
679 /*********************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
680 * Private Utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
681 *********************************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
682
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
683 static char *gaim_get_tooltip_text(struct buddy *b)
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 char *text = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
686 struct prpl* prpl = find_prpl(b->account->protocol);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
687 char *statustext = NULL;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
688 char *aliastext = NULL, *nicktext = NULL;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
689 char *warning = NULL, *idletime = NULL;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
690
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
691 if (prpl->tooltip_text) {
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
692 const char *end;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
693 statustext = prpl->tooltip_text(b);
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
694
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
695 if(statustext && !g_utf8_validate(statustext, -1, &end)) {
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
696 char *new = g_strndup(statustext,
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
697 g_utf8_pointer_to_offset(statustext, end));
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
698 g_free(statustext);
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
699 statustext = new;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
700 }
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
701 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
702
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
703 if (b->idle) {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
704 int ihrs, imin;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
705 time_t t;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
706 time(&t);
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
707 ihrs = (t - b->idle) / 3600;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
708 imin = ((t - b->idle) / 60) % 60;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
709 if (ihrs)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
710 idletime = g_strdup_printf(_("%dh%02dm"), ihrs, imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
711 else
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
712 idletime = g_strdup_printf(_("%dm"), imin);
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
713 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
714
4945
f5efec4603ef [gaim-migrate @ 5279]
Sean Egan <seanegan@gmail.com>
parents: 4944
diff changeset
715 if(b->alias && b->alias[0])
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
716 aliastext = g_markup_escape_text(b->alias, -1);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
717
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
718 if(b->server_alias)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
719 nicktext = g_markup_escape_text(b->server_alias, -1);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
720
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
721 if (b->evil > 0)
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
722 warning = g_strdup_printf(_("%d%%"), b->evil);
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
723
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
724 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
725 "%s %s" /* Alias */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
726 "%s %s" /* Nickname */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
727 "%s %s" /* Idle */
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
728 "%s %s" /* Warning */
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
729 "%s" /* Offline */
4741
dbd0761f8814 [gaim-migrate @ 5056]
Sean Egan <seanegan@gmail.com>
parents: 4737
diff changeset
730 "%s%s", /* Status */
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
731 b->name,
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
732 aliastext ? _("\n<b>Alias:</b>") : "", aliastext ? aliastext : "",
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
733 nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "",
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
734 b->idle ? _("\n<b>Idle:</b>") : "", b->idle ? idletime : "",
4744
a0746ffce599 [gaim-migrate @ 5059]
Sean Egan <seanegan@gmail.com>
parents: 4741
diff changeset
735 b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
736 !b->present ? _("\n<b>Status:</b> Offline") : "",
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
737 statustext ? "\n" : "", statustext ? statustext : "");
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
738 if(warning)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
739 g_free(warning);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
740 if(idletime)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
741 g_free(idletime);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
742 if(statustext)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
743 g_free(statustext);
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
744 if(nicktext)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
745 g_free(nicktext);
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
746 if(aliastext)
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
747 g_free(aliastext);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
748
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
749 return text;
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
750
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
751 }
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
752
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
753 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
754 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
755 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
756 GdkPixbuf *scale = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
757 GdkPixbuf *emblem = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
758 gchar *filename = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
759 const char *protoname = NULL;
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
760
4691
d78f7cb8ae4f [gaim-migrate @ 5002]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
761 char *se = NULL, *sw = NULL ,*nw = NULL ,*ne = NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
762
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
763 int scalesize = 30;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
764
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
765 struct prpl* prpl = find_prpl(b->account->protocol);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
766
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
767 if (!prpl)
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
768 return NULL;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
769
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
770 if (prpl->list_icon)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
771 protoname = prpl->list_icon(b->account, b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
772 if (prpl->list_emblems)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
773 prpl->list_emblems(b, &se, &sw, &nw, &ne);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
774
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
775 if (size == GAIM_STATUS_ICON_SMALL) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
776 scalesize = 15;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
777 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
778 }
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
779
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
780
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
781 if (b->present == 2) {
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
782 struct gaim_gtk_blist_node *gtknode;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
783 /* If b->present is 2, that means this buddy has just signed on. We use the "login" icon for the
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
784 * status, and we set a timeout to change it to a normal icon after 10 seconds. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
785 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
786 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
787 g_free(filename);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
788
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
789 gtknode = GAIM_GTK_BLIST_NODE((GaimBlistNode*)b);
4773
75f0c2799664 [gaim-migrate @ 5092]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
790 if (gtknode->timer > 0)
75f0c2799664 [gaim-migrate @ 5092]
Mark Doliner <mark@kingant.net>
parents: 4770
diff changeset
791 g_source_remove(gtknode->timer);
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
792 gtknode->timer = g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
793
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
794 /* "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
795 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
796 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
797 char *image = g_strdup_printf("%s.png", protoname);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
798 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
799 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
800 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
801 g_free(filename);
1929
d51ea669d84e [gaim-migrate @ 1939]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1918
diff changeset
802
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
803 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
804
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
805 if (!status)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
806 return NULL;
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 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
809
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
810 g_object_unref(G_OBJECT(status));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
811
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
812 /* Emblems */
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
813
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
814 /* 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
815 * 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
816
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
817 /* XXX Clean this crap up, yo. */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
818 if (se) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
819 char *image = g_strdup_printf("%s.png", se);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
820 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
821 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
822 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
823 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
824 if (emblem) {
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
825 if (size == GAIM_STATUS_ICON_LARGE)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
826 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
827 scale, 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
828 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
829 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
830 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
831 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
832 255);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
833 else
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
834 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
835 scale, 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
836 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
837 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
838 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
839 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
840 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
841 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
842 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
843 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
844 if (sw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
845 char *image = g_strdup_printf("%s.png", sw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
846 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
847 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
848 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
849 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
850 if (emblem) {
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
851 gdk_pixbuf_composite (emblem,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
852 scale, 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
853 15, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
854 0, 15,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
855 1, 1,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
856 GDK_INTERP_BILINEAR,
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
857 255);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
858 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
859 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
860 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
861 if (nw) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
862 char *image = g_strdup_printf("%s.png", nw);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
863 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
864 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
865 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
866 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
867 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
868 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
869 scale, 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
870 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
871 0, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
872 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
873 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
874 255);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
875 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
876 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
877 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
878 if (ne) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
879 char *image = g_strdup_printf("%s.png", ne);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
880 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
881 g_free(image);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
882 emblem = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
883 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
884 if (emblem) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
885 gdk_pixbuf_composite (emblem,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
886 scale, 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
887 15, 15,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
888 15, 0,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
889 1, 1,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
890 GDK_INTERP_BILINEAR,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
891 255);
4954
decdf19454ab [gaim-migrate @ 5288]
Nathan Walp <nwalp@pidgin.im>
parents: 4947
diff changeset
892 g_object_unref(G_OBJECT(emblem));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
893 }
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
894 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
895
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
896
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
897 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */
4930
d090282c42f7 [gaim-migrate @ 5264]
Nathan Walp <nwalp@pidgin.im>
parents: 4929
diff changeset
898 if (!b->present)
4928
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
899 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
900 else if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
901 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
902 return scale;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
903 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
904
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
905 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(struct buddy *b)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
906 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
907 /* 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
908 char *file;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
909 GdkPixbuf *buf, *ret;
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
910
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
911 if (!(blist_options & OPT_BLIST_SHOW_ICONS))
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
912 return NULL;
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
913
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
914 if ((file = gaim_buddy_get_setting(b, "buddy_icon")) == NULL)
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
915 return NULL;
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
916
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
917 buf = gdk_pixbuf_new_from_file(file, NULL);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
918 g_free(file);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
919
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
920
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
921 if (buf) {
4930
d090282c42f7 [gaim-migrate @ 5264]
Nathan Walp <nwalp@pidgin.im>
parents: 4929
diff changeset
922 if (!b->present)
4928
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
923 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
924 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
925 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
36c06909823e [gaim-migrate @ 5262]
Nathan Walp <nwalp@pidgin.im>
parents: 4925
diff changeset
926
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
927 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
928 g_object_unref(G_OBJECT(buf));
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
929 return ret;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
930 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
931 return NULL;
2986
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
932 }
1c6a3516e1ff [gaim-migrate @ 2999]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
933
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
934 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
935 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
936 char *name = gaim_get_buddy_alias(b);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
937 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
938 struct prpl* prpl = find_prpl(b->account->protocol);
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
939
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
940 /* XXX Clean up this crap */
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
941
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
942 int ihrs, imin;
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
943 char *idletime = NULL, *warning = NULL, *statustext = NULL;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
944 time_t t;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
945
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
946 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) {
4929
8a20332821b6 [gaim-migrate @ 5263]
Sean Egan <seanegan@gmail.com>
parents: 4928
diff changeset
947 if ((b->idle > 0 && blist_options & OPT_BLIST_GREY_IDLERS && !selected) || blist_options & OPT_BLIST_SHOW_OFFLINE) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
948 text = g_strdup_printf("<span color='dim grey'>%s</span>",
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
949 esc);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
950 g_free(esc);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
951 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
952 } else {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
953 return esc;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
954 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
955 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
956
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
957 time(&t);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
958 ihrs = (t - b->idle) / 3600;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
959 imin = ((t - b->idle) / 60) % 60;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
960
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
961 if (prpl && prpl->status_text) {
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
962 char *tmp = prpl->status_text(b);
4815
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
963 const char *end;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
964
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
965 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
966 char *new = g_strndup(tmp,
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
967 g_utf8_pointer_to_offset(tmp, end));
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
968 g_free(tmp);
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
969 tmp = new;
3efe860c40c7 [gaim-migrate @ 5139]
Nathan Walp <nwalp@pidgin.im>
parents: 4813
diff changeset
970 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
971
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
972 if(tmp) {
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
973 char buf[32];
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
974 char *c = tmp;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
975 int length = 0, vis=0;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
976 gboolean inside = FALSE;
4806
315ef59a5031 [gaim-migrate @ 5126]
Nathan Walp <nwalp@pidgin.im>
parents: 4797
diff changeset
977 g_strdelimit(tmp, "\n", ' ');
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
978
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
979 while(*c && vis < 20) {
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
980 if(*c == '&')
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
981 inside = TRUE;
4856
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4855
diff changeset
982 else if(*c == ';')
ac9ed6c5594f [gaim-migrate @ 5183]
Nathan Walp <nwalp@pidgin.im>
parents: 4855
diff changeset
983 inside = FALSE;
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
984 if(!inside)
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
985 vis++;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
986 length++;
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
987 c++; /* this is fun */
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
988 }
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
989
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
990 if(vis == 20)
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
991 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
992 else
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
993 g_snprintf(buf, sizeof(buf), "%%s ");
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
994
4855
e4bfaba117e4 [gaim-migrate @ 5182]
Nathan Walp <nwalp@pidgin.im>
parents: 4852
diff changeset
995 statustext = g_strdup_printf(buf, tmp);
4852
d1c17e81055e [gaim-migrate @ 5179]
Christian Hammond <chipx86@chipx86.com>
parents: 4847
diff changeset
996
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
997 g_free(tmp);
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
998 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
999 }
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4730
diff changeset
1000
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1001 if (b->idle) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1002 if (ihrs)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1003 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1004 else
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1005 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1006 }
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1007
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1008 if (b->evil > 0)
4757
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1009 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
c4ebe1a8484b [gaim-migrate @ 5074]
Nathan Walp <nwalp@pidgin.im>
parents: 4755
diff changeset
1010
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1011 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS && !selected) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1012 text = g_strdup_printf("<span color='dim grey'>%s</span>\n"
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1013 "<span color='dim grey' size='smaller'>%s%s%s%s</span>",
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1014 esc,
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1015 statustext != NULL ? statustext : "",
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1016 idletime != NULL ? idletime : "",
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1017 warning != NULL ? warning : "",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1018 !b->present ? _("Offline ") : "");
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1019 } else if (statustext == NULL && idletime == NULL && warning == NULL && b->present) {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1020 text = g_strdup(esc);
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
1021 } else {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1022 text = g_strdup_printf("%s\n"
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1023 "<span %s size='smaller'>%s%s%s%s</span>", esc,
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1024 selected ? "" : "color='dim grey'",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1025 statustext != NULL ? statustext : "",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1026 idletime != NULL ? idletime : "",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1027 warning != NULL ? warning : "",
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1028 !b->present ? _("Offline ") : "");
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
1029 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1030 if (idletime)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1031 g_free(idletime);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1032 if (warning)
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1033 g_free(warning);
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1034 if (statustext)
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4721
diff changeset
1035 g_free(statustext);
4737
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1036 if (esc)
da3c96faa167 [gaim-migrate @ 5052]
Nathan Walp <nwalp@pidgin.im>
parents: 4733
diff changeset
1037 g_free(esc);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1038
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1039 return text;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1040 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1041
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1042 static void gaim_gtk_blist_restore_position()
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1043 {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1044 /* 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
1045 if(gtkblist && gtkblist->window &&
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1046 !GTK_WIDGET_VISIBLE(gtkblist->window) &&
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1047 blist_options & OPT_BLIST_SAVED_WINDOWS &&
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1048 blist_pos.width != 0) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1049 /* ...check position is on screen... */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1050 if (blist_pos.x >= gdk_screen_width())
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1051 blist_pos.x = gdk_screen_width() - 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1052 else if (blist_pos.x < 0)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1053 blist_pos.x = 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1054
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1055 if (blist_pos.y >= gdk_screen_height())
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1056 blist_pos.y = gdk_screen_height() - 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1057 else if (blist_pos.y < 0)
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1058 blist_pos.y = 100;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1059
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1060 /* ...and move it back. */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1061 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
1062 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
1063 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1064 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1065
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1066 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
1067 {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1068 GaimBlistNode *group = list->root;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1069 GaimBlistNode *buddy;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1070
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1071 while (group) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1072 buddy = group->child;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1073 while (buddy) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1074 if (((struct buddy *)buddy)->idle)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1075 gaim_gtk_blist_update(list, buddy);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1076 buddy = buddy->next;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1077 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1078 group = group->next;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1079 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1080
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1081 /* keep on going */
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1082 return TRUE;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1083 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1084
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1085 /**********************************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1086 * Public API Functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1087 **********************************************************************************/
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1088 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
1089 {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1090 blist->ui_data = g_new0(struct gaim_gtk_buddy_list, 1);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1091 }
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1092
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1093 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1094 {
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1095 node->ui_data = g_new0(struct gaim_gtk_blist_node, 1);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1096 }
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1097
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1098 void gaim_gtk_blist_update_columns()
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1099 {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1100 if (blist_options & OPT_BLIST_SHOW_ICONS) {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1101 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1102 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1103 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1104 } else {
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1105 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
1106 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
1107 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1108 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1109 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1110
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1111 enum {DRAG_BUDDY, DRAG_ROW};
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1112
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1113 static char *
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1114 item_factory_translate_func (const char *path, gpointer func_data)
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1115 {
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1116 return _(path);
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1117 }
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1118
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1119 static void gaim_gtk_blist_show(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1120 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1121 GtkItemFactory *ift;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1122 GtkCellRenderer *rend;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1123 GtkTreeViewColumn *column;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1124 GtkWidget *sw;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1125 GtkWidget *button;
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1126 GtkSizeGroup *sg;
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1127 GtkTreeSelection *selection;
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1128 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
1129 {"application/x-im-contact", 0, DRAG_BUDDY}};
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1130
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1131 if (gtkblist && gtkblist->window) {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1132 gtk_widget_show(gtkblist->window);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1133 return;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1134 }
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1135
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1136 gtkblist = GAIM_GTK_BLIST(list);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1137
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1138 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1139 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
4947
24c9a23df63b [gaim-migrate @ 5281]
Sean Egan <seanegan@gmail.com>
parents: 4945
diff changeset
1140 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Biatches List"));
4879
4f5bd9a2da37 [gaim-migrate @ 5209]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4867
diff changeset
1141 gtk_widget_realize(gtkblist->window);
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1142
4925
d947652a0b74 [gaim-migrate @ 5259]
Mark Doliner <mark@kingant.net>
parents: 4921
diff changeset
1143 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1144 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1145
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1146 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
1147 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
1148 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
1149 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1150
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1151 /******************************* Menu bar *************************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1152 ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", NULL);
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1153 gtk_item_factory_set_translate_func (ift,
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1154 item_factory_translate_func,
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1155 NULL, NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1156 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
1157 blist_menu, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1158 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
1159
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1160 awaymenu = gtk_item_factory_get_widget(ift, N_("/Tools/Away"));
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1161 do_away_menu();
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1162
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1163 bpmenu = gtk_item_factory_get_widget(ift, N_("/Tools/Buddy Pounce"));
4696
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1164 do_bp_menu();
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1165
4834
0ed37c803503 [gaim-migrate @ 5159]
Luke Schierer <lschiere@pidgin.im>
parents: 4833
diff changeset
1166 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
1167 do_proto_menu();
abec345c8c92 [gaim-migrate @ 5007]
Nathan Walp <nwalp@pidgin.im>
parents: 4695
diff changeset
1168
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1169 /****************************** GtkTreeView **********************************/
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1170 sw = gtk_scrolled_window_new(NULL,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1171 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
1172 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
1173
4847
bce4d8f7dbf0 [gaim-migrate @ 5172]
Nathan Walp <nwalp@pidgin.im>
parents: 4846
diff changeset
1174 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1175 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
1176
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1177 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
1178 gtk_widget_set_size_request(gtkblist->treeview, -1, 200);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1179
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1180 /* Set up selection stuff */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1181
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1182 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1183 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
1184
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1185
4702
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1186 /* Set up dnd */
cb5b23dfd82b [gaim-migrate @ 5013]
Sean Egan <seanegan@gmail.com>
parents: 4701
diff changeset
1187 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
1188 2, GDK_ACTION_COPY);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1189 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
1190 GDK_ACTION_COPY | GDK_ACTION_MOVE);
4704
56c70997fe5c [gaim-migrate @ 5015]
Nathan Walp <nwalp@pidgin.im>
parents: 4702
diff changeset
1191 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
1192 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
1193
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1194 /* Tooltips */
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1195 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
1196 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
1197
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1198 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
1199
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1200 rend = gtk_cell_renderer_pixbuf_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1201 column = gtk_tree_view_column_new_with_attributes("Status", rend, "pixbuf", STATUS_ICON_COLUMN, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1202 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
4933
34448ffab4f1 [gaim-migrate @ 5267]
Luke Schierer <lschiere@pidgin.im>
parents: 4930
diff changeset
1203 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
1204
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1205 rend = gtk_cell_renderer_text_new();
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1206 column = gtk_tree_view_column_new_with_attributes("Name", rend, "markup", NAME_COLUMN, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1207 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
4797
9561a1104131 [gaim-migrate @ 5117]
Rob Flynn <gaim@robflynn.com>
parents: 4796
diff changeset
1208 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
4706
ca87e6492319 [gaim-migrate @ 5017]
Sean Egan <seanegan@gmail.com>
parents: 4704
diff changeset
1209
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1210 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1211 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
1212 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
1213 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1214
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1215 rend = gtk_cell_renderer_text_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1216 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
1217 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
1218 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1219
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1220 rend = gtk_cell_renderer_pixbuf_new();
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1221 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
1222 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1223 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
1224
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1225 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1226 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
1227
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1228 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
1229 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1230 gaim_gtk_blist_update_columns();
4934
04ca72a25f75 [gaim-migrate @ 5268]
Luke Schierer <lschiere@pidgin.im>
parents: 4933
diff changeset
1231
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1232 /* set the Show Offline Buddies option. must be done
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1233 * after the treeview or faceprint gets mad. -Robot101
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1234 */
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1235 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (ift, N_("/Edit/Show Offline Buddies"))),
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1236 blist_options & OPT_BLIST_SHOW_OFFLINE);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1237
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1238 /* OK... let's show this bad boy. */
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1239 gaim_gtk_blist_refresh(list);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1240 gaim_gtk_blist_restore_position();
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1241 gtk_widget_show_all(gtkblist->window);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1242
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1243 /**************************** Button Box **************************************/
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1244 /* 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
1245
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1246 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1247 gtkblist->bbox = gtk_hbox_new(TRUE, 0);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1248 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
1249 gtk_widget_show(gtkblist->bbox);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1250
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1251 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
1252 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
1253 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1254 gtk_size_group_add_widget(sg, button);
4692
a81443d3516b [gaim-migrate @ 5003]
Sean Egan <seanegan@gmail.com>
parents: 4691
diff changeset
1255 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
1256 gtkblist->treeview);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1257 gtk_widget_show(button);
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1258
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1259 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
1260 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
1261 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1262 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1263 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
1264 gtkblist->treeview);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1265 gtk_widget_show(button);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4725
diff changeset
1266
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1267 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
1268 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
1269 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1270 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1271 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_chat_cb), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1272 gtk_widget_show(button);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1273
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1274 button = gaim_pixbuf_button_from_stock(_("Away"), GAIM_STOCK_AWAY, GAIM_BUTTON_VERTICAL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1275 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
1276 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
4694
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1277 gtk_size_group_add_widget(sg, button);
8f523dbb970e [gaim-migrate @ 5005]
Nathan Walp <nwalp@pidgin.im>
parents: 4692
diff changeset
1278 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_away_cb), NULL);
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1279 gtk_widget_show(button);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1280
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1281 /* this will show the right image/label widgets for us */
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1282 gaim_gtk_blist_update_toolbar();
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1283
4956
aa273fba7b09 [gaim-migrate @ 5290]
Sean Egan <seanegan@gmail.com>
parents: 4954
diff changeset
1284 /* start the refresh timer */
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1285 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
1286 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1287
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1288 void gaim_gtk_blist_refresh(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1289 {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1290 GaimBlistNode *group = list->root;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1291 GaimBlistNode *buddy;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1292
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1293 while (group) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1294 buddy = group->child;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1295 gaim_gtk_blist_update(list, group);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1296 while (buddy) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1297 gaim_gtk_blist_update(list, buddy);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1298 buddy = buddy->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1299 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1300 group = group->next;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1301 }
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1302 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1303
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1304 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
1305
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1306 do {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1307 GaimBlistNode *n;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1308 GtkTreeIter child;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1309
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1310 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
1311 if(n == node) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1312 *iter = *root;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1313 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1314 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1315
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1316 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
1317 if(get_iter_from_node_helper(node,iter,&child))
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1318 return TRUE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1319 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1320 } 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
1321
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1322 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1323 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1324
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1325 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1326 GtkTreeIter root;
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 if (!gtkblist)
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1329 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1330
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1331 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
1332 return FALSE;
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1333
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1334 return get_iter_from_node_helper(node, iter, &root);
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1335 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1336
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1337 /*
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1338 * 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
1339 * Roll on new prefs. -Robot101
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1340 *
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1341 * NO_BUTTON_TEXT && SHOW_BUTTON_XPM - image
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1342 * !NO_BUTTON_TEXT && !SHOW_BUTTON_XPM - text
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1343 * !NO_BUTTON_TEXT && SHOW_BUTTON_XPM - text & images
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1344 * NO_BUTTON_TEXT && !SHOW_BUTTON_XPM - none
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1345 */
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1346
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1347 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
1348 if (GTK_IS_IMAGE(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1349 if (blist_options & OPT_BLIST_SHOW_BUTTON_XPM)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1350 gtk_widget_show(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1351 else
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1352 gtk_widget_hide(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1353 } else if (GTK_IS_LABEL(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1354 if (blist_options & OPT_BLIST_NO_BUTTON_TEXT)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1355 gtk_widget_hide(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1356 else
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1357 gtk_widget_show(widget);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1358 } else if (GTK_IS_CONTAINER(widget)) {
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1359 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
1360 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1361 }
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1362
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1363 void gaim_gtk_blist_update_toolbar() {
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1364 if (!gtkblist)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1365 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1366
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1367 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
1368 gtk_widget_hide(gtkblist->bbox);
4944
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_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
1371 gtk_widget_show(gtkblist->bbox);
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1372 }
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1373 }
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1374
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1375 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
1376 {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1377 struct gaim_gtk_blist_node *gtknode;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1378 GtkTreeIter iter;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1379
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1380 if (!node->ui_data)
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1381 return;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1382
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1383 gtknode = (struct gaim_gtk_blist_node *)node->ui_data;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1384
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1385 if (gtknode->timer > 0) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1386 g_source_remove(gtknode->timer);
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1387 gtknode->timer = 0;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1388 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1389
4912
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1390 /* 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
1391 if(!gtkblist)
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1392 return;
a6e9cd5e853e [gaim-migrate @ 5246]
Luke Schierer <lschiere@pidgin.im>
parents: 4911
diff changeset
1393
4831
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1394 if(gtkblist->selected_node == node)
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1395 gtkblist->selected_node = NULL;
cd60c41e6e4a [gaim-migrate @ 5156]
Nathan Walp <nwalp@pidgin.im>
parents: 4815
diff changeset
1396
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1397 if (get_iter_from_node(node, &iter)) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1398 gtk_tree_store_remove(gtkblist->treemodel, &iter);
4918
553d96cb9b26 [gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents: 4916
diff changeset
1399 if(GAIM_BLIST_NODE_IS_BUDDY(node) &&
4954
decdf19454ab [gaim-migrate @ 5288]
Nathan Walp <nwalp@pidgin.im>
parents: 4947
diff changeset
1400 !(blist_options & OPT_BLIST_SHOW_OFFLINE) &&
4918
553d96cb9b26 [gaim-migrate @ 5252]
Christian Hammond <chipx86@chipx86.com>
parents: 4916
diff changeset
1401 gaim_blist_get_group_online_count((struct group *)node->parent) == 0) {
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1402 GtkTreeIter groupiter;
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1403 if(get_iter_from_node(node->parent, &groupiter))
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1404 gtk_tree_store_remove(gtkblist->treemodel, &groupiter);
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 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1407 }
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1408
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1409 static gboolean do_selection_changed(GaimBlistNode *new_selection)
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 GaimBlistNode *old_selection = gtkblist->selected_node;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1412
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1413 if(new_selection != gtkblist->selected_node) {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1414 gtkblist->selected_node = new_selection;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1415 if(new_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1416 gaim_gtk_blist_update(NULL, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1417 if(old_selection)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1418 gaim_gtk_blist_update(NULL, old_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1419 }
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 return FALSE;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1422 }
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 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1425 {
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1426 GaimBlistNode *new_selection = NULL;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1427 GtkTreeIter iter;
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1428
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1429 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1430 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1431 NODE_COLUMN, &new_selection, -1);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1432 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1433 /* we set this up as a timeout, otherwise the blist flickers */
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1434 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1435 }
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1436
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1437 static void make_a_group(GaimBlistNode *node, GtkTreeIter *iter) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1438 GaimBlistNode *sibling;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1439 GtkTreeIter siblingiter;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1440 GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1441 GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1442 char *esc = g_markup_escape_text(((struct group*)node)->name, -1);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1443 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1444 g_free(esc);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1445 sibling = node->prev;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1446 while (sibling && !get_iter_from_node(sibling, &siblingiter)) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1447 sibling = sibling->prev;
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1448 }
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1449
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1450 gtk_tree_store_insert_after(gtkblist->treemodel, iter, NULL,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1451 sibling ? &siblingiter : NULL);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1452 gtk_tree_store_set(gtkblist->treemodel, iter,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1453 STATUS_ICON_COLUMN, groupicon,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1454 NAME_COLUMN, mark,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1455 NODE_COLUMN, node,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1456 -1);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1457 g_free(mark);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1458 g_object_unref(groupicon);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1459 }
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1460
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1461
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1462 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
1463 {
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1464 struct gaim_gtk_blist_node *gtknode;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1465 GtkTreeIter iter;
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1466 GtkTreePath *expand = NULL;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1467 gboolean new_entry = FALSE;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1468
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1469 if (!gtkblist)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1470 return;
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1471
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1472 gtknode = GAIM_GTK_BLIST_NODE(node);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1473
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1474
4699
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)) {
4929
8a20332821b6 [gaim-migrate @ 5263]
Sean Egan <seanegan@gmail.com>
parents: 4928
diff changeset
1478 if (((struct buddy*)node)->present || (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;
4690
e19f91053ad0 [gaim-migrate @ 5001]
Nathan Walp <nwalp@pidgin.im>
parents: 4687
diff changeset
1482
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1483 if(node->parent &&
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1484 !get_iter_from_node(node->parent, &groupiter)) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1485 /* This buddy's group has not yet been added.
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1486 * We do that here */
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1487 make_a_group(node->parent, &groupiter);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1488 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter);
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1489 }
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1490
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1491 oldersibling = node->prev;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
1492 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter)) {
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1493 oldersibling = oldersibling->prev;
4867
6a0be79e9f71 [gaim-migrate @ 5197]
Nathan Walp <nwalp@pidgin.im>
parents: 4856
diff changeset
1494 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1495
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1496 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
1497
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1498 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1499 gtk_window_present(GTK_WINDOW(gtkblist->window));
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1500
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1501 }
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1502 }
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1503 else if (GAIM_BLIST_NODE_IS_GROUP(node) && (blist_options & OPT_BLIST_SHOW_OFFLINE)) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1504 make_a_group(node, &iter);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1505 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
1506 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1507 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1508 if ((gaim_blist_get_group_online_count((struct group *)node) == 0) ||
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1509 (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter) && !(blist_options & OPT_BLIST_SHOW_OFFLINE))) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1510 gtk_tree_store_remove(gtkblist->treemodel, &iter);
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1511 } else {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1512 char *esc = g_markup_escape_text(((struct group*)node)->name, -1);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1513 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1514 g_free(esc);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1515 gtk_tree_store_set(gtkblist->treemodel, &iter,
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1516 NAME_COLUMN, mark,
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1517 -1);
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1518 g_free(mark);
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1519 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1520 }
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1521
4929
8a20332821b6 [gaim-migrate @ 5263]
Sean Egan <seanegan@gmail.com>
parents: 4928
diff changeset
1522 if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present || (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
1523 GdkPixbuf *status, *avatar;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1524 char *mark;
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1525 char *warning = NULL, *idle = NULL;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1526
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1527 gboolean selected = (gtkblist->selected_node == node);
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1528
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1529 status = gaim_gtk_blist_get_status_icon((struct buddy*)node,
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
1530 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
1531 avatar = gaim_gtk_blist_get_buddy_icon((struct buddy*)node);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1532 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
1533
4725
fd44726a527f [gaim-migrate @ 5038]
Sean Egan <seanegan@gmail.com>
parents: 4724
diff changeset
1534 if (((struct buddy*)node)->idle > 0) {
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1535 time_t t;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1536 int ihrs, imin;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1537 time(&t);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1538 ihrs = (t - ((struct buddy *)node)->idle) / 3600;
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1539 imin = ((t - ((struct buddy*)node)->idle) / 60) % 60;
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1540 if(ihrs > 0)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1541 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1542 else
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1543 idle = g_strdup_printf("(%d)", imin);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1544 }
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)->evil > 0)
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1547 warning = g_strdup_printf("%d%%", ((struct buddy*)node)->evil);
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1548
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1549
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1550 if((blist_options & OPT_BLIST_GREY_IDLERS)
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1551 && ((struct buddy *)node)->idle) {
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1552 if(warning && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1553 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1554 warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1555 g_free(warning);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1556 warning = w2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1557 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1558
4810
0abbbeec0ee8 [gaim-migrate @ 5130]
Nathan Walp <nwalp@pidgin.im>
parents: 4806
diff changeset
1559 if(idle && !selected) {
4718
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1560 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1561 idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1562 g_free(idle);
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1563 idle = i2;
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1564 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1565 }
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1566
8ecc83cad126 [gaim-migrate @ 5030]
Nathan Walp <nwalp@pidgin.im>
parents: 4716
diff changeset
1567
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1568 gtk_tree_store_set(gtkblist->treemodel, &iter,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1569 STATUS_ICON_COLUMN, status,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1570 NAME_COLUMN, mark,
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1571 WARNING_COLUMN, warning,
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1572 IDLE_COLUMN, idle,
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1573 BUDDY_ICON_COLUMN, avatar,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1574 NODE_COLUMN, node,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1575 -1);
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1576
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1577 g_free(mark);
4697
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1578 if (idle)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1579 g_free(idle);
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1580 if (warning)
4be12ff42986 [gaim-migrate @ 5008]
Sean Egan <seanegan@gmail.com>
parents: 4696
diff changeset
1581 g_free(warning);
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1582
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1583 if (status != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1584 g_object_unref(status);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1585
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1586 if (avatar != NULL)
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1587 g_object_unref(avatar);
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1588
4701
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1589 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && !new_entry) {
ac7ca2bd6d4f [gaim-migrate @ 5012]
Nathan Walp <nwalp@pidgin.im>
parents: 4699
diff changeset
1590 gaim_gtk_blist_remove(list, node);
4767
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1591 if (blist_options & OPT_BLIST_POPUP)
f6d83e81d45a [gaim-migrate @ 5085]
Sean Egan <seanegan@gmail.com>
parents: 4758
diff changeset
1592 gtk_window_present(GTK_WINDOW(gtkblist->window));
4781
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1593 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1594 GaimBlistNode *afsad = node->child;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1595 while (afsad) {
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1596 gaim_gtk_blist_update(list, afsad);
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1597 afsad = afsad->next;
b6f33ba0a0c0 [gaim-migrate @ 5101]
Sean Egan <seanegan@gmail.com>
parents: 4777
diff changeset
1598 }
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1599
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4912
diff changeset
1600 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1601 }
4936
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1602
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1603 if(expand) {
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1604 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
1605 gtk_tree_path_free(expand);
cfeab08d4be9 [gaim-migrate @ 5270]
Nathan Walp <nwalp@pidgin.im>
parents: 4935
diff changeset
1606 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1607 }
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2334
diff changeset
1608
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1609 static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list)
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1610 {
4770
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1611 if (!gtkblist)
c4c28874ecd3 [gaim-migrate @ 5088]
Sean Egan <seanegan@gmail.com>
parents: 4767
diff changeset
1612 return;
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1613
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1614 gtk_widget_destroy(gtkblist->window);
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1615
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1616 if (gtkblist->refresh_timer)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1617 g_source_remove(gtkblist->refresh_timer);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1618 if (gtkblist->timeout)
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1619 g_source_remove(gtkblist->timeout);
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1620
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1621 gtkblist->refresh_timer = 0;
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1622 gtkblist->timeout = 0;
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1623 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1624 gtkblist->treemodel = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1625 gtkblist->idle_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1626 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1627 gtkblist->bbox = gtkblist->tipwindow = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1628 protomenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1629 awaymenu = NULL;
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4744
diff changeset
1630 bpmenu = NULL;
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1631 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1632
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1633 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
1634 {
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1635 if (!(gtkblist && gtkblist->window))
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1636 return;
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1637
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1638 if (show) {
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1639 gaim_gtk_blist_restore_position();
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1640 gtk_window_present(GTK_WINDOW(gtkblist->window));
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1641 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1642 if (!connections || docklet_count) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1643 #ifdef _WIN32
4711
0c1f3e651d3e [gaim-migrate @ 5022]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4706
diff changeset
1644 wgaim_systray_minimize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1645 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1646 gtk_widget_hide(gtkblist->window);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1647 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1648 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1649 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1650 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1651 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1652
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1653 void gaim_gtk_blist_docklet_toggle() {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1654 /* 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
1655 /* 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
1656 buddy list/login window--depending on which is active */
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1657 if (connections) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1658 if (gtkblist && gtkblist->window) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1659 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1660 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
1661 } else {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1662 #if _WIN32
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1663 wgaim_systray_maximize(gtkblist->window);
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1664 #endif
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1665 gaim_blist_set_visible(TRUE);
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1666 }
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1667 } else {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1668 /* we're logging in or something... do nothing */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1669 /* or should I make the blist? */
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1670 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
1671 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1672 } else if (mainwindow) {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1673 if (GTK_WIDGET_VISIBLE(mainwindow)) {
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1674 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1675 gtk_window_present(GTK_WINDOW(mainwindow));
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1676 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1677 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1678 wgaim_systray_minimize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1679 #endif
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1680 gtk_widget_hide(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1681 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1682 } else {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1683 #if _WIN32
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1684 wgaim_systray_maximize(mainwindow);
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1685 #endif
4833
a6960b4b0c9b [gaim-migrate @ 5158]
Mark Doliner <mark@kingant.net>
parents: 4831
diff changeset
1686 show_login();
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1687 }
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1688 } else {
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1689 show_login();
4698
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 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1692
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1693 void gaim_gtk_blist_docklet_add()
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1694 {
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1695 docklet_count++;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1696 }
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1697
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1698 void gaim_gtk_blist_docklet_remove()
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 docklet_count--;
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1701 if (!docklet_count) {
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1702 if (connections)
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1703 gaim_blist_set_visible(TRUE);
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1704 else if (mainwindow)
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1705 gtk_window_present(GTK_WINDOW(mainwindow));
4944
5fe846b7603f [gaim-migrate @ 5278]
Sean Egan <seanegan@gmail.com>
parents: 4943
diff changeset
1706 else
4840
a701ef925850 [gaim-migrate @ 5165]
Mark Doliner <mark@kingant.net>
parents: 4837
diff changeset
1707 show_login();
4698
aa2ceea841b4 [gaim-migrate @ 5009]
Sean Egan <seanegan@gmail.com>
parents: 4697
diff changeset
1708 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1709 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1710
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1711 static struct gaim_blist_ui_ops blist_ui_ops =
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1712 {
4695
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1713 gaim_gtk_blist_new_list,
4bdd9a5fd026 [gaim-migrate @ 5006]
Christian Hammond <chipx86@chipx86.com>
parents: 4694
diff changeset
1714 gaim_gtk_blist_new_node,
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1715 gaim_gtk_blist_show,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1716 gaim_gtk_blist_update,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1717 gaim_gtk_blist_remove,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1718 gaim_gtk_blist_destroy,
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1719 gaim_gtk_blist_set_visible
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1720 };
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1721
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1722
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1723 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
1724 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1725 return &blist_ui_ops;
1037
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1726 }
1c663beef29d [gaim-migrate @ 1047]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1036
diff changeset
1727
3131
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1728
bb7527b5f426 [gaim-migrate @ 3146]
Rob Flynn <gaim@robflynn.com>
parents: 3111
diff changeset
1729
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1730 /*********************************************************************
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1731 * Public utility functions *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1732 *********************************************************************/
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
1733
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1734 GdkPixbuf *
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1735 create_prpl_icon(struct gaim_account *account)
4553
d03fcb3f4be2 [gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents: 4525
diff changeset
1736 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1737 struct prpl *prpl = find_prpl(account->protocol);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1738 GdkPixbuf *status = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1739 char *filename = NULL;
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1740 const char *protoname = prpl->list_icon(account, NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1741 /* "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
1742 then it will look up protoname from the theme */
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1743 if (!strcmp(protoname, "aim")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1744 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
1745 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1746 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1747 } else if (!strcmp(protoname, "yahoo")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1748 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
1749 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1750 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1751 } else if (!strcmp(protoname, "msn")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1752 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
1753 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1754 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1755 } else if (!strcmp(protoname, "jabber")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1756 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
1757 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1758 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1759 } else if (!strcmp(protoname, "icq")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1760 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
1761 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1762 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1763 } else if (!strcmp(protoname, "gadu-gadu")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1764 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "gadugadu.png", NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1765 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1766 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1767 } else if (!strcmp(protoname, "napster")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1768 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
1769 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1770 g_free(filename);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1771 } else if (!strcmp(protoname, "irc")) {
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1772 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
1773 status = gdk_pixbuf_new_from_file(filename,NULL);
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1774 g_free(filename);
960
fa681641643d [gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 945
diff changeset
1775 }
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4635
diff changeset
1776 return status;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1777 }
4699
2222cd30008a [gaim-migrate @ 5010]
Nathan Walp <nwalp@pidgin.im>
parents: 4698
diff changeset
1778