annotate src/buddy.c @ 5103:bfcf72c5a930

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