annotate src/gtkblist.c @ 8061:ea073d234191

[gaim-migrate @ 8749] <b><i><u>what you see is what you get</u></i></b> committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 10 Jan 2004 06:06:02 +0000
parents fa6395637e2c
children 08d993c1d843
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * gaim
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
6 * source distribution.
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * (at your option) any later version.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * GNU General Public License for more details.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
23 #include "gtkinternal.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
24
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
25 #include "account.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
26 #include "core.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
27 #include "debug.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
28 #include "multi.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
29 #include "notify.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
30 #include "prpl.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
31 #include "prefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
32 #include "request.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
33 #include "signals.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
34 #include "sound.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
35 #include "stock.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
36 #include "util.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
37
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
38 #include "gtkaccount.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
39 #include "gtkblist.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
40 #include "gtkconv.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
41 #include "gtkdebug.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
42 #include "gtkft.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
43 #include "gtklog.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
44 #include "gtkpounce.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
45 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
46 #include "gtkprivacy.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
47 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
48
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
49 #include "ui.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
50
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
51 #include "gaim.h"
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
55 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
56
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
57 #if (GTK_CHECK_VERSION(2,2,0) && !(defined(__APPLE__) && defined(__MACH__)))
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
58 #define WANT_DROP_SHADOW
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
59 #endif
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
60
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
61 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
62 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
63 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
64
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
65 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
66 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
67 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
68 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
69 GtkWidget *account_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
70
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71 } GaimGtkAddBuddyData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
72
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
73 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
74 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
75 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
76
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
77 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
78 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
79 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82 GtkSizeGroup *sg;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84 GList *entries;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
85
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
86 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
87
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
88
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
89 static GtkWidget *protomenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
91 GSList *gaim_gtk_blist_sort_methods = NULL;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
92 static struct gaim_gtk_blist_sort_method *current_sort_method = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
93 static GtkTreeIter sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
94
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
95 /* The functions we use for sorting aren't available in gtk 2.0.x, and
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
96 * segfault in 2.2.0. 2.2.1 is known to work, so I'll require that */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
97 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
98 static GtkTreeIter sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
99 static GtkTreeIter sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
100 static GtkTreeIter sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
101 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
102 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 /* part of the best damn Docklet code this side of Tahiti */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105 static gboolean gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
108 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
109 static char *gaim_get_tooltip_text(GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 static char *item_factory_translate_func (const char *path, gpointer func_data);
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
111 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
112 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
113 static void gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
114
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
115 static void show_rename_group(GtkWidget *unused, GaimGroup *g);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
116
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
117 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
118 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
119 gboolean contact_expanded;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
120 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
121
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
122 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
123 /**************************** Weird drop shadow stuff *******************/
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
124 /* This is based on a patch for drop shadows in GTK menus available at http://www.xfce.org/gtkmenu-shadow/ */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
125
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
126 enum side {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
127 EAST_SIDE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
128 SOUTH_SIDE
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
129 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
130
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
131 const double shadow_strip_l[5] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
132 .937, .831, .670, .478, .180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
133 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
134
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
135 const double bottom_left_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
136 1.00, .682, .423, .333, .258,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
137 1.00, .898, .800, .682, .584,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
138 1.00, .937, .874, .800, .737,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
139 1.00, .968, .937, .898, .866,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
140 1.00, .988, .976, .960, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
141 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
142
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
143 const double bottom_right_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
144 .258, .584, .737, .866, .945,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
145 .584, .682, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
146 .737, .800, .874, .937, .976,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
147 .866, .898, .937, .968, .988,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
148 .945, .960, .976, .988, .996
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
149 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
150
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
151 const double top_right_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
152 1.00, 1.00, 1.00, 1.00, 1.00,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
153 .686, .898, .937, .968, .988,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
154 .423, .803, .874, .937, .976,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
155 .333, .686, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
156 .258, .584, .737, .866, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
157 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
158
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
159 const double top_left_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
160 .988, .968, .937, .898, .498,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
161 .976, .937, .874, .803, .423,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
162 .960, .898, .800, .686, .333,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
163 .945, .866, .737, .584, .258,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
164 .941, .847, .698, .521, .215
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
165 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
166
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
167
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
168 static GdkPixbuf *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
169 get_pixbuf (GtkWidget *menu,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
170 int x,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
171 int y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
172 int width,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
173 int height)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
174 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
175 GdkPixbuf *dest, *src;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
176 GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET(menu));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
177 GdkWindow *root = gdk_screen_get_root_window (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
178 gint screen_height = gdk_screen_get_height (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
179 gint screen_width = gdk_screen_get_width (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
180 gint original_width = width;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
181 gint original_height = height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
182
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
183 #ifdef _WIN32
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
184 /* In Win32, GDK gets the workarea that isn't occupied by toolbars
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
185 (including the taskbar) and uses that region as the screen size.
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
186 GTK returns positions based on a screen size that ignores these
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
187 toolbars. Since we want a pixmap with real X,Y coordinates, we
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
188 need to find out the offset from GTK's screen to GDK's screen,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
189 and adjust the pixmaps we grab accordingly. GDK will not deal
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
190 with toolbar position updates, so we're stuck restarting Gaim
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
191 if that happens. */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
192 RECT *workarea = g_malloc(sizeof(RECT));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
193 SystemParametersInfo(SPI_GETWORKAREA, 0, (void *)workarea, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
194 x += (workarea->left);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
195 y += (workarea->top);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
196 g_free(workarea);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
197 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
198
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
199 if (x < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
200 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
201 width += x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
202 x = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
203 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
204
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
205 if (y < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
206 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
207 height += y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
208 y = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
209 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
210
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
211 if (x + width > screen_width)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
212 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
213 width = screen_width - x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
214 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
215
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
216 if (y + height > screen_height)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
217 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
218 height = screen_height - y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
219 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
220
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
221 if (width <= 0 || height <= 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
222 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
223
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
224 dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
225 original_width, original_height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
226 src = gdk_pixbuf_get_from_drawable (NULL, root, NULL, x, y, 0, 0,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
227 width, height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
228 gdk_pixbuf_copy_area (src, 0, 0, width, height, dest, 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
229
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
230 g_object_unref (G_OBJECT (src));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
231
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
232 return dest;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
233 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
234
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
235 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
236 shadow_paint(GaimGtkBuddyList *blist, GdkRectangle *area, enum side shadow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
237 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
238 gint width, height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
239 GdkGC *gc = gtkblist->tipwindow->style->black_gc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
240
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
241 switch (shadow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
242 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
243 case EAST_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
244 if (gtkblist->east != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
245 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
246 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
247 gdk_gc_set_clip_rectangle (gc, area);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
248
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
249 width = gdk_pixbuf_get_width (gtkblist->east);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
250 height = gdk_pixbuf_get_height (gtkblist->east);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
251
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
252 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->east_shadow), gc,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
253 gtkblist->east, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
254 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
255
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
256 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
257 gdk_gc_set_clip_rectangle (gc, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
258 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
259 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
260 case SOUTH_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
261 if (blist->south != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
262 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
263 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
264 gdk_gc_set_clip_rectangle (gc, area);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
265
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
266 width = gdk_pixbuf_get_width (gtkblist->south);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
267 height = gdk_pixbuf_get_height (gtkblist->south);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
268 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->south_shadow), gc, gtkblist->south,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
269 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
8040
7c252b4bfbda [gaim-migrate @ 8724]
Nathan Walp <nwalp@pidgin.im>
parents: 8022
diff changeset
270
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
271 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
272 gdk_gc_set_clip_rectangle (gc, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
273 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
274 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
275 default:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
276 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
277 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
278 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
279
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
280 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
281 pixbuf_add_shadow (GdkPixbuf *pb,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
282 enum side shadow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
283 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
284 gint width, rowstride, height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
285 gint i;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
286 guchar *pixels, *p;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
287
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
288 width = gdk_pixbuf_get_width (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
289 height = gdk_pixbuf_get_height (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
290 rowstride = gdk_pixbuf_get_rowstride (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
291 pixels = gdk_pixbuf_get_pixels (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
292
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
293 switch (shadow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
294 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
295 case EAST_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
296 if (height > 5)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
297 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
298 for (i = 0; i < width; i++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
299 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
300 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
301
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
302 p = pixels + (i * rowstride);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
303 for (j = 0, k = 0; j < 3 * width; j += 3, k++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
304 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
305 p[j] = (guchar) (p[j] * top_right_corner [i * width + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
306 p[j + 1] = (guchar) (p[j + 1] * top_right_corner [i * width + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
307 p[j + 2] = (guchar) (p[j + 2] * top_right_corner [i * width + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
308 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
309 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
310
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
311 i = 5;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
312 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
313 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
314 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
315 i = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
316 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
317
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
318 for (;i < height; i++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
319 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
320 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
321
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
322 p = pixels + (i * rowstride);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
323 for (j = 0, k = 0; j < 3 * width; j += 3, k++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
324 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
325 p[j] = (guchar) (p[j] * shadow_strip_l[width - 1 - k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
326 p[j + 1] = (guchar) (p[j + 1] * shadow_strip_l[width - 1 - k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
327 p[j + 2] = (guchar) (p[j + 2] * shadow_strip_l[width - 1 - k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
328 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
329 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
330 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
331
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
332 case SOUTH_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
333 for (i = 0; i < height; i++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
334 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
335 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
336
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
337 p = pixels + (i * rowstride);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
338 for (j = 0, k = 0; j < 3 * height; j += 3, k++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
339 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
340 p[j] = (guchar) (p[j] * bottom_left_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
341 p[j + 1] = (guchar) (p[j + 1] * bottom_left_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
342 p[j + 2] = (guchar) (p[j + 2] * bottom_left_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
343 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
344
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
345 p = pixels + (i * rowstride) + 3 * height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
346 for (j = 0, k = 0; j < (width * 3) - (6 * height); j += 3, k++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
347 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
348 p[j] = (guchar) (p[j] * bottom_right_corner [i * height]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
349 p[j + 1] = (guchar) (p[j + 1] * bottom_right_corner [i * height]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
350 p[j + 2] = (guchar) (p[j + 2] * bottom_right_corner [i * height]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
351 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
352
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
353 p = pixels + (i * rowstride) + ((width * 3) - (3 * height));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
354 for (j = 0, k = 0; j < 3 * height; j += 3, k++)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
355 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
356 p[j] = (guchar) (p[j] * bottom_right_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
357 p[j + 1] = (guchar) (p[j + 1] * bottom_right_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
358 p[j + 2] = (guchar) (p[j + 2] * bottom_right_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
359 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
360 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
361 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
362
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
363 default:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
364 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
365 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
366 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
367
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
368 static gboolean
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
369 map_shadow_windows (gpointer data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
370 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
371 GaimGtkBuddyList *blist = (GaimGtkBuddyList*)data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
372 GtkWidget *widget = blist->tipwindow;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
373 GdkPixbuf *pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
374 int x, y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
375
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
376 gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
377 pixbuf = get_pixbuf (widget,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
378 x + widget->allocation.width, y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
379 5, widget->allocation.height + 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
380 if (pixbuf != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
381 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
382 pixbuf_add_shadow (pixbuf, EAST_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
383 if (blist->east != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
384 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
385 g_object_unref (G_OBJECT (blist->east));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
386 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
387 blist->east = pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
388 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
389
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
390 pixbuf = get_pixbuf (widget,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
391 x, y + widget->allocation.height,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
392 widget->allocation.width + 5, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
393 if (pixbuf != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
394 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
395 pixbuf_add_shadow (pixbuf, SOUTH_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
396 if (blist->south != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
397 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
398 g_object_unref (G_OBJECT (blist->south));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
399 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
400 blist->south = pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
401 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
402
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
403 gdk_window_move_resize (blist->east_shadow,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
404 x + widget->allocation.width, y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
405 5, widget->allocation.height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
406
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
407 gdk_window_move_resize (blist->south_shadow,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
408 x, y + widget->allocation.height,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
409 widget->allocation.width + 5, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
410 gdk_window_show (blist->east_shadow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
411 gdk_window_show (blist->south_shadow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
412 shadow_paint(blist, NULL, EAST_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
413 shadow_paint(blist, NULL, SOUTH_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
414
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
415 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
416 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
417
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
418 /**************** END WEIRD DROP SHADOW STUFF ***********************************/
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
419 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
420 static GSList *blist_prefs_callbacks = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
421
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
422 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
423 * Callbacks *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
424 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
425
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
426 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
427 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
428 if (docklet_count)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
429 gaim_blist_set_visible(FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
430 else
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
431 gaim_core_quit();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
432
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
433 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
434 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
437 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
438 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
439 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 * the only way we have of setting the position doesn't. we have to *
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
441 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
442 * this is inefficient and I agree it sucks, but it's more likely *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
443 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 gint x, y;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
448 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
450 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
451 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
452
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
453 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
454 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
455 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
456 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
457 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
458
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
459 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
462 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
463 if (x + event->width < 0 ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
464 y + event->height < 0 ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
465 x > gdk_screen_width() ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
466 y > gdk_screen_height()) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
467
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
468 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
469 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
470
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
471 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
472 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
473 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
474 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
475 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
476
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
478 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
481 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
482 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
483 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
484 gaim_gtk_blist_obscured = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
485 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
486 gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
487
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
488 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
490 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
491
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
492 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
495 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
497 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
499 GaimConversation *conv = gaim_conversation_new(GAIM_CONV_IM, b->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
500 b->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
501
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
502 if(conv) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
503 GaimConvWindow *win = gaim_conversation_get_window(conv);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
504
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
505 gaim_conv_window_raise(win);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
506 gaim_conv_window_switch_conversation(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
507 gaim_conversation_get_window(conv),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
508 gaim_conversation_get_index(conv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
509
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
510 if (GAIM_IS_GTK_WINDOW(win))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
511 gtk_window_present(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
512 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
515 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
516 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
517 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
518 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
519
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
520 gaim_blist_save();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
521 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
522
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
523 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
524 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
525 serv_join_chat(chat->account->gc, chat->components);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
526 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
527
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
528 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
529 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
530 if(GAIM_BLIST_NODE_IS_BUDDY(node))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
531 alias_dialog_bud((GaimBuddy*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
532 else if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
533 alias_dialog_contact((GaimContact*)node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
534 else if(GAIM_BLIST_NODE_IS_CHAT(node))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
535 alias_dialog_blist_chat((GaimChat*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
536 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
537
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
538 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
540 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
541 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
543 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
544 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
545 gaim_gtk_log_show(b->name, b->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
546 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
547
8003
b9d3d397a195 [gaim-migrate @ 8680]
Nathan Walp <nwalp@pidgin.im>
parents: 7956
diff changeset
548 #if 0
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
549 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
550 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
551 /* LOG show_log(NULL); */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
552 }
8003
b9d3d397a195 [gaim-migrate @ 8680]
Nathan Walp <nwalp@pidgin.im>
parents: 7956
diff changeset
553 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
556 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
557 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
558 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
559
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 static void gtk_blist_button_im_cb(GtkWidget *w, GtkTreeView *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
561 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563 GtkTreeModel *model = gtk_tree_view_get_model(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
565
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
566 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
571 gaim_conversation_new(GAIM_CONV_IM, ((GaimBuddy*)node)->account, ((GaimBuddy*)node)->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
572 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
573 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
574 GaimBuddy *buddy =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
575 gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
576 gaim_conversation_new(GAIM_CONV_IM, buddy->account, buddy->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
577 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
578 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
579 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
580 show_im_dialog();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
582
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
583 static void gtk_blist_button_info_cb(GtkWidget *w, GtkTreeView *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586 GtkTreeModel *model = gtk_tree_view_get_model(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
588
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
589 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
594 serv_get_info(((GaimBuddy*)node)->account->gc, ((GaimBuddy*)node)->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
595 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
596 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
597 GaimBuddy *buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
598 serv_get_info(buddy->account->gc, buddy->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
599 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
600 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
601 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
602 show_info_dialog();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
605 static void gtk_blist_button_chat_cb(GtkWidget *w, GtkTreeView *tv)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
607 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
608 GtkTreeModel *model = gtk_tree_view_get_model(tv);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
609 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
610
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
611 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
612 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
613
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
614 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
615 if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
616 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
617 return;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
618 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
619 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
620 join_chat();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
621 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
622
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
625 gtk_menu_popup(GTK_MENU(awaymenu), NULL, NULL, NULL, NULL, 1, GDK_CURRENT_TIME);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
627
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
630 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
632 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
633
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
634 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
635
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
636 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
637 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
638 gaim_blist_save();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
639 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
640 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
641
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
642 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
643 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
644 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
645
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
646 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
647
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
648 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
649
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
650 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
651 gaim_blist_node_set_bool(node, "collapsed", TRUE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
652 gaim_blist_save();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
653 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
654 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
655 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
657
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
661 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
668 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
669 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
670 GaimConversation *conv;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
671
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
672 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
673 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
674 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
675 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
676
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
677 conv = gaim_conversation_new(GAIM_CONV_IM, buddy->account, buddy->name);
5489
5b5aa701d46b [gaim-migrate @ 5885]
Christian Hammond <chipx86@chipx86.com>
parents: 5451
diff changeset
678
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
679 if(conv) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
680 GaimConvWindow *win = gaim_conversation_get_window(conv);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
681
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
682 gaim_conv_window_raise(win);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
683 gaim_conv_window_switch_conversation(
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 gaim_conversation_get_window(conv),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
685 gaim_conversation_get_index(conv));
5489
5b5aa701d46b [gaim-migrate @ 5885]
Christian Hammond <chipx86@chipx86.com>
parents: 5451
diff changeset
686
5b5aa701d46b [gaim-migrate @ 5885]
Christian Hammond <chipx86@chipx86.com>
parents: 5451
diff changeset
687 if (GAIM_IS_GTK_WINDOW(win))
5b5aa701d46b [gaim-migrate @ 5885]
Christian Hammond <chipx86@chipx86.com>
parents: 5451
diff changeset
688 gtk_window_present(GTK_WINDOW(GAIM_GTK_WINDOW(win)->window));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
689 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
690 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
691 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
692 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
694 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
695 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
697 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
700 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
701 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
702 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
703 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
704 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
705
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
706 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
707 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
708 if (GAIM_BLIST_NODE_IS_BUDDY(node))
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
709 gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent->parent, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
710 if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
711 gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
712 else if (GAIM_BLIST_NODE_IS_GROUP(node))
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
713 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
714 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
715 else {
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
716 gaim_blist_request_add_chat(NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
717 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
718 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
719
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
720 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
725
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
726 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
728 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
729 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node->parent->parent)->name,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
730 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
731 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
732 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
733 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node->parent)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
734 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
735 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
736 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
739 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
740 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
741 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
742
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
743 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
744 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
745 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
746 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
747 show_confirm_del((GaimBuddy*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
748 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
749 show_confirm_del_blist_chat((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
750 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
751 show_confirm_del_group((GaimGroup*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
752 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
753 show_confirm_del_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
754 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
755 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
756
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
757 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
758 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
760 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
761 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
762
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
763 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
764 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
765
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
766 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
767
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
768 gtknode->contact_expanded = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
769
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
770 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
771 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
772 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
773 gaim_gtk_blist_update(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
774 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
775
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
776 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
777 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
778 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
779 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
780 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
781
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
782 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
783 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
784
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
785 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
786
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
787 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
788
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
789 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
790 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
791 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
792 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
793
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
794 static void gaim_proto_menu_cb(GtkMenuItem *item, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
795 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
796 struct proto_buddy_menu *pbm = g_object_get_data(G_OBJECT(item), "gaimcallback");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
797 if (pbm->callback)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798 pbm->callback(pbm->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
801 static void make_buddy_menu(GtkWidget *menu, GaimPluginProtocolInfo *prpl_info, GaimBuddy *b)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
802 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
803 GList *list;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
804 GtkWidget *menuitem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
805
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
806 if (prpl_info && prpl_info->get_info) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
807 gaim_new_item_from_stock(menu, _("_Get Info"), GAIM_STOCK_INFO,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
808 G_CALLBACK(gtk_blist_menu_info_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
809 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
810 gaim_new_item_from_stock(menu, _("_IM"), GAIM_STOCK_IM,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
811 G_CALLBACK(gtk_blist_menu_im_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
812 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
813 G_CALLBACK(gtk_blist_menu_bp_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
814 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
815 G_CALLBACK(gtk_blist_menu_showlog_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
816
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
817 if (prpl_info && prpl_info->buddy_menu) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
818 list = prpl_info->buddy_menu(b->account->gc, b->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
819 while (list) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
820 struct proto_buddy_menu *pbm = list->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
821 menuitem = gtk_menu_item_new_with_mnemonic(pbm->label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
822 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", pbm);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
823 g_signal_connect(G_OBJECT(menuitem), "activate",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
824 G_CALLBACK(gaim_proto_menu_cb), b);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
825 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
826 list = list->next;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
827 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
828 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
829
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
830 gaim_signal_emit(GAIM_GTK_BLIST(gaim_get_blist()),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
831 "drawing-menu", menu, b);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
832
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
833 gaim_separator(menu);
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7837
diff changeset
834 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_EDIT,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
835 G_CALLBACK(gtk_blist_menu_alias_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
836 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
837 G_CALLBACK(gaim_gtk_blist_remove_cb), b,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
838 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
839 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
840
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
841 static gboolean gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
842 gpointer null)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
843 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
844 GaimBlistNode *node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
845 GValue val = { 0, };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
846 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
847 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
848
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
849 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
850 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
851 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
852
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
853 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
854 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
855 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
856
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
857 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
858 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
859 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
860
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
861 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
862 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
863 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
864 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
865 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
866 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
867 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
868 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
869 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
870 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
871
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
872 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
873 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
874
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
875 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer null)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
876 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
877 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
878 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
881 GtkWidget *menu, *menuitem;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
882 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
883 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
884 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
885 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
886 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
887
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
888 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
889 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
890 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
891 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
892 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
893 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
894 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
895
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
896 if (GAIM_BLIST_NODE_IS_GROUP(node) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
897 event->button == 3 && event->type == GDK_BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
898 menu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
899 gaim_new_item_from_stock(menu, _("Add a _Buddy"), GTK_STOCK_ADD,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
900 G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
901 gaim_new_item_from_stock(menu, _("Add a C_hat"), GTK_STOCK_ADD,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
902 G_CALLBACK(gaim_gtk_blist_add_chat_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
903 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
904 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
905 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
906 G_CALLBACK(show_rename_group), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
907 gtk_widget_show_all(menu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
908 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
909
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
910 handled = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
911 } else if (GAIM_BLIST_NODE_IS_CHAT(node) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
912 event->button == 3 && event->type == GDK_BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
913 GaimChat *chat = (GaimChat *)node;
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
914 gboolean autojoin = gaim_blist_node_get_bool((GaimBlistNode*)chat,
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
915 "gtk-autojoin");
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
916
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
917 menu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
918 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
919 G_CALLBACK(gtk_blist_menu_join_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
920 gaim_new_check_item(menu, _("Auto-Join"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
921 G_CALLBACK(gtk_blist_menu_autojoin_cb), node,
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
922 autojoin);
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7837
diff changeset
923 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_EDIT,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
924 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
925 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
926 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
927 gtk_widget_show_all(menu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
928 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
929
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
930 handled = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
931 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
932 event->state & GDK_CONTROL_MASK && event->button == 2 &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
933 event->type == GDK_BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
934 if(gtknode->contact_expanded)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
935 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
936 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
937 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
938 handled = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
939 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
940 && event->button == 3 && event->type == GDK_BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
941 menu = gtk_menu_new();
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7837
diff changeset
942 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_EDIT,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
943 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
944 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
945 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
946 node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
947 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
948 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
949 gtk_widget_show_all(menu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
950 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, event->time);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
951 handled = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
952 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
953 GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
954 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
955 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
956 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
957 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
958 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
959
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
960 /* Protocol specific options */
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
961 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
962
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
963 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
964 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
965
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
966 if(event->button == 2 && event->type == GDK_2BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
967 if (prpl && prpl_info->get_info)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
968 serv_get_info(b->account->gc, b->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
969 handled = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
970 } else if(event->button == 3 && event->type == GDK_BUTTON_PRESS) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
971 gboolean show_offline = gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
972 menu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
973 make_buddy_menu(menu, prpl_info, b);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
974
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
975 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
976 gaim_separator(menu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
977
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
978 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
979 gaim_new_item_from_stock(menu, _("_Collapse"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
980 GTK_STOCK_ZOOM_OUT,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
981 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
982 node, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
983 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
984 gaim_new_item_from_stock(menu, _("_Expand"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
985 GTK_STOCK_ZOOM_IN,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
986 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
987 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
988 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
989 if(node->child->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
990 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
991
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
992 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
993 GaimBuddy *buddy = (GaimBuddy*)bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
994 GtkWidget *submenu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
995 GtkWidget *image;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
996
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
997 if(buddy == b)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
998 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
999 if(!buddy->account->gc)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1000 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1001 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1002 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1003
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1004
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1005 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1006 image = gtk_image_new_from_pixbuf(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1007 gaim_gtk_blist_get_status_icon(bnode,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1008 GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1009 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1010 image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1011 gtk_widget_show(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1012 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1013 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1014
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1015 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1016 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1017 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1018
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1019 prpl = gaim_find_prpl(gaim_account_get_protocol_id(buddy->account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1020 prpl_info = prpl ? GAIM_PLUGIN_PROTOCOL_INFO(prpl) : NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1021
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1022 make_buddy_menu(submenu, prpl_info, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1023 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1024 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1025 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1026
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1027 gtk_widget_show_all(menu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1028
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1029 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1030 event->time);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1031
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1032 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1033 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1034 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1035
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1036 #if (1) /* This code only exists because GTK doesn't work. If we return FALSE here, as would be normal
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1037 * the event propoagates down and somehow gets interpreted as the start of a drag event. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1038 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1039 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1040 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1041 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1042 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1043 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1044 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1045 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1046 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1047 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1048
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1049 static void gaim_gtk_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1050 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1051 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1052 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1053 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1054
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1055 static void gaim_gtk_blist_edit_mode_cb(gpointer callback_data, guint callback_action,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1056 GtkWidget *checkitem) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1057 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1058 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1059 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1060 while (gtk_events_pending())
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1061 gtk_main_iteration();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1062 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1063 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1064
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1065 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1066 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1067
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1068 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1069 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1070 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1071 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1072 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1073 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1075 static void gaim_gtk_blist_drag_data_get_cb (GtkWidget *widget,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1076 GdkDragContext *dc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1077 GtkSelectionData *data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1078 guint info,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1079 guint time,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1080 gpointer *null)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1081 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1082 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1083 GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1084 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1085 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1086 GaimBlistNode *node = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1087 GValue val = {0};
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1088 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1089 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1090 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1091 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1092 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1093 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1094 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1095 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1096 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1097 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1098
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1099 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1100 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1101 else if (data->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1102 FALSE)) {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1103
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1104 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1105 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1106 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1107 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1108 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1109 GaimConnection *gc;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1110 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1111 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1112 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1113 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1114
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1115 ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1116 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1117
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1118 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1119 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1120
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1121 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1122 sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1123 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1124 NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1125
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1126 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1127
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1128 if (GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1129 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1130 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1131 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1132 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1133 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1134 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1135 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1136 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1137 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1138 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1139 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1140 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1141
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1142 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1143
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1144 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1145 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1146 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1147 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1148 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1149
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1150 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1151 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1152 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1153
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1154 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1155 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1156 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1157 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1158 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1159 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1160 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1161 buddy->name);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1162
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1163 if (buddy->alias != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1164 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1165 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1166 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1167 buddy->alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1168 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1169
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1170 str = g_string_append(str, "\r\n");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1171
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1172 mime_str = g_string_free(str, FALSE);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1173
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1174 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1175 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1176 8, /* bits */
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1177 mime_str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1178 strlen(mime_str) + 1);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1179
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1180 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1181 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1182 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1183 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1184
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1185 static void gaim_gtk_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1186 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1187 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1188 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1189 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1190 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1191 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1192 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1193 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1194 /* if we're here, I think it means the drop is ok */
7642
9008b5be4275 [gaim-migrate @ 8285]
Nathan Walp <nwalp@pidgin.im>
parents: 7636
diff changeset
1195 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1196 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1197 GValue val = {0};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1198 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1199
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1200 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1201 &iter, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1202 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1203 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1204 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1205 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1206
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1207 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1208 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1209 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1210 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1211 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1212 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1213 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1214 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1215 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1216 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1217 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1218 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1219 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1220 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1221 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1222 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1223 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1224 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1225 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1226 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1227 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1228 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1229 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1230 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1231 GaimBuddy *b = (GaimBuddy*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1232 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1233 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1234 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1235 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1236 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1237 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1238 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1239 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1240 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1241 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1242 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1243 node->prev);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1244 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1245 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1246 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1247 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1248 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1249 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1250 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1251 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1252 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1253 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1254 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1255 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1256 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1257 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1258 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1259 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1260 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1261 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1262 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1263 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1264 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1265 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1266 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1267 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1268 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1269 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1270 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1271 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1272 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1273 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1274 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1275 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1276 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1277 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1278 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1279 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1280 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1281 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1282 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1283 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1284 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1285 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1286 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1287 (GaimGroup*)node->parent->parent, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1288 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1289 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1290 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1291 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1292 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1293 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1294 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1295 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1296 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1297 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1298 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1299 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1300 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1301 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1302 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1303 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1304 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1305 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1306 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1307 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1308 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1309 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1310 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1311 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1312 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1313 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1314 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1315 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1316 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1317 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1318 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1319 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1320 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1321 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1322 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1323 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1324 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1325 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1326 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1327 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1328 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1329 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1330 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1331
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1332 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1333 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1334
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1335 gaim_blist_save();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1336 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1337 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1338 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1339 FALSE) && sd->data)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1340 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1341 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1342 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1343 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1344 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1345 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1346 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1347 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1348
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1349 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1350 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1351 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1352 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1353 GaimBlistNode *node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1354 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1355
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1356 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1357 &iter, path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1358 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1359 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1360 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1361
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1362 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1363 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1364 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1365 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1366 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1367 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1368 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1369 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1370 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1371 else if (GAIM_BLIST_NODE_IS_GROUP(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1372 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1373 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1374 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1375 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1376
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1377 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1378 &protocol, &username, &alias))
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1379 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1380 if (account == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1381 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1382 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1383 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1384 "can add that buddy."), NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1385 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1386 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1387 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1388 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1389 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1390 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1391 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1392 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1393
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1394 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1395 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1396 if (alias != NULL) g_free(alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1397
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1398 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1399 gtk_tree_path_free(path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1400
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1401 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1402 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1403 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1404
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1405 static void gaim_gtk_blist_paint_tip(GtkWidget *widget, GdkEventExpose *event, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1406 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1407 GtkStyle *style;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1408 GdkPixbuf *pixbuf = gaim_gtk_blist_get_status_icon(node, GAIM_STATUS_ICON_LARGE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1409 PangoLayout *layout;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1410 char *tooltiptext = gaim_get_tooltip_text(node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1411
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1412 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1413 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1414
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1415 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1416 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1417 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1418 pango_layout_set_width(layout, 300000);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1419 style = gtkblist->tipwindow->style;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1420
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1421 gtk_paint_flat_box (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1422 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1423
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1424 #if GTK_CHECK_VERSION(2,2,0)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1425 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1426 0, 0, 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1427 #else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1428 gdk_pixbuf_render_to_drawable(pixbuf, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1429 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1430
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1431 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, TRUE,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1432 NULL, gtkblist->tipwindow, "tooltip", 38, 4, layout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1433
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1434 g_object_unref (pixbuf);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1435 g_object_unref (layout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1436 g_free(tooltiptext);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1437
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1438 #ifdef WANT_DROP_SHADOW
8040
7c252b4bfbda [gaim-migrate @ 8724]
Nathan Walp <nwalp@pidgin.im>
parents: 8022
diff changeset
1439 shadow_paint(gtkblist, NULL, EAST_SIDE);
7c252b4bfbda [gaim-migrate @ 8724]
Nathan Walp <nwalp@pidgin.im>
parents: 8022
diff changeset
1440 shadow_paint(gtkblist, NULL, SOUTH_SIDE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1441 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1442
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1443 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1444 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1445
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1446 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1447 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1448 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1449 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1450 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1451 GValue val = {0};
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1452 int scr_w,scr_h, w, h, x, y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1453 PangoLayout *layout;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1454 gboolean tooltip_top = FALSE;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1455 char *tooltiptext = NULL;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1456 struct _gaim_gtk_blist_node *gtknode;
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1457 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1458 GdkWindowAttr attr;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1459 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1460
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1461 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1462 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1463 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1464 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1465 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1466
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1467 if(!GAIM_BLIST_NODE_IS_CONTACT(node) && !GAIM_BLIST_NODE_IS_BUDDY(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1468 && !GAIM_BLIST_NODE_IS_CHAT(node))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1469 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1470
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1471 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1472
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
1473 if (node->child && GAIM_BLIST_NODE_IS_CONTACT(node) &&
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
1474 ((GaimContact*)node)->online > 1 && !gtknode->contact_expanded &&
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
1475 gaim_prefs_get_bool("/gaim/gtk/blist/auto_expand_contacts")) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1476 GtkTreeIter i;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1477 gaim_gtk_blist_expand_contact_cb(NULL, node);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1478 tooltip_top = TRUE; /* When the person expands, the new screennames will be below. We'll draw the tip above
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1479 the cursor so that the user can see the included buddies */
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1480
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1481 while (gtk_events_pending())
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1482 gtk_main_iteration();
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1483
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1484 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->contact_rect);
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1485 gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1486 gtkblist->mouseover_contact = node;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1487 gtk_tree_path_down (path);
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1488 while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1489 GdkRectangle rect;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1490 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1491 gtkblist->contact_rect.height += rect.height;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1492 gtk_tree_path_next(path);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1493 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1494 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1495
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1496 gtk_tree_path_free(path);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1497
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1498 tooltiptext = gaim_get_tooltip_text(node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1499
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1500 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1501 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1502
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
1503 if(gtkblist->tipwindow)
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
1504 gtk_widget_destroy(gtkblist->tipwindow);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1505 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1506 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1507 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1508 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1509 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1510 G_CALLBACK(gaim_gtk_blist_paint_tip), node);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1511 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
1512
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1513 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1514 attr.window_type = GDK_WINDOW_TEMP;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1515 attr.override_redirect = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1516 attr.x = gtkblist->tipwindow->allocation.x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1517 attr.y = gtkblist->tipwindow->allocation.y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1518 attr.width = gtkblist->tipwindow->allocation.width;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1519 attr.height = gtkblist->tipwindow->allocation.height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1520 attr.wclass = GDK_INPUT_OUTPUT;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1521 attr.visual = gtk_widget_get_visual (gtkblist->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1522 attr.colormap = gtk_widget_get_colormap (gtkblist->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1523
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1524 attr.event_mask = gtk_widget_get_events (gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1525
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1526 attr.event_mask |= (GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK |
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1527 GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1528 if(gtkblist->east_shadow) {
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1529 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1530 gdk_window_destroy (gtkblist->east_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1531 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1532 gtkblist->east_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1533 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1534 gdk_window_set_user_data (gtkblist->east_shadow, gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1535 gdk_window_set_back_pixmap (gtkblist->east_shadow, NULL, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1536
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1537 if(gtkblist->south_shadow) {
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1538 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1539 gdk_window_destroy (gtkblist->south_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1540 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1541 gtkblist->south_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1542 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1543 gdk_window_set_user_data (gtkblist->south_shadow, gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1544 gdk_window_set_back_pixmap (gtkblist->south_shadow, NULL, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1545 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1546
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1547 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1548 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1549 pango_layout_set_width(layout, 300000);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1550 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1551 scr_w = gdk_screen_width();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1552 scr_h = gdk_screen_height();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1553 pango_layout_get_size (layout, &w, &h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1554 w = PANGO_PIXELS(w) + 8;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1555 h = PANGO_PIXELS(h) + 8;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1556
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1557 /* 38 is the size of a large status icon plus 4 pixels padding on each side.
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1558 * I should #define this or something */
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1559 w = w + 38;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1560 h = MAX(h, 38);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1561
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1562 gdk_window_get_pointer(NULL, &x, &y, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1563 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1564 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1565
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1566 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1567
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1568 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1569 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1570 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1571 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1572
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1573 if (y < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1574 y = 0;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1575
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1576 if (y != 0) {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1577 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1578 x -= (x + w + 5) - scr_w;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1579 else if (x < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1580 x = 0;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1581 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1582 x -= (w / 2 + 10);
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1583 if (x < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1584 x += w + 15;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1585 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
1586
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1587 g_object_unref (layout);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1588 g_free(tooltiptext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1589 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1590 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1591 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1592
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1593 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1594 map_shadow_windows(gtkblist);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1595 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1596
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1597 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1598 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1599
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1600 static gboolean gaim_gtk_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1601 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1602 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1603 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1604 if ((event->y > gtkblist->tip_rect.y) && ((event->y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1605 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1606 /* We've left the cell. Remove the timeout and create a new one below */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1607 if (gtkblist->tipwindow) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1608 gtk_widget_destroy(gtkblist->tipwindow);
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1609 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1610 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1611 gdk_window_destroy (gtkblist->east_shadow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1612 gtkblist->east_shadow = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1613
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1614 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1615 gdk_window_destroy (gtkblist->south_shadow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1616 gtkblist->south_shadow = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1617 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1618 gtkblist->tipwindow = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1619 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1620
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1621 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1622 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1623
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1624 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1625 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->tip_rect);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1626 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1627 gtk_tree_path_free(path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1628 gtkblist->timeout = g_timeout_add(500, (GSourceFunc)gaim_gtk_blist_tooltip_timeout, tv);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1629
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1630 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1631 if ((event->y < gtkblist->contact_rect.y) || ((event->y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1632 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1633 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1634 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1635 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1636
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1637 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1638 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1639
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1640 static void gaim_gtk_blist_leave_cb (GtkWidget *w, GdkEventCrossing *e, gpointer n)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1641 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1642 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1643 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1644 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1645 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1646 if (gtkblist->tipwindow) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1647 gtk_widget_destroy(gtkblist->tipwindow);
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
1648 #ifdef WANT_DROP_SHADOW
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1649 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1650 gdk_window_destroy (gtkblist->east_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1651 gtkblist->east_shadow = NULL;
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1652
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1653 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1654 gdk_window_destroy (gtkblist->south_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
1655 gtkblist->south_shadow = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1656 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1657 gtkblist->tipwindow = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1658 }
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1659
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1660 if (gtkblist->mouseover_contact &&
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1661 !((e->x > gtkblist->contact_rect.x) && (e->x < (gtkblist->contact_rect.x + gtkblist->contact_rect.width)) &&
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1662 (e->y > gtkblist->contact_rect.y) && (e->y < (gtkblist->contact_rect.y + gtkblist->contact_rect.height)))) {
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
1663 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1664 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
1665 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1666 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1667
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1668 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1669 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1670 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1671 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1672 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1673 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1674
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1675
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1676 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1677 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1678 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1679 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1680 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1681 /* Buddies menu */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1682 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
1683 { N_("/Buddies/New Instant _Message..."), "<CTL>M", show_im_dialog, 0, "<StockItem>", GAIM_STOCK_IM },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1684 { N_("/Buddies/Join a _Chat..."), "<CTL>C", join_chat, 0, "<StockItem>", GAIM_STOCK_CHAT },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1685 { N_("/Buddies/Get _User Info..."), "<CTL>J", show_info_dialog, 0, "<StockItem>", GAIM_STOCK_INFO },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1686 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
5398
dbed3f967327 [gaim-migrate @ 5774]
Luke Schierer <lschiere@pidgin.im>
parents: 5397
diff changeset
1687 { N_("/Buddies/Show _Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>"},
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1688 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>"},
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
1689 { N_("/Buddies/_Add Buddy..."), "<CTL>B", gaim_gtk_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
1690 { N_("/Buddies/Add C_hat..."), NULL, gaim_gtk_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD },
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
1691 { N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1692 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1693 { N_("/Buddies/_Signoff"), "<CTL>D", gaim_connections_disconnect_all, 0, "<StockItem>", GAIM_STOCK_SIGN_OFF },
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1694 { N_("/Buddies/_Quit"), "<CTL>Q", gaim_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1695
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1696 /* Tools */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1697 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1698 { N_("/Tools/_Away"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1699 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1700 { N_("/Tools/P_rotocol Actions"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1701 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1702 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
7737
c497b3bb7581 [gaim-migrate @ 8382]
Sean Egan <seanegan@gmail.com>
parents: 7731
diff changeset
1703 { N_("/Tools/_File Transfers"), NULL, gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
7870
30ee5c52b8dc [gaim-migrate @ 8524]
Luke Schierer <lschiere@pidgin.im>
parents: 7859
diff changeset
1704 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
7856
c364c783f678 [gaim-migrate @ 8510]
Mark Doliner <mark@kingant.net>
parents: 7853
diff changeset
1705 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, NULL },
8022
560f3694f760 [gaim-migrate @ 8702]
Nathan Walp <nwalp@pidgin.im>
parents: 8020
diff changeset
1706 #if 0
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1707 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1708 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL },
8003
b9d3d397a195 [gaim-migrate @ 8680]
Nathan Walp <nwalp@pidgin.im>
parents: 7956
diff changeset
1709 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1710
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1711 /* Help */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1712 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1713 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1714 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1715 { N_("/Help/_About"), NULL, show_about, 0, "<StockItem>", GAIM_STOCK_ABOUT },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1716 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1717
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1718 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1719 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1720 *********************************************************/
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1721 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1722 rename_group_cb(GaimGroup *g, const char *new_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1723 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1724 gaim_blist_rename_group(g, new_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1725 gaim_blist_save();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1726 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1727
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1728 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1729 show_rename_group(GtkWidget *unused, GaimGroup *g)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1730 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1731 gaim_request_input(NULL, _("Rename Group"), _("New group name"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1732 _("Please enter a new name for the selected group."),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1733 g->name, FALSE, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1734 _("OK"), G_CALLBACK(rename_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1735 _("Cancel"), NULL, g);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1736 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1737
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1738 static char *gaim_get_tooltip_text(GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1739 {
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1740 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1741 GaimPluginProtocolInfo *prpl_info = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1742 char *text = NULL;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1743
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1744 if(GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1745 GaimChat *chat = (GaimChat *)node;
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1746 char *name = NULL;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1747 struct proto_chat_entry *pce;
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1748 GList *parts, *tmp;
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1749 GString *parts_text = g_string_new("");
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1750
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1751 prpl = gaim_find_prpl(gaim_account_get_protocol_id(chat->account));
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1752 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1753
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1754 parts = prpl_info->chat_info(chat->account->gc);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1755
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1756 name = g_markup_escape_text(gaim_chat_get_name(chat), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1757
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1758 if(g_list_length(gaim_connections_get_all()) > 1) {
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1759 char *account = g_markup_escape_text(chat->account->username, -1);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1760 g_string_append_printf(parts_text, _("\n<b>Account:</b> %s"),
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1761 account);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1762 g_free(account);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1763 }
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1764 for(tmp = parts; tmp; tmp = tmp->next) {
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
1765 char *label, *tmp2, *value;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1766 pce = tmp->data;
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1767
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1768 if(!pce->secret) {
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1769
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1770 tmp2 = g_markup_escape_text(pce->label, -1);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1771 label = gaim_text_strip_mnemonic(tmp2);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1772 g_free(tmp2);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1773
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1774 value = g_markup_escape_text(g_hash_table_lookup(chat->components,
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1775 pce->identifier), -1);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1776
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1777 g_string_append_printf(parts_text, "\n<b>%s</b> %s", label, value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1778 g_free(label);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1779 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
1780 }
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1781 g_free(pce);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1782 }
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1783 g_list_free(parts);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1784
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1785 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>%s",
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1786 name, parts_text->str);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1787 g_string_free(parts_text, TRUE);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
1788 g_free(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1789 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1790 GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1791 GaimBuddy *b;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1792 char *statustext = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1793 char *contactaliastext = NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1794 char *aliastext = NULL, *nicktext = NULL;
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1795 char *loggedin = NULL, *idletime = NULL;
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1796 char *warning = NULL;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1797 char *accounttext = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1798
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1799 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1800 GaimContact *contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1801 b = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1802 if(contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1803 contactaliastext = g_markup_escape_text(contact->alias, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1804 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1805 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1806 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1807
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1808 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1809 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1810
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1811 if (prpl_info && prpl_info->tooltip_text) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1812 const char *end;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1813 statustext = prpl_info->tooltip_text(b);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1814
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1815 if(statustext && !g_utf8_validate(statustext, -1, &end)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1816 char *new = g_strndup(statustext,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1817 g_utf8_pointer_to_offset(statustext, end));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1818 g_free(statustext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1819 statustext = new;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1820 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1821 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1822
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1823 if (!statustext && !GAIM_BUDDY_IS_ONLINE(b))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1824 statustext = g_strdup(_("<b>Status:</b> Offline"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1825
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1826 if (b->signon > 0)
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1827 loggedin = gaim_str_seconds_to_string(time(NULL) - b->signon);
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1828
5341
ccec8893c1be [gaim-migrate @ 5717]
Mark Doliner <mark@kingant.net>
parents: 5340
diff changeset
1829 if (b->idle > 0)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1830 idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1831
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1832 if(b->alias && b->alias[0])
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1833 aliastext = g_markup_escape_text(b->alias, -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1834
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1835 if(b->server_alias)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1836 nicktext = g_markup_escape_text(b->server_alias, -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1837
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1838 if (b->evil > 0)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1839 warning = g_strdup_printf(_("%d%%"), b->evil);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1840
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1841 if(g_list_length(gaim_connections_get_all()) > 1)
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1842 accounttext = g_markup_escape_text(b->account->username, -1);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1843
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1844 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>"
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1845 "%s %s" /* Account */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1846 "%s %s" /* Contact Alias */
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1847 "%s %s" /* Alias */
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1848 "%s %s" /* Nickname */
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1849 "%s %s" /* Logged In */
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1850 "%s %s" /* Idle */
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1851 "%s %s" /* Warning */
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1852 "%s%s" /* Status */
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1853 "%s",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1854 b->name,
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1855 accounttext ? _("\n<b>Account:</b>") : "", accounttext ? accounttext : "",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1856 contactaliastext ? _("\n<b>Contact Alias:</b>") : "", contactaliastext ? contactaliastext : "",
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1857 aliastext ? _("\n<b>Alias:</b>") : "", aliastext ? aliastext : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1858 nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "",
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1859 loggedin ? _("\n<b>Logged In:</b>") : "", loggedin ? loggedin : "",
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1860 idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1861 b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1862 statustext ? "\n" : "", statustext ? statustext : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
1863 !g_ascii_strcasecmp(b->name, "robflynn") ? _("\n<b>Description:</b> Spooky") :
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1864 !g_ascii_strcasecmp(b->name, "seanegn") ? _("\n<b>Status</b>: Awesome") :
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1865 !g_ascii_strcasecmp(b->name, "chipx86") ? _("\n<b>Status</b>: Rockin'") : "");
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1866
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1867 if(warning)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1868 g_free(warning);
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1869 if(loggedin)
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
1870 g_free(loggedin);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1871 if(idletime)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1872 g_free(idletime);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1873 if(statustext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1874 g_free(statustext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1875 if(nicktext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1876 g_free(nicktext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1877 if(aliastext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1878 g_free(aliastext);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1879 if(accounttext)
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
1880 g_free(accounttext);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1881 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1882
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1883 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1884 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1885
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1886 struct _emblem_data {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1887 char *filename;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1888 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1889 int y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1890 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1891
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1892 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1893 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1894 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1895 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1896 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1897 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1898 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1899 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1900 {NULL, 0, 0}, {NULL, 15, 0}};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1901
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1902 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1903 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1904
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1905 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1906 if(!gtknode->contact_expanded)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1907 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1908 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1909 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1910 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1911 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1912 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1913 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1914 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1915
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1916 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1917 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1918 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1919 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1920
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1921 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1922 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1923 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1924 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1925
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1926 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1927 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1928 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1929
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1930 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1931
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1932 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1933 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1934 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1935 if(prpl_info && prpl_info->list_emblems && buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1936 if(buddy->present != GAIM_BUDDY_SIGNING_OFF)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1937 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1938 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1939 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1940 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1941 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1942
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1943 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1944 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1945 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1946 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1947 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1948
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1949 if(buddy && buddy->present == GAIM_BUDDY_SIGNING_ON) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1950 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1951 } else if(buddy && buddy->present == GAIM_BUDDY_SIGNING_OFF) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1952 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "logout.png", NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1953 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1954 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1955 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1956 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1957 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1958 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1959 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1960 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1961
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1962 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1963 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1964
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1965 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1966 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1967
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1968 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1969 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1970 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1971
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1972 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1973 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1974 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1975 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1976 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1977 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1978 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1979 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1980 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1981 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1982 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1983 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1984 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1985 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1986 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1987 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1988 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1989 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1990 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1991 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1992 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1993 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1994 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1995 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1996 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1997 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1998 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1999 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2000 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2001 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2003 if(buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2004 if(buddy->present == GAIM_BUDDY_OFFLINE)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2005 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2006 else if(buddy->idle &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2007 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2008 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2009 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2010
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2011 return scale;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2012 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2013
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2014 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2015 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2016 const char *file;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2017 GdkPixbuf *buf, *ret;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2018
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2019 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2020 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2021
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
2022 if ((file = gaim_blist_node_get_string((GaimBlistNode*)b, "buddy_icon")) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2023 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2024
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2025 buf = gdk_pixbuf_new_from_file(file, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2026
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2027
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2028 if (buf) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2029 if (!GAIM_BUDDY_IS_ONLINE(b))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2030 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2031 if (b->idle && gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2032 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2033
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2034 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2035 g_object_unref(G_OBJECT(buf));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2036 return ret;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2037 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2038 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2039 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2040
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2041 static gchar *gaim_gtk_blist_get_name_markup(GaimBuddy *b, gboolean selected)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2042 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2043 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2044 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2045 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2046 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2047 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2048 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2049 int ihrs, imin;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2050 char *idletime = NULL, *warning = NULL, *statustext = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2051 time_t t;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2052 /* XXX Clean up this crap */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2053
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2054 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2055 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2056 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2057
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2058 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2059 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2060 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2061 name = gaim_get_buddy_alias(b);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2062 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2063
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2064 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2065
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2066 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2067 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2068
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2069 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2070 if ((b->idle && !selected &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2071 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2072 !GAIM_BUDDY_IS_ONLINE(b)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2073 if (selected)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2074 text = g_strdup(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2075 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2076 text = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2077 esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2078 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2079 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2080 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2081 else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2082 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2083 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2084 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2085
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2086 time(&t);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2087 ihrs = (t - b->idle) / 3600;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2088 imin = ((t - b->idle) / 60) % 60;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2089
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2090 if (prpl && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2091 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2092 const char *end;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2093
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2094 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2095 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2096 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2097 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2098 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2099 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2100
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2101 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2102 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2103 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2104 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2105 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2106 g_strdelimit(tmp, "\n", ' ');
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2107 gaim_str_strip_cr(tmp);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2108
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2109 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2110 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2111 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2112 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2113 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2114 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2115 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2116 c = g_utf8_next_char(c); /* this is fun */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2117 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2118
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2119 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2120
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2121 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2122 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2123 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2124 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2125
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2126 statustext = g_strdup_printf(buf, tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2127
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2128 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2129 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2130 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2131
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2132 if (b->idle > 0 &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2133 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2134 if (ihrs)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2135 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2136 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2137 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2138 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2139
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2140 if (b->evil > 0 &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2141 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level"))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2142 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2143
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2144 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2145 statustext = g_strdup(_("Offline "));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2146
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2147 if (b->idle && !selected &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2148 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2149
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2150 text = g_strdup_printf("<span color='dim grey'>%s</span>\n"
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2151 "<span color='dim grey' size='smaller'>%s%s%s</span>",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2152 esc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2153 statustext != NULL ? statustext : "",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2154 idletime != NULL ? idletime : "",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2155 warning != NULL ? warning : "");
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2156 } else if (statustext == NULL && idletime == NULL && warning == NULL &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2157 GAIM_BUDDY_IS_ONLINE(b)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2158 text = g_strdup(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2159 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2160 text = g_strdup_printf("%s\n"
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2161 "<span %s size='smaller'>%s%s%s</span>", esc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2162 selected ? "" : "color='dim grey'",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2163 statustext != NULL ? statustext : "",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2164 idletime != NULL ? idletime : "",
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2165 warning != NULL ? warning : "");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2166 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2167 if (idletime)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2168 g_free(idletime);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2169 if (warning)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2170 g_free(warning);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2171 if (statustext)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2172 g_free(statustext);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2173 if (esc)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2174 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2175
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2176 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2177 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2178
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2179 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2180 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2181 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2182
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2183 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2184
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2185 /* if the window exists, is hidden, we're saving positions, and the
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2186 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2187 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2188 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2189
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2190 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2191 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2192 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2193
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2194 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2195 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2196 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2197 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2198 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2199
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2200 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2201 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2202 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2203 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2204
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2205 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2206 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2207 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2208 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2209 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2210
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2211 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2212 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2213 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2214
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2215 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2216 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2217 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2218 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2219 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2220 GaimBuddy *buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2221 if(buddy && buddy->idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2222 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2223 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2224 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2225 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2226
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2227 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2228 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2229 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2230
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2231 static void gaim_gtk_blist_hide_node(GaimBuddyList *list, GaimBlistNode *node)
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2232 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2233 struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2234 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2235
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2236 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2237 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2238
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2239 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2240 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2241
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2242 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2243 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2244 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2245 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2246 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2247 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2248 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2249 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2250 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2251 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2252
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2253 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2254 signed_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2255 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2256 gaim_gtk_blist_update_protocol_actions();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2257 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2258
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2259 /* this is called on all sorts of signals, and we have no reason to pass
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2260 * it anything, so it remains without arguments. If you need anything
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2261 * more specific, do as below, and create another callback that calls
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2262 * this */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2263 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2264 raise_on_events_cb()
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2265 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2266 if(gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2267 gaim_prefs_get_bool("/gaim/gtk/blist/raise_on_events")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2268 gtk_widget_show(gtkblist->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2269 gtk_window_deiconify(GTK_WINDOW(gtkblist->window));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2270 gdk_window_raise(gtkblist->window->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2271 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2272 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2273
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2274
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2275 /**********************************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2276 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2277 **********************************************************************************/
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2278 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2279 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2280 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2281
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2282 gtkblist = g_new0(GaimGtkBuddyList, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2283 blist->ui_data = gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2284
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2285 /* Setup some gaim signal handlers. */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2286 gaim_signal_connect(gaim_connections_get_handle(), "signing-on",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2287 gtkblist, GAIM_CALLBACK(signed_on_off_cb), blist);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2288 gaim_signal_connect(gaim_connections_get_handle(), "signing-off",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2289 gtkblist, GAIM_CALLBACK(signed_on_off_cb), blist);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2290
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2291 /* Register some of our own. */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2292 gaim_signal_register(gtkblist, "drawing-menu",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2293 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2294 gaim_value_new(GAIM_TYPE_BOXED, "GtkMenu"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2295 gaim_value_new(GAIM_TYPE_SUBTYPE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2296 GAIM_SUBTYPE_BLIST_BUDDY));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2297
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2298 /* All of these signal handlers are for the "Raise on Events" option */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2299 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2300 gtkblist, GAIM_CALLBACK(raise_on_events_cb), NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2301 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2302 gtkblist, GAIM_CALLBACK(raise_on_events_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2303 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2304
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2305 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2306 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2307 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2308 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2309
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2310 void gaim_gtk_blist_update_columns()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2311 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2312 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2313 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2314
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2315 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2316 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2317 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2318 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2319 } else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2320 gtk_tree_view_column_set_visible(gtkblist->idle_column,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2321 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2322 gtk_tree_view_column_set_visible(gtkblist->warning_column,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2323 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2324 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2325 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2326 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2327
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2328 enum {DRAG_BUDDY, DRAG_ROW};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2329
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2330 static char *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2331 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2332 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2333 return _((char *)path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2334 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2335
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2336 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2337 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2338 gaim_gtk_blist_sort_method_reg("none", _("None"), sort_method_none);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2339 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2340 gaim_gtk_blist_sort_method_reg("alphabetical", _("Alphabetical"), sort_method_alphabetical);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2341 gaim_gtk_blist_sort_method_reg("status", _("By status"), sort_method_status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2342 gaim_gtk_blist_sort_method_reg("log_size", _("By log size"), sort_method_log);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2343 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2344 gaim_gtk_blist_sort_method_set(gaim_prefs_get_string("/gaim/gtk/blist/sort_type"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2345 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2346
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2347 static void _prefs_change_redo_list() {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2348 redo_buddy_list(gaim_get_blist(), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2349 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2350
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2351 static void _prefs_change_sort_method(const char *pref_name, GaimPrefType type,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2352 gpointer val, gpointer data) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2353 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2354 gaim_gtk_blist_sort_method_set(val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2355 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2356
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2357 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2358 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2359 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2360 GtkTreeViewColumn *column;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2361 GtkWidget *sw;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2362 GtkWidget *button;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2363 GtkSizeGroup *sg;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2364 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2365 GtkTreeSelection *selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2366 GtkTargetEntry gte[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2367 {"application/x-im-contact", 0, DRAG_BUDDY}};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2368
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2369 if (gtkblist && gtkblist->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2370 gtk_widget_show(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2371 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2372 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2373
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2374 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2375
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2376 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2377 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2378 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2379
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2380 GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2381
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2382 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2383 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2384
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2385 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2386 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2387 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2388 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2389
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2390 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2391 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2392 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2393 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2394 gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", accel_group);
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2395 gtk_item_factory_set_translate_func (gtkblist->ift,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2396 item_factory_translate_func,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2397 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2398 gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu),
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2399 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2400 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2401 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2402 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2403 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>"), FALSE, FALSE, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2404
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2405 awaymenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Away"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2406 do_away_menu();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2407
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2408 gtkblist->bpmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounce"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2409 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2410
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2411 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Protocol Actions"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2412 gaim_gtk_blist_update_protocol_actions();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2413 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2414 sw = gtk_scrolled_window_new(NULL,NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2415 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2416 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2417
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2418 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2419 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, G_TYPE_STRING,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2420 G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2421
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2422 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2423 gtk_widget_set_size_request(gtkblist->treeview, -1, 200);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2424
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2425 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2426
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2427 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2428 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(gaim_gtk_blist_selection_changed), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2429
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2430
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2431 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2432 gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2433 GDK_BUTTON1_MASK, gte, 2,
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2434 GDK_ACTION_COPY);
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2435 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2436 gte, 2,
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
2437 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2438
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2439 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-received", G_CALLBACK(gaim_gtk_blist_drag_data_rcv_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2440 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(gaim_gtk_blist_drag_data_get_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2441
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2442 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2443 g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(gaim_gtk_blist_motion_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2444 g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(gaim_gtk_blist_leave_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2445
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2446 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2447
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2448 column = gtk_tree_view_column_new ();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2449
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2450 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2451 gtk_tree_view_column_pack_start (column, rend, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2452 gtk_tree_view_column_set_attributes (column, rend,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2453 "pixbuf", STATUS_ICON_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2454 "visible", STATUS_ICON_VISIBLE_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2455 NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2456 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2457
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2458 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2459 gtk_tree_view_column_pack_start (column, rend, TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2460 gtk_tree_view_column_set_attributes (column, rend,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2461 "markup", NAME_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2462 NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2463 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2464
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2465 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2466
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2467 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2468 gtkblist->warning_column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2469 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->warning_column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2470 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2471
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2472 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2473 gtkblist->idle_column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2474 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->idle_column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2475 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2476
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2477 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2478 gtkblist->buddy_icon_column = gtk_tree_view_column_new_with_attributes("Buddy Icon", rend, "pixbuf", BUDDY_ICON_COLUMN, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2479 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2480 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->buddy_icon_column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2481
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2482 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2483 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2484 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2485 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2486 g_signal_connect(G_OBJECT(gtkblist->treeview), "key-press-event", G_CALLBACK(gtk_blist_key_press_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2487
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
2488 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
2489 gtk_tree_view_set_search_column(GTK_TREE_VIEW(gtkblist->treeview), NAME_COLUMN);
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
2490
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2491 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2492 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2493 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2494
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2495 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2496 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2497 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2498 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Offline Buddies"))),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2499 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
2500 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Empty Groups"))),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2501 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2502
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2503 /* OK... let's show this bad boy. */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2504 gaim_gtk_blist_refresh(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2505 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2506 gtk_widget_show_all(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2507
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2508 /**************************** Button Box **************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2509 /* add this afterwards so it doesn't force up the width of the window */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2510
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2511 gtkblist->tooltips = gtk_tooltips_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2512
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2513 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2514 gtkblist->bbox = gtk_hbox_new(TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2515 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->bbox, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2516 gtk_widget_show(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2517
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2518 button = gaim_pixbuf_button_from_stock(_("IM"), GAIM_STOCK_IM, GAIM_BUTTON_VERTICAL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2519 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2520 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2521 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2522 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_im_cb),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2523 gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2524 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Send a message to the selected buddy"), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2525 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2526
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2527 button = gaim_pixbuf_button_from_stock(_("Get Info"), GAIM_STOCK_INFO, GAIM_BUTTON_VERTICAL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2528 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2529 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2530 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2531 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_info_cb),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2532 gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2533 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Get information on the selected buddy"), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2534 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2535
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2536 button = gaim_pixbuf_button_from_stock(_("Chat"), GAIM_STOCK_CHAT, GAIM_BUTTON_VERTICAL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2537 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2538 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2539 gtk_size_group_add_widget(sg, button);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2540 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_chat_cb), gtkblist->treeview);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2541 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Join a chat room"), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2542 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2543
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2544 button = gaim_pixbuf_button_from_stock(_("Away"), GAIM_STOCK_ICON_AWAY, GAIM_BUTTON_VERTICAL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2545 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2546 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2547 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2548 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gtk_blist_button_away_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2549 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Set an away message"), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2550 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2551
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2552 /* this will show the right image/label widgets for us */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2553 gaim_gtk_blist_update_toolbar();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2554
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2555 /* start the refresh timer */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2556 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2557 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2558
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2559 gtkblist->refresh_timer = g_timeout_add(30000,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2560 (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2561 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2562
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2563 /* attach prefs callbacks */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2564 /* for the toolbar buttons */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2565 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2566 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2567 gaim_prefs_connect_callback("/gaim/gtk/blist/button_style",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2568 gaim_gtk_blist_update_toolbar, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2569 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2570 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2571 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buttons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2572 gaim_gtk_blist_update_toolbar, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2573
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2574 /* things that affect how buddies are displayed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2575 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2576 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2577 gaim_prefs_connect_callback("/gaim/gtk/blist/grey_idle_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2578 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2579 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2580 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2581 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buddy_icons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2582 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2583 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2584 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2585 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2586 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2587 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2588 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2589 gaim_prefs_connect_callback("/gaim/gtk/blist/show_idle_time",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2590 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2591 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2592 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2593 gaim_prefs_connect_callback("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2594 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2595 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2596 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2597 gaim_prefs_connect_callback("/gaim/gtk/blist/show_group_count",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2598 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2599 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2600 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2601 gaim_prefs_connect_callback("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2602 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2603
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2604 /* sorting */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2605 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2606 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2607 gaim_prefs_connect_callback("/gaim/gtk/blist/sort_type",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2608 _prefs_change_sort_method, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2609
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2610 /* things that affect what columns are displayed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2611 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2612 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2613 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buddy_icons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2614 gaim_gtk_blist_update_columns, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2615 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2616 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2617 gaim_prefs_connect_callback("/gaim/gtk/blist/show_idle_time",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2618 gaim_gtk_blist_update_columns, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2619 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2620 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2621 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2622 gaim_gtk_blist_update_columns, NULL)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2623 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2624
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2625 /* XXX: does this need fixing? */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2626 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2627 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2628 GaimBlistNode *gnode, *cnode, *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2629
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2630 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2631 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2632 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2633 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2634 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2635 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2636 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2637
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2638 for(bnode = cnode->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2639 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2640 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2641 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2642 gaim_gtk_blist_hide_node(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2643 gaim_gtk_blist_update(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2644 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2645
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2646 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2647 } else if(GAIM_BLIST_NODE_IS_CHAT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2648 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2649 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2650
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2651 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2652 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2653 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2654 gaim_gtk_blist_update(list, gnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2655 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2656 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2657
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2658 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2659 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2660 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2661 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
2662
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2663 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2664 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2665 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2666 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2667 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2668
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2669 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2670 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2671
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2672 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2673 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2674
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2675 gtkblist->refresh_timer = g_timeout_add(30000,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2676 (GSourceFunc)gaim_gtk_blist_refresh_timer, blist);
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2677 } else {
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2678 g_source_remove(gtkblist->refresh_timer);
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2679 gtkblist->refresh_timer = 0;
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2680 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2681 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
2682
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2683 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2684 struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2685 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2686
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2687 /* XXX: why do we assume we have a buddy here? */
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2688 if (!gtknode) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2689 #if 0
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2690 gaim_debug(GAIM_DEBUG_ERROR, "gtkblist", "buddy %s has no ui_data\n", ((GaimBuddy *)node)->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2691 #endif
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2692 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2693 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2694
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2695 if (!gtkblist) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2696 gaim_debug(GAIM_DEBUG_ERROR, "gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2697 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2698 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2699
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2700 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2701 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2702
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2703 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2704 return FALSE;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2705 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), iter, path)) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2706 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2707 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2708 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2709 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2710 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2711 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2712
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2713 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2714 gaim_gtk_blist_update_toolbar_icons (GtkWidget *widget, gpointer data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2715 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2716 GaimButtonStyle style = gaim_prefs_get_int("/gaim/gtk/blist/button_style");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2717
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2718 if (GTK_IS_IMAGE(widget)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2719 if (style == GAIM_BUTTON_IMAGE || style == GAIM_BUTTON_TEXT_IMAGE)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2720 gtk_widget_show(widget);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2721 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2722 gtk_widget_hide(widget);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2723 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2724 else if (GTK_IS_LABEL(widget)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2725 if (style == GAIM_BUTTON_IMAGE)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2726 gtk_widget_hide(widget);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2727 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2728 gtk_widget_show(widget);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2729 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2730 else if (GTK_IS_CONTAINER(widget)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2731 gtk_container_foreach(GTK_CONTAINER(widget),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2732 gaim_gtk_blist_update_toolbar_icons, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2733 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2734 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2735
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2736 void gaim_gtk_blist_update_toolbar() {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2737 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2738 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2739
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2740 if (gaim_prefs_get_int("/gaim/gtk/blist/button_style") == GAIM_BUTTON_NONE)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2741 gtk_widget_hide(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2742 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2743 gtk_container_foreach(GTK_CONTAINER(gtkblist->bbox),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2744 gaim_gtk_blist_update_toolbar_icons, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2745 gtk_widget_show(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2746 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2747 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2748
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2749 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2750 {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2751 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2752
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2753 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2754 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2755
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2756 /* There's something I don't understand here */
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2757 /* g_free(node->ui_data);
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
2758 node->ui_data = NULL; */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2759 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2760
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2761 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2762 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
2763 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2764
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
2765 /* test for gtkblist because crazy timeout means we can be called after the blist is gone */
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
2766 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
2767 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2768 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2769 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2770 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2771 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2772 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2773 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2774
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2775 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2776 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2777
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2778 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2779 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2780 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2781 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2782
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2783 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2784 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2785 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2786 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
2787
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2788 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2789 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2790 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2791
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2792 static void insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2793 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2794 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2795 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2796 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2797
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2798 if(!gtknode || !iter)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2799 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2800
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2801 if(node->parent && !get_iter_from_node(node->parent, &parent_iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2802 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2803
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804 if(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2805 curptr = &cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2806
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2807 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2808 *iter = current_sort_method->func(node, list, parent_iter, curptr);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2809 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2810 *iter = sort_method_none(node, list, parent_iter, curptr);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2811 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2812
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2813 gtk_tree_row_reference_free(gtknode->row);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2814 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2815 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2816 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2817 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2818 newpath);
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2819 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2820
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2821 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2822 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2823 -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2824
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2825 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2826 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2827 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2828
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2829 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
2830 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2831 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2832 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2833 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2834 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2835 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2836 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
2837 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2838 gtk_tree_path_free(expand);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2839 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2840 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2841
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2842 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2843
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2844 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2845 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2846 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2847
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2848 g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2849
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2850 group = (GaimGroup*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2851
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2852 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2853 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2854 gaim_blist_get_group_online_count(group) > 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2855 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2856 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2857
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2858 insert_node(list, node, &iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2859
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2860 esc = g_markup_escape_text(group->name, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2861 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_group_count")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2862 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2863 esc, gaim_blist_get_group_online_count(group),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2864 gaim_blist_get_group_size(group, FALSE));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2865 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2866 mark = g_strdup_printf("<span weight='bold'>%s</span>", esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2867 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2868 g_free(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2869
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2870 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2871 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2872 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2873 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2874 NODE_COLUMN, node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2875 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2876 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2877 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2878 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2879 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2880 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2881
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2882 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2883 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2884 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2885 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2886 char *warning = NULL, *idle = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2887
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2888 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2889
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2890 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2891 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2892 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2893
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2894 avatar = gaim_gtk_blist_get_buddy_icon(buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2895 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2896
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2897 if (buddy->idle > 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2898 time_t t;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2899 int ihrs, imin;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2900 time(&t);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2901 ihrs = (t - buddy->idle) / 3600;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2902 imin = ((t - buddy->idle) / 60) % 60;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2903 if(ihrs > 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2904 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2905 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2906 idle = g_strdup_printf("(%d)", imin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2907 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2908
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2909 if (buddy->evil > 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2910 warning = g_strdup_printf("%d%%", buddy->evil);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2911
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2912 if (gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2913 buddy->idle) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2914
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2915 if(warning && !selected) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2916 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2917 warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2918 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2919 warning = w2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2920 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2921
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2922 if(idle && !selected) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2923 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2924 idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2925 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2926 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2927 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2928 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2929
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2930 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2931 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2932 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2933 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2934 WARNING_COLUMN, warning,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2935 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2936 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2937 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2938
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2939 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2940 if(idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2941 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2942 if(warning)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2943 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2944 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2945 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2946 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2947 g_object_unref(avatar);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2948 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2949
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2950 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2951 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2952 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2953 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2954 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2955
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2956 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2957
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2958 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2959 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2960
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2961 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2962 contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2963 buddy = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2964
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2965 if(buddy && (buddy->present != GAIM_BUDDY_OFFLINE ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2966 (gaim_account_is_connected(buddy->account) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2967 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2968 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2969
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2970 insert_node(list, node, &iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2971
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2972 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2973 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2974 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2975
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2976 status = gaim_gtk_blist_get_status_icon(node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2977 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2978 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2979
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2980 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2981
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2982 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2983 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2984 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2985 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2986 WARNING_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2987 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2988 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2989 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2990 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2991 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2992 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2993 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2994 buddy_node(buddy, &iter, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2995 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2996 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2997 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2998 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2999 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3000
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3001 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3002 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3003 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3004 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3005 struct _gaim_gtk_blist_node *gtkparentnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3006
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3007 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3008
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3009 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3010 contact = (GaimContact*)node->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3011 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3012
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3013 /* First things first, update the contact */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3014 gaim_gtk_blist_update_contact(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3015
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3016 if(gtkparentnode->contact_expanded &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3017 (buddy->present != GAIM_BUDDY_OFFLINE ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3018 (gaim_account_is_connected(buddy->account) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3019 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3020 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3021
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3022 insert_node(list, node, &iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3023 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3024
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3025 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3026 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3027 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3028
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3029 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3030
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3031 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3032 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3033 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3034
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3035 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3036
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3037 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3038 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3039
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3040 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3041
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3042 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3043 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3044 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3045 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3046
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3047 insert_node(list, node, &iter);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3048
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3049 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3050 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3051 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3052
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3053 mark = g_markup_escape_text(gaim_chat_get_name(chat), -1);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3054
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3055 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3056 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3057 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3058 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3059 -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3060
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3061 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3062 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3063 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3064 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3065 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3066 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3067 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3068
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3069 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3070 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3071 if(!gtkblist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3072 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3073
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3074 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3075 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3076 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3077 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3078 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3079 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3080 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3081 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3082 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3083 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3084 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3085 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3086 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3087 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3088 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3089 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3090
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3091 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3092 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3093
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3094
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3095 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3096 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3097 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3098 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3099
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3100 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3101
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3102 if (gtkblist->tipwindow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3103 gtk_widget_destroy(gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3104
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3105 gtk_object_sink(GTK_OBJECT(gtkblist->tooltips));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3106
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3107 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3108 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3109 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3110 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3111
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3112 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3113 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3114 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3115 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3116 gtkblist->idle_column = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3117 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3118 gtkblist->bbox = gtkblist->tipwindow = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3119 g_object_unref(G_OBJECT(gtkblist->ift));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3120 protomenu = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3121 awaymenu = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3122 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3123
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3124 while(blist_prefs_callbacks) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3125 gaim_prefs_disconnect_callback(GPOINTER_TO_INT(blist_prefs_callbacks->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3126 blist_prefs_callbacks = g_slist_remove(blist_prefs_callbacks, blist_prefs_callbacks->data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3127 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3128 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3129
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3130 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3131 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3132 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3133 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3134
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3135 if (show) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3136 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3137 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3138 } else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3139 if (!gaim_connections_get_all() || docklet_count) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3140 #ifdef _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3141 wgaim_systray_minimize(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3142 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3143 gtk_widget_hide(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3144 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3145 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3146 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3147 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3148 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3149
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3150 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3151 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3152 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3153 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3154 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3155 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3156 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3157
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3158 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3159 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3160 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3161 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3162 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3163 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3164 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3165 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3166 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3167 gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3168 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3169 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3170 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3171 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3172 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3173 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3174 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3175 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3176 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3177
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3178 return tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3179 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3181 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3182 add_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3183 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3184 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3185 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3186 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3187 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3188
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3189 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3190 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3191 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3192 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3193 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3194
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3195 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3196 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3197 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3198 const char *grp, *who, *whoalias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3199 GaimConversation *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3200 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3201 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3202
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3203 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3204 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3205 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3206 grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->combo)->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3207 whoalias = gtk_entry_get_text(GTK_ENTRY(data->entry_for_alias));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3208
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3209 c = gaim_find_conversation_with_account(who, data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3210
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3211 if ((g = gaim_find_group(grp)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3212 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3213 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3214 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3215 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3216
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3217 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3218 gaim_blist_add_buddy(b, NULL, g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3219 serv_add_buddy(gaim_account_get_connection(data->account), who, g);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3220
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3221 /*
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3222 * It really seems like it would be better if the call to serv_add_buddy()
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3223 * and gaim_conversation_update() were done in blist.c, possibly in the
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3224 * gaim_blist_add_buddy() function. Maybe serv_add_buddy() should be
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3225 * renamed to gaim_blist_add_new_buddy() or something, and have it call
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3226 * gaim_blist_add_buddy() after it creates it. --Mark
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3227 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3228
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3229 if (c != NULL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3230 gaim_buddy_icon_update(gaim_conv_im_get_icon(GAIM_CONV_IM(c)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3231 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3232 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3233
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3234 gaim_blist_save();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3235 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3236
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3237 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3238 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3239
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3240 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3241 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3242 const char *group, const char *alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3243 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3244 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3245 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3246 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3247 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3248 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3249 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3250 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3251
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3252 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3253 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3254 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3255 : gaim_connection_get_account(gaim_connections_get_all()->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3256
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3257 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3258 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3259
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3260 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3261
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3262 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3263 (gtkblist->window ? GTK_WINDOW(gtkblist->window) : NULL), 0,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3264 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3265 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3266 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3267
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3268 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3269 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3270 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3271 gtk_dialog_set_has_separator(GTK_DIALOG(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3272 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3273 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3274 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3275
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3276 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3277 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3278 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3279 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3280
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3281 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3282 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3283
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3284 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3285 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3286 "to add to your buddy list. You may optionally enter an alias, "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3287 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3288 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3289
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3290 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3291 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3292 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3293 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3294
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3295 hbox = gtk_hbox_new(FALSE, 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3296 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3297
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3298 g_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3299 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3300
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3301 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3302 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3303 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3304 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3305 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3306
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3307 label = gtk_label_new(_("Screen Name:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3308 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3309 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3310
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3311 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3312 gtk_table_attach_defaults(GTK_TABLE(table), data->entry, 1, 2, 0, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3313 gtk_widget_grab_focus(data->entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3314
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3315 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3316 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3317
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3318 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3319
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3320 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3321 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3322 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3323
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3324 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3325 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3326 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3327
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3328 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3329 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3330
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3331 gtk_entry_set_activates_default (GTK_ENTRY(data->entry_for_alias), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3332
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3333 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3334 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3335 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 2, 3);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3336
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3337 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3338 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3339 gtk_table_attach_defaults(GTK_TABLE(table), data->combo, 1, 2, 2, 3);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3340
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3341 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3342 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3343 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3344 gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 3, 4);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3345
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3346 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3347 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3348
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3349 gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 1, 2, 3, 4);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3350
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3351 /* End of account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3352
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3353 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3354 G_CALLBACK(add_buddy_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3355
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3356 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3357
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3358 if (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3359 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(data->combo)->entry), group);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3360 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3361
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3362 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3363 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3364 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3365 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3366 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3367 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3368 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3369 const char *group_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3370
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3371 components = g_hash_table_new_full(g_str_hash, g_str_equal,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3372 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3373
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3374 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3375 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3376 if (g_object_get_data(tmp->data, "is_spin"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3377 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3378 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3379 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3380 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3381 gtk_spin_button_get_value_as_int(tmp->data)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3382 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3383 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3384 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3385 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3386 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3387 g_strdup(gtk_entry_get_text(tmp->data)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3388 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3389 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3390
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3391 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3392 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3393 components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3394
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3395 group_name = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->group_combo)->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3396
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3397 if ((group = gaim_find_group(group_name)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3398 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3399 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3400 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3401 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3402
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3403 if (chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3404 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3405 gaim_blist_add_chat(chat, group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3406 gaim_blist_save();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3407 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3408
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3409 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3410 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3411
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3412 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3413 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3414
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3415 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3416 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3417 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3418 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3419 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3420 add_chat_cb(NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3421 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3422 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3423 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3424 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3425 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3426 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3427 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3428 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3429
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3430 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3431 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3432 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3433 GaimConnection *gc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3434 GList *list, *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3435 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3436 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3437
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3438 gc = gaim_account_get_connection(data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3439
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3440 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3441 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3442 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3443 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3444 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3445
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3446 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3447 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3448
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3449 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3450
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3451 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3452
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3453 for (tmp = list; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3454 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3455 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3456 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3457
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3458 pce = tmp->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3459
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3460 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3461 gtk_box_pack_start(GTK_BOX(data->entries_box), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3462
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
3463 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3464 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3465 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3466 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3467
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3468 if (pce->is_int)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3469 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3470 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3471 GtkWidget *spin;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3472 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3473 1, 10, 10);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3474 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3475 g_object_set_data(G_OBJECT(spin), "is_spin", GINT_TO_POINTER(TRUE));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3476 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3477 data->entries = g_list_append(data->entries, spin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3478 gtk_widget_set_size_request(spin, 50, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3479 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
7891
62f885e37afd [gaim-migrate @ 8551]
Ethan Blanton <elb@pidgin.im>
parents: 7889
diff changeset
3480 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3481 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3482 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3483 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3484 GtkWidget *entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3485
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3486 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3487 data->entries = g_list_append(data->entries, entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3488
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3489 if (pce->def)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3490 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3491
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3492 if (focus)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3493 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3494 gtk_widget_grab_focus(entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3495 focus = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3496 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3497
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3498 if (pce->secret)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3499 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3500
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3501 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3502
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3503 g_signal_connect(G_OBJECT(entry), "activate",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3504 G_CALLBACK(add_chat_cb), data);
7891
62f885e37afd [gaim-migrate @ 8551]
Ethan Blanton <elb@pidgin.im>
parents: 7889
diff changeset
3505 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3506 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3507
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3508 g_free(pce);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3509 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3510
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3511 g_list_free(list);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3512
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3513 gtk_widget_show_all(data->entries_box);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3514 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3515
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3516 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3517 add_chat_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3518 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3519 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3520 if (gaim_account_get_protocol(data->account) ==
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3521 gaim_account_get_protocol(account))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3522 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3523 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3524 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3525 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3526 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3527 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3528 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3529 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3530 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3531
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3532 static gboolean
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3533 add_chat_check_account_func(GaimAccount *account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3534 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3535 GaimConnection *gc = gaim_account_get_connection(account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3536
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3537 return (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3538 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3539
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3540 void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
3541 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
3542 const char *alias)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3543 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3544 GaimGtkAddChatData *data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3545 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3546 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3547 GaimConnection *gc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3548 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3549 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3550 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3551 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3552 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3553
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3554 data = g_new0(GaimGtkAddChatData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3555
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3556 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3557 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3558
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3559 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3560
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3561 if (account != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3562 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3563 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3564 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3565 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3566 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3567 /* Select an account with chat capabilities */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3568 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3569 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3570 gc = (GaimConnection *)l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3571
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3572 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3573 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3574 data->account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3575 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3576 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3577 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3578 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3579
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3580 if (data->account == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3581 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3582 gaim_notify_error(NULL, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3583 _("You are not currently signed on with any "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3584 "protocols that have the ability to chat."), NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3585 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3586 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3587
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3588 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3589
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3590 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3591 GTK_WINDOW(gtkblist->window), 0,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3592 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3593 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3594 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3595
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3596 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3597 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3598 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3599 gtk_dialog_set_has_separator(GTK_DIALOG(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3600 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3601 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3602 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3603
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3604 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3605 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3606 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3607 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3608
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3609 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3610 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3611
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3612 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3613 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3614 "about the chat you would like to add to your buddy list.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3615 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3616 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3617 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3618 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3619
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3620 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3621 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3622
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3623 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3624 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3625 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3626 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3627
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3628 data->account_menu = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3629 G_CALLBACK(add_chat_select_account_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3630 add_chat_check_account_func, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3631 gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3632
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3633 data->entries_box = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3634 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3635 gtk_box_pack_start(GTK_BOX(vbox), data->entries_box, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3636
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3637 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3638
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3639 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3640 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3641
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3642 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3643 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3644 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3645 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3646
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3647 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
3648 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
3649 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3650 gtk_box_pack_end(GTK_BOX(rowbox), data->alias_entry, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3651
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3652 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3653 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3654
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3655 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3656 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3657 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3658 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3659
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3660 data->group_combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3661 gtk_combo_set_popdown_strings(GTK_COMBO(data->group_combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3662 gtk_box_pack_end(GTK_BOX(rowbox), data->group_combo, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3663
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3664 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3665 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3666 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(data->group_combo)->entry),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3667 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3668 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3669
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3670 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3671 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3672
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3673 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3674 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3675
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3676 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3677 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3678 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3679 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3680
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3681 g = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3682 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3683 gaim_blist_save();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3684 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3685
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3686 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3687 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3688 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
3689 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3690 _("Please enter the name of the group to be added."),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3691 NULL, FALSE, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3692 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3693 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3694 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3695
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3696 void gaim_gtk_blist_docklet_toggle() {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3697 /* Useful for the docklet plugin and also for the win32 tray icon*/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3698 /* This is called when one of those is clicked--it will show/hide the
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3699 buddy list/login window--depending on which is active */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3700 if (gaim_connections_get_all()) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3701 if (gtkblist && gtkblist->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3702 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3703 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gaim_gtk_blist_obscured);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3704 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3705 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3706 wgaim_systray_maximize(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3707 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3708 gaim_blist_set_visible(TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3709 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3710 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3711 /* we're logging in or something... do nothing */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3712 /* or should I make the blist? */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3713 gaim_debug(GAIM_DEBUG_WARNING, "blist",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3714 "docklet_toggle called with gaim_connections_get_all() "
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3715 "but no blist!\n");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3716 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3717 } else if (mainwindow) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3718 if (GTK_WIDGET_VISIBLE(mainwindow)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3719 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3720 gtk_window_present(GTK_WINDOW(mainwindow));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3721 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3722 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3723 wgaim_systray_minimize(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3724 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3725 gtk_widget_hide(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3726 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3727 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3728 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3729 wgaim_systray_maximize(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3730 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3731 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3732 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3733 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3734 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3735 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3736 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3737
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3738 void gaim_gtk_blist_docklet_add()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3739 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3740 docklet_count++;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3741 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3742
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3743 void gaim_gtk_blist_docklet_remove()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3744 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3745 docklet_count--;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3746 if (!docklet_count) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3747 if (gaim_connections_get_all())
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3748 gaim_blist_set_visible(TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3749 else if (mainwindow)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3750 gtk_window_present(GTK_WINDOW(mainwindow));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3751 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3752 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3753 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3754 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3755
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3756 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3757 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3758 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3759 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3760 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3761 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3762 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3763 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3764 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3765 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3766 gaim_gtk_blist_request_add_chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3767 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3768 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3769
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3770
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3771 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3772 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3773 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3774 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3775 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3776
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3777 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3778 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3779 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3780 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3781 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3782 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3783 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3784 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3785 for(cnode = gnode->child; cnode; cnode = cnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3786 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3787 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3788
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3789 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3790 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3791
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3792 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3793
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3794 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3795 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3796
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3797 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3798 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3799 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3800 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3801 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3802
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3803 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3804 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3805 /* XXX */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3806 static int gtk_blist_handle;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3807
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3808 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3809 &gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3810 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3811
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3812 /* Initialize prefs */
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3813 gaim_prefs_add_none("/gaim/gtk/blist");
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3814 gaim_prefs_add_bool("/gaim/gtk/blist/auto_expand_contacts", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3815 gaim_prefs_add_int("/gaim/gtk/blist/button_style", GAIM_BUTTON_TEXT_IMAGE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3816 gaim_prefs_add_bool("/gaim/gtk/blist/grey_idle_buddies", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3817 gaim_prefs_add_bool("/gaim/gtk/blist/raise_on_events", FALSE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3818 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3819 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3820 gaim_prefs_add_bool("/gaim/gtk/blist/show_group_count", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3821 gaim_prefs_add_bool("/gaim/gtk/blist/show_idle_time", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3822 gaim_prefs_add_bool("/gaim/gtk/blist/show_offline_buddies", FALSE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3823 gaim_prefs_add_bool("/gaim/gtk/blist/show_warning_level", TRUE);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3824 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "");
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3825 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3826 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3827 gaim_prefs_add_int("/gaim/gtk/blist/width", 0);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3828 gaim_prefs_add_int("/gaim/gtk/blist/height", 0);
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
3829
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3830 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3831
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3832
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3833
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3834 /*********************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3835 * Public utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3836 *********************************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3837
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3838 GdkPixbuf *
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3839 create_prpl_icon(GaimAccount *account)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3840 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3841 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3842 GaimPluginProtocolInfo *prpl_info = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3843 GdkPixbuf *status = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3844 char *filename = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3845 const char *protoname = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3846 char buf[256];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3847
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
3848 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3849
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3850 if (prpl != NULL) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3851 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3852
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3853 if (prpl_info->list_icon != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3854 protoname = prpl_info->list_icon(account, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3855 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3856
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3857 if (protoname == NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3858 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3859
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3860 /*
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3861 * Status icons will be themeable too, and then it will look up
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3862 * protoname from the theme
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3863 */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3864 g_snprintf(buf, sizeof(buf), "%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3865
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3866 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3867 "default", buf, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3868 status = gdk_pixbuf_new_from_file(filename, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3869 g_free(filename);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3870
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3871 return status;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3872 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3873
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3874
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3875 /*********************************************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3876 * Buddy List sorting functions *
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3877 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3878
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3879 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3880 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3881 struct gaim_gtk_blist_sort_method *method = g_new0(struct gaim_gtk_blist_sort_method, 1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3882 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3883 method->name = g_strdup(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3884 method->func = func;;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3885 gaim_gtk_blist_sort_methods = g_slist_append(gaim_gtk_blist_sort_methods, method);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3886 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3887
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3888 void gaim_gtk_blist_sort_method_unreg(const char *id){
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3889 GSList *l = gaim_gtk_blist_sort_methods;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3890
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3891 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3892 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3893 if(!strcmp(method->id, id)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3894 gaim_gtk_blist_sort_methods = g_slist_remove(gaim_gtk_blist_sort_methods, method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3895 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3896 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3897 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3898 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3899 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3900 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3901 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3902
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3903 void gaim_gtk_blist_sort_method_set(const char *id){
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3904 GSList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3905
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3906 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3907 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3908
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3909 while (l && strcmp(((struct gaim_gtk_blist_sort_method*)l->data)->id, id))
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3910 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3911
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3912 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3913 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3914 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3915 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3916 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3917 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3918 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3919
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3920 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3921
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3922 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3923 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3924 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3925
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3926 static GtkTreeIter sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter parent_iter, GtkTreeIter *cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3927 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3928 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3929 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3930 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3931
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3932 if(cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3933 return *cur;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3934
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3935 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3936 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3937 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3938
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3939 gtk_tree_store_insert_after(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3940 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3941 sibling ? &sibling_iter : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3942
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3943 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3944 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3945
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3946 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3947
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3948 static GtkTreeIter sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3949 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3950 GtkTreeIter more_z, iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3951 GaimBlistNode *n;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3952 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3953
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3954 const char *my_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3955
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3956 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3957 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3958 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3959 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3960 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3961 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3962 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3963
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3964
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3965 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3966 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3967 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3968 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3969
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3970 do {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3971 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3972 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3973
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3974 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3975 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3976
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3977 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3978 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3979 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3980 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3981 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3982 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3983 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3984
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3985 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3986
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3987 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3988 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3989 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3990 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3991 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3992 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3993 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3994 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3995 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3996 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3997 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3998 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3999
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4000 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4001 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4002 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4003 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4004 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4005 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4006 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4007 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4008
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4009 static GtkTreeIter sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4010 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4011 GtkTreeIter more_z, iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4012 GaimBlistNode *n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4013 GValue val = {0,};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4014
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4015 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4016
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4017 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4018 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4019 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4020 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4021 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4022
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4023 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4024 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4025 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4026 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4027 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4028
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4029
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4030 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4031 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4032 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4033 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4034
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4035 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4036 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4037
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4038 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4039 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4040
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4041 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4042 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4043 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4044 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4045 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4046
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4047 cmp = gaim_utf8_strcasecmp(my_buddy ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048 gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 : NULL, this_buddy ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4050 gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4051 : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4053 /* Hideous */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4054 if(!this_buddy ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4055 ((my_buddy->present > this_buddy->present) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4056 (my_buddy->present == this_buddy->present &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4057 (((my_buddy->uc & UC_UNAVAILABLE) < (this_buddy->uc & UC_UNAVAILABLE)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4058 (((my_buddy->uc & UC_UNAVAILABLE) == (this_buddy->uc & UC_UNAVAILABLE)) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4059 (((my_buddy->idle == 0) && (this_buddy->idle != 0)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4060 (this_buddy->idle && (my_buddy->idle > this_buddy->idle)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4061 ((my_buddy->idle == this_buddy->idle) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4062 (cmp < 0 || (cmp == 0 && node < n))))))))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4063 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4065 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4066 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4067 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4068 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4069 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4070 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4071 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4072 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4073 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4074
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4075 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4076 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4077 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4078 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4079 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4080 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4081 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4082 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4083
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4084 static GtkTreeIter sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4085 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4086 GtkTreeIter more_z, iter;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4087 GaimBlistNode *n = NULL, *n2;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4088 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4089
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4090 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4091 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4092
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093 if(cur && (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter) == 1))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4094 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4095
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4097 for (n = node->child; n; n = n->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4098 log_size += gaim_log_get_total_size(((GaimBuddy*)(n))->name, ((GaimBuddy*)(n))->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4099 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4100 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4101 /* we don't have a reliable way of getting the log filename
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4102 * from the chat info in the blist, yet */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4103 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4104 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4105
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4106 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4107 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4108 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4109 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4110 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4111
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4112
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4113 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4114 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4115 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4116 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4117
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4118 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4119 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4120
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4121 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4122 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4123 this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4124
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4125 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4126 for (n2 = n->child; n2; n2 = n2->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4127 this_log_size += gaim_log_get_total_size(((GaimBuddy*)(n2))->name, ((GaimBuddy*)(n2))->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4128 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4129 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4130 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4131 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4132
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4133 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4134
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4135 if (!GAIM_BLIST_NODE_IS_CONTACT(n) || log_size > this_log_size ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4136 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4137 (cmp < 0 || (cmp == 0 && node < n)))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4138 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4139 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4140 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4141 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4142 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4143 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4144 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4145 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4146 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4147 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4148 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4149
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4150 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4151 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4152 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4153 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4154 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4155 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4156 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4157 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4161 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4162 proto_act(GtkObject *obj, struct proto_actions_menu *pam)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4163 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4164 if (pam->callback && pam->gc)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4165 pam->callback(pam->gc);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4166 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4167
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4168 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4169 gaim_gtk_blist_update_protocol_actions(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4170 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4171 GtkWidget *menuitem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4172 GtkWidget *submenu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4173 GaimPluginProtocolInfo *prpl_info = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4174 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 GList *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4176 struct proto_actions_menu *pam;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4177 GaimConnection *gc = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4178 int count = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4179 char buf[256];
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4181 if (!protomenu)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4182 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4183
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4184 for (l = gtk_container_get_children(GTK_CONTAINER(protomenu));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4185 l != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4186 l = l->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4187
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4188 menuitem = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4189 pam = g_object_get_data(G_OBJECT(menuitem), "proto_actions_menu");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4190
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4191 if (pam)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4192 g_free(pam);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4193
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4194 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4195 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4196
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4197 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4198 gc = c->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4199
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4200 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4201
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4202 if (prpl_info->actions && gc->login_time)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4203 count++;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4204 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4205
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4206 if (!count) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4207 g_snprintf(buf, sizeof(buf), _("No actions available"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4208 menuitem = gtk_menu_item_new_with_label(buf);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4209 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4210 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4211 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4212 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4213
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4214 if (count == 1) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4215 GList *act;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4216
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4217 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4218 gc = c->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4219
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4220 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4221
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4222 if (prpl_info->actions && gc->login_time)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4223 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4224 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4225
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4226 for (act = prpl_info->actions(gc); act != NULL; act = act->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4227 if (act->data) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4228 struct proto_actions_menu *pam = act->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4229 menuitem = gtk_menu_item_new_with_label(pam->label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4230 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4231 g_signal_connect(G_OBJECT(menuitem), "activate",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4232 G_CALLBACK(proto_act), pam);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4233 g_object_set_data(G_OBJECT(menuitem), "proto_actions_menu", pam);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4234 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4235 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4236 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4237 gaim_separator(protomenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4238 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4239 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4240 else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4241 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4242 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4243 GList *act;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4244 GdkPixbuf *pixbuf, *scale;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4245 GtkWidget *image;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4246
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4247 gc = c->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4248
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4249 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4250
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4251 if (!prpl_info->actions || !gc->login_time)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4252 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4253
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4254 account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4255
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4256 g_snprintf(buf, sizeof(buf), "%s (%s)",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4257 gaim_account_get_username(account),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4258 gc->prpl->info->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4259
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4260 menuitem = gtk_image_menu_item_new_with_label(buf);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4261
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4262 pixbuf = create_prpl_icon(gc->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4263 if(pixbuf) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4264 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4265 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4266 image = gtk_image_new_from_pixbuf(scale);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4267 g_object_unref(G_OBJECT(pixbuf));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4268 g_object_unref(G_OBJECT(scale));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4269 gtk_widget_show(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4270 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271 image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4272 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4273
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4274 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4275 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4276
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4277 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4279 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4280
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4281 for (act = prpl_info->actions(gc); act != NULL; act = act->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4282 if (act->data) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4283 struct proto_actions_menu *pam = act->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4284 menuitem = gtk_menu_item_new_with_label(pam->label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4285 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4286 g_signal_connect(G_OBJECT(menuitem), "activate",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4287 G_CALLBACK(proto_act), pam);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4288 g_object_set_data(G_OBJECT(menuitem), "proto_actions_menu",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4289 pam);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4290 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4291 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4292 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4293 gaim_separator(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4294 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4295 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4296 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4297 }