annotate src/gtkblist.c @ 9709:4d05b6e9e9cd

[gaim-migrate @ 10570] This patch is freaking massive. Renamed ui.h to gtkdialogs.h Renamed dialogs.c to gtkdialogs.c sed'ed the hell out of the .po files These files are similar to gtkutil.c/.h. They are meant to contain dialogs such as the "New Instant Message" window, which does not belong in gtkblist.c or gtkconv.c, and is called from both places. Eventually the functions in gtkdialogs.c/.h should be changed to conform to Gaim's naming convention. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 08 Aug 2004 00:48:19 +0000
parents 882e7e423457
children b0ddfeccb9e6
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"
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
26 #include "connection.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
27 #include "core.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
28 #include "debug.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
29 #include "multi.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
30 #include "notify.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
31 #include "prpl.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
32 #include "prefs.h"
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
33 #include "plugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
34 #include "request.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
35 #include "signals.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
36 #include "sound.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
37 #include "stock.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
38 #include "util.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
39
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
40 #include "gtkaccount.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
41 #include "gtkblist.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
42 #include "gtkconv.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
43 #include "gtkdebug.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9686
diff changeset
44 #include "gtkdialogs.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
45 #include "gtkft.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
46 #include "gtklog.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
47 #include "gtkpounce.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
48 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
49 #include "gtkprivacy.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
50 #include "gtkroomlist.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
51 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
52
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
53 #include "gaim.h"
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
57 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
58
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
59 #if (GTK_CHECK_VERSION(2,2,0) && !(defined(__APPLE__) && defined(__MACH__)))
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
60 #define WANT_DROP_SHADOW
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
61 #endif
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
62
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
63 typedef struct
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 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
66
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
67 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
68 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
69 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
70 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71 GtkWidget *account_box;
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 } GaimGtkAddBuddyData;
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 typedef struct
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 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
78
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
79 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84 GtkSizeGroup *sg;
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 GList *entries;
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 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
89
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
90 typedef struct
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
91 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
92 GaimAccount *account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
93
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
94 GtkWidget *window;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
95 GtkWidget *account_menu;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
96 GtkWidget *entries_box;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
97 GtkSizeGroup *sg;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
98
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
99 GList *entries;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
100 } GaimGtkJoinChatData;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
101
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
102
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
103 static GtkWidget *protomenu = NULL, *pluginmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
105 GSList *gaim_gtk_blist_sort_methods = NULL;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
106 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
107 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
108
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
109 /* 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
110 * 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
111 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
112 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
113 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
114 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
115 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
116 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 /* part of the best damn Docklet code this side of Tahiti */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 static gboolean gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 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
122 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
123 static char *gaim_get_tooltip_text(GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 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
125 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
126 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
127 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
128
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
129 static void show_rename_group(GtkWidget *unused, GaimGroup *g);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
130
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
131 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
132 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
133 gboolean contact_expanded;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
134 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
135
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
136 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
137 /**************************** Weird drop shadow stuff *******************/
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
138 /* 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
139
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
140 enum side {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
141 EAST_SIDE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
142 SOUTH_SIDE
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
143 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
144
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
145 const double shadow_strip_l[5] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
146 .937, .831, .670, .478, .180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
147 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
148
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
149 const double bottom_left_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
150 1.00, .682, .423, .333, .258,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
151 1.00, .898, .800, .682, .584,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
152 1.00, .937, .874, .800, .737,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
153 1.00, .968, .937, .898, .866,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
154 1.00, .988, .976, .960, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
155 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
156
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
157 const double bottom_right_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
158 .258, .584, .737, .866, .945,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
159 .584, .682, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
160 .737, .800, .874, .937, .976,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
161 .866, .898, .937, .968, .988,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
162 .945, .960, .976, .988, .996
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
163 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
164
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
165 const double top_right_corner[25] = {
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
166 1.00, 1.00, 1.00, 1.00, 1.00,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
167 .686, .898, .937, .968, .988,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
168 .423, .803, .874, .937, .976,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
169 .333, .686, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
170 .258, .584, .737, .866, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
171 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
172
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
173 const double top_left_corner[25] = {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
174 .988, .968, .937, .898, .498,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
175 .976, .937, .874, .803, .423,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
176 .960, .898, .800, .686, .333,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
177 .945, .866, .737, .584, .258,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
178 .941, .847, .698, .521, .215
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
179 };
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
181
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
182 static GdkPixbuf *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
183 get_pixbuf (GtkWidget *menu,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
184 int x,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
185 int y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
186 int width,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
187 int height)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
188 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
189 GdkPixbuf *dest, *src;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
190 GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET(menu));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
191 GdkWindow *root = gdk_screen_get_root_window (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
192 gint screen_height = gdk_screen_get_height (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
193 gint screen_width = gdk_screen_get_width (screen);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
194 gint original_width = width;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
195 gint original_height = height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
196
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
197 #ifdef _WIN32
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
198 /* 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
199 (including the taskbar) and uses that region as the screen size.
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
200 GTK returns positions based on a screen size that ignores these
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
201 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
202 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
203 and adjust the pixmaps we grab accordingly. GDK will not deal
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
204 with toolbar position updates, so we're stuck restarting Gaim
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
205 if that happens. */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
206 RECT *workarea = g_malloc(sizeof(RECT));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
207 SystemParametersInfo(SPI_GETWORKAREA, 0, (void *)workarea, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
208 x += (workarea->left);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
209 y += (workarea->top);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
210 g_free(workarea);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
211 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
212
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
213 if (x < 0)
7620
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 width += x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
216 x = 0;
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
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
219 if (y < 0)
7620
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 height += y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
222 y = 0;
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
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
225 if (x + width > screen_width)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
226 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
227 width = screen_width - x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
228 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
229
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
230 if (y + height > screen_height)
7620
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 height = screen_height - y;
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 if (width <= 0 || height <= 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
236 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
237
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
238 dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
239 original_width, original_height);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
240 src = gdk_pixbuf_get_from_drawable (NULL, root, NULL, x, y, 0, 0,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
241 width, height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
242 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
243
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
244 g_object_unref (G_OBJECT (src));
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
245
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
246 return dest;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
247 }
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 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
250 shadow_paint(GaimGtkBuddyList *blist, GdkRectangle *area, enum side shadow)
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 gint width, height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
253 GdkGC *gc = gtkblist->tipwindow->style->black_gc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
254
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
255 switch (shadow)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
256 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
257 case EAST_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
258 if (gtkblist->east != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
259 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
260 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
261 gdk_gc_set_clip_rectangle (gc, area);
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 width = gdk_pixbuf_get_width (gtkblist->east);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
264 height = gdk_pixbuf_get_height (gtkblist->east);
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 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->east_shadow), gc,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
267 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
268 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
269
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
270 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
271 gdk_gc_set_clip_rectangle (gc, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
272 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
273 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
274 case SOUTH_SIDE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
275 if (blist->south != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
276 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
277 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
278 gdk_gc_set_clip_rectangle (gc, area);
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 width = gdk_pixbuf_get_width (gtkblist->south);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
281 height = gdk_pixbuf_get_height (gtkblist->south);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
282 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->south_shadow), gc, gtkblist->south,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
283 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
284
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
285 if (area)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
286 gdk_gc_set_clip_rectangle (gc, NULL);
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 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
289 default:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
290 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
291 }
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
294 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
295 pixbuf_add_shadow (GdkPixbuf *pb,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
296 enum side shadow)
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 gint width, rowstride, height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
299 gint i;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
300 guchar *pixels, *p;
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 width = gdk_pixbuf_get_width (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
303 height = gdk_pixbuf_get_height (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
304 rowstride = gdk_pixbuf_get_rowstride (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
305 pixels = gdk_pixbuf_get_pixels (pb);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
306
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
307 switch (shadow)
7620
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 case EAST_SIDE:
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
310 if (height > 5)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
311 {
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
312 for (i = 0; i < width; i++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
313 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
314 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
315
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
316 p = pixels + (i * rowstride);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
317 for (j = 0, k = 0; j < 3 * width; j += 3, k++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
318 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
319 p[j] = (guchar) (p[j] * top_right_corner [i * width + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
320 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
321 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
322 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
323 }
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 i = 5;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
326 }
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
327 else
7620
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 i = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
330 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
331
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
332 for (;i < height; i++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
333 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
334 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
335
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
336 p = pixels + (i * rowstride);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
337 for (j = 0, k = 0; j < 3 * width; j += 3, k++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
338 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
339 p[j] = (guchar) (p[j] * shadow_strip_l[width - 1 - k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
340 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
341 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
342 }
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 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
345
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
346 case SOUTH_SIDE:
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
347 for (i = 0; i < height; i++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
348 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
349 gint j, k;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
350
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
351 p = pixels + (i * rowstride);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
352 for (j = 0, k = 0; j < 3 * height; j += 3, k++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
353 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
354 p[j] = (guchar) (p[j] * bottom_left_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
355 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
356 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
357 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
358
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
359 p = pixels + (i * rowstride) + 3 * height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
360 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
361 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
362 p[j] = (guchar) (p[j] * bottom_right_corner [i * height]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
363 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
364 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
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 p = pixels + (i * rowstride) + ((width * 3) - (3 * height));
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
368 for (j = 0, k = 0; j < 3 * height; j += 3, k++)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
369 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
370 p[j] = (guchar) (p[j] * bottom_right_corner[i * height + k]);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
371 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
372 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
373 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
374 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
375 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
376
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
377 default:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
378 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
379 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
380 }
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 static gboolean
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
383 map_shadow_windows (gpointer data)
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 GaimGtkBuddyList *blist = (GaimGtkBuddyList*)data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
386 GtkWidget *widget = blist->tipwindow;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
387 GdkPixbuf *pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
388 int x, y;
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 gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
391 pixbuf = get_pixbuf (widget,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
392 x + widget->allocation.width, y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
393 5, widget->allocation.height + 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
394 if (pixbuf != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
395 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
396 pixbuf_add_shadow (pixbuf, EAST_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
397 if (blist->east != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
398 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
399 g_object_unref (G_OBJECT (blist->east));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
400 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
401 blist->east = pixbuf;
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
404 pixbuf = get_pixbuf (widget,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
405 x, y + widget->allocation.height,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
406 widget->allocation.width + 5, 5);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
407 if (pixbuf != NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
408 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
409 pixbuf_add_shadow (pixbuf, SOUTH_SIDE);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
410 if (blist->south != NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
411 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
412 g_object_unref (G_OBJECT (blist->south));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
413 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
414 blist->south = pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
415 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
416
9686
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
417 gdk_window_move_resize (blist->east_shadow,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
418 x + widget->allocation.width, MAX(0,y),
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
419 5, MIN(widget->allocation.height, gdk_screen_height()));
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
420
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
421 gdk_window_move_resize (blist->south_shadow,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
422 MAX(0,x), y + widget->allocation.height,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
423 MIN(widget->allocation.width + 5, gdk_screen_width()), 5);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
424
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
425 gdk_window_show (blist->east_shadow);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
426 gdk_window_show (blist->south_shadow);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
427 shadow_paint(blist, NULL, EAST_SIDE);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
428 shadow_paint(blist, NULL, SOUTH_SIDE);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
429
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
430 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
431 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
432
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
433 /**************** END WEIRD DROP SHADOW STUFF ***********************************/
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
434 #endif
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
435
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
436 static GSList *blist_prefs_callbacks = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
437
5228
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 * Callbacks *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
440 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
441
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
442 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
443 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
444 if (docklet_count)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 gaim_blist_set_visible(FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 else
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
447 gaim_core_quit();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
451 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 * 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
457 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
458 * 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
459 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
460 gint x, y;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
461
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
462 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
464 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
466 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
467 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
468
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
469 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
470 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
471 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
472 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
473 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
474
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
475 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
476 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
477
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
478 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
479 if (x + event->width < 0 ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
480 y + event->height < 0 ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
481 x > gdk_screen_width() ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
482 y > gdk_screen_height()) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
483
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
484 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
485 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
486
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
487 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
488 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
489 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
490 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
491 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
492
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
493 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
494 return FALSE;
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
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
498 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
499 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 gaim_gtk_blist_obscured = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
506 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
507
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
508 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
509 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
510 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
511 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
513 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 {
9640
bc2079a32fd9 [gaim-migrate @ 10488]
Mark Doliner <mark@kingant.net>
parents: 9632
diff changeset
515 gaim_gtkdialogs_new_im(b->account, b->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
516 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
518 static void gtk_blist_menu_send_file_cb(GtkWidget *w, GaimBuddy *b)
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
519 {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
520 serv_send_file(b->account->gc, b->name, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
521 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
522
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
523 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
524 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
525 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
526 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
527 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
528
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
529 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
530 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
531 serv_join_chat(chat->account->gc, chat->components);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
532 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
533
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
534 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
535 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
536 if(GAIM_BLIST_NODE_IS_BUDDY(node))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
537 alias_dialog_bud((GaimBuddy*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
538 else if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
539 alias_dialog_contact((GaimContact*)node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
540 else if(GAIM_BLIST_NODE_IS_CHAT(node))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
541 alias_dialog_blist_chat((GaimChat*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
542 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
543
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
544 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
545 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
546 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
547 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
548
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
549 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBuddy *b)
5228
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 gaim_gtk_log_show(b->name, b->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
552 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
553
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
554 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
555 {
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8470
diff changeset
556 gaim_gtk_syslog_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
557 }
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 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
560 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
561 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
562 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
563
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
564 static void gtk_blist_button_im_cb(GtkWidget *w, GtkTreeView *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 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
567 GtkTreeModel *model = gtk_tree_view_get_model(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
568 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
569
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
570 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
571 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
572
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
573 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
574 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
9640
bc2079a32fd9 [gaim-migrate @ 10488]
Mark Doliner <mark@kingant.net>
parents: 9632
diff changeset
575 gaim_gtkdialogs_new_im(((GaimBuddy*)node)->account, ((GaimBuddy*)node)->name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
576 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
577 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
578 GaimBuddy *buddy =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
579 gaim_contact_get_priority_buddy((GaimContact*)node);
9640
bc2079a32fd9 [gaim-migrate @ 10488]
Mark Doliner <mark@kingant.net>
parents: 9632
diff changeset
580 gaim_gtkdialogs_new_im(buddy->account, buddy->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
581 return;
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 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
584 show_im_dialog();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
585 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
586
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
587 static void gtk_blist_button_info_cb(GtkWidget *w, GtkTreeView *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 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
590 GtkTreeModel *model = gtk_tree_view_get_model(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
591 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
592
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
593 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
594 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
595
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
596 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
597 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
598 serv_get_info(((GaimBuddy*)node)->account->gc, ((GaimBuddy*)node)->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
599 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
600 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
601 GaimBuddy *buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
602 serv_get_info(buddy->account->gc, buddy->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
603 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
604 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
605 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
606 show_info_dialog();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
607 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
608
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
609 static void
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
610 do_join_chat(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
611 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
612 if (data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
613 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
614 GHashTable *components =
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
615 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
616 GList *tmp;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
617
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
618 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
619 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
620 if (g_object_get_data(tmp->data, "is_spin"))
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
621 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
622 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
623 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
624 g_strdup_printf("%d",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
625 gtk_spin_button_get_value_as_int(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
626 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
627 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
628 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
629 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
630 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
631 g_strdup(gtk_entry_get_text(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
632 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
633 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
634
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
635 serv_join_chat(gaim_account_get_connection(data->account), components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
636
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
637 g_hash_table_destroy(components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
638 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
639 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
640
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
641 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
642 do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
643 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
644 switch(id)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
645 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
646 case GTK_RESPONSE_OK:
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
647 do_join_chat(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
648
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
649 break;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
650 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
651
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
652 gtk_widget_destroy(GTK_WIDGET(dialog));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
653 g_list_free(info->entries);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
654 g_free(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
655 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
656
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
657 static void
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
658 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
659 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
660 GaimConnection *gc;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
661 GList *list, *tmp;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
662 struct proto_chat_entry *pce;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
663 gboolean focus = TRUE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
664
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
665 gc = gaim_account_get_connection(data->account);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
666
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
667 while (GTK_BOX(data->entries_box)->children)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
668 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
669 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
670 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
671 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
672
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
673 if (data->entries != NULL)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
674 g_list_free(data->entries);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
675
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
676 data->entries = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
677
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
678 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
679
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
680 for (tmp = list; tmp; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
681 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
682 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
683 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
684
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
685 pce = tmp->data;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
686
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
687 rowbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
688 gtk_box_pack_start(GTK_BOX(data->entries_box), rowbox, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
689
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
690 label = gtk_label_new_with_mnemonic(pce->label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
691 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
692 gtk_size_group_add_widget(data->sg, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
693 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
694
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
695 if (pce->is_int)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
696 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
697 GtkObject *adjust;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
698 GtkWidget *spin;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
699 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
700 1, 10, 10);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
701 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
702 g_object_set_data(G_OBJECT(spin), "is_spin",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
703 GINT_TO_POINTER(TRUE));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
704 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
705 data->entries = g_list_append(data->entries, spin);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
706 gtk_widget_set_size_request(spin, 50, -1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
707 gtk_box_pack_end(GTK_BOX(rowbox), spin, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
708 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(spin));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
709 gaim_set_accessible_label (spin, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
710 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
711 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
712 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
713 GtkWidget *entry = gtk_entry_new();
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
714
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
715 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
716 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
717 data->entries = g_list_append(data->entries, entry);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
718
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
719 if (pce->def)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
720 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
721
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
722 if (focus)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
723 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
724 gtk_widget_grab_focus(entry);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
725 focus = FALSE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
726 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
727
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
728 if (pce->secret)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
729 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
730
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
731 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
732 gtk_label_set_mnemonic_widget(GTK_LABEL(label), GTK_WIDGET(entry));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
733 gaim_set_accessible_label (entry, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
734 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
735
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
736 g_free(pce);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
737 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
738
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
739 g_list_free(list);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
740
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
741 gtk_widget_show_all(data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
742 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
743
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
744 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
745 joinchat_select_account_cb(GObject *w, GaimAccount *account,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
746 GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
747 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
748 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
749 gaim_account_get_protocol_id(account)) == 0)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
750 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
751 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
752 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
753 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
754 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
755 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
756 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
757 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
758 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
759
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
760 static gboolean
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
761 joinchat_account_filter_func(GaimAccount *account)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
762 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
763 GaimConnection *gc = gaim_account_get_connection(account);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
764 GaimPluginProtocolInfo *prpl_info = NULL;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
765
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
766 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
767
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
768 return (prpl_info->chat_info != NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
769 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
770
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
771 gboolean
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
772 gaim_gtk_blist_joinchat_is_showable()
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
773 {
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
774 GList *c;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
775 GaimConnection *gc;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
776
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
777 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
778 gc = c->data;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
779
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
780 if (joinchat_account_filter_func(gaim_connection_get_account(gc)))
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
781 return TRUE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
782 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
783
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
784 return FALSE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
785 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
786
8305
57bdd25752c1 [gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents: 8303
diff changeset
787 void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
788 gaim_gtk_blist_joinchat_show(void)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
789 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
790 GtkWidget *hbox, *vbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
791 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
792 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
793 GaimGtkBuddyList *gtkblist;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
794 GtkWidget *img = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
795 GaimGtkJoinChatData *data = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
796
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
797 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
798 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
799 GTK_ICON_SIZE_DIALOG);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
800 data = g_new0(GaimGtkJoinChatData, 1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
801
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
802 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
803 NULL, GTK_DIALOG_NO_SEPARATOR,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
804 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8305
diff changeset
805 GAIM_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
806 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
807 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
808 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
809 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
810 gtk_container_set_border_width(
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
811 GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6);
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
812 gtk_window_set_role(GTK_WINDOW(data->window), "join_chat");
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
813
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
814 hbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
815 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
816 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
817 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
818
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
819 vbox = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
820 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
821 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
822
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
823 label = gtk_label_new(_("Please enter the appropriate information "
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
824 "about the chat you would like to join.\n"));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
825 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
826 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
827 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
828
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
829 rowbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
830 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
831
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
832 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
833
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
834 label = gtk_label_new_with_mnemonic(_("_Account:"));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
835 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
836 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
837 gtk_size_group_add_widget(data->sg, label);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
838
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
839 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE,
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
840 G_CALLBACK(joinchat_select_account_cb),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
841 joinchat_account_filter_func, data);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
842 gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
843 gtk_label_set_mnemonic_widget(GTK_LABEL(label),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
844 GTK_WIDGET(data->account_menu));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
845 gaim_set_accessible_label (data->account_menu, label);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
846
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
847 data->entries_box = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
848 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
849 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
850
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
851 data->account = gaim_gtk_account_option_menu_get_selected(data->account_menu);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
852
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
853 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
854
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
855 g_signal_connect(G_OBJECT(data->window), "response",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
856 G_CALLBACK(do_joinchat), data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
857
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
858 g_object_unref(data->sg);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
859
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
860 gtk_widget_show_all(data->window);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
861 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
862
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
863 static void gtk_blist_button_chat_cb(GtkWidget *w, GtkTreeView *tv)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
864 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
865 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
866 GtkTreeModel *model = gtk_tree_view_get_model(tv);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
867 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
868
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
869 if(gtk_tree_selection_get_selected(sel, &model, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
870 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
871
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
872 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
873 if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
874 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
875 return;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
876 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
877 }
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
878 gaim_gtk_blist_joinchat_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
881 static void gtk_blist_button_away_cb(GtkWidget *w, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
882 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
883 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
884 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
885
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
886 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
887 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
888 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
889
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
890 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
891
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
892 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
893
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
894 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
895 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
896 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
897 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
898
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
899 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
900 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
901 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
902
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
903 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
904
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
905 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
906
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
907 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
908 gaim_blist_node_set_bool(node, "collapsed", TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
909 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
910 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
911 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
912 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
913
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
914 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
915 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
916 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
917 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
918
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
919 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
920
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
921 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
922 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
923
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
924 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
925 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
926
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
927 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
928 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
929 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
930 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
931
9640
bc2079a32fd9 [gaim-migrate @ 10488]
Mark Doliner <mark@kingant.net>
parents: 9632
diff changeset
932 gaim_gtkdialogs_new_im(buddy->account, buddy->name);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
933 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
934 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
935 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
936 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
937 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
938 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
939 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
940 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
941 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
942
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
943 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
944 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
945 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
946 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
947 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
948
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
949 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
950 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
951 if (GAIM_BLIST_NODE_IS_BUDDY(node))
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
952 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
953 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
954 gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
955 else if (GAIM_BLIST_NODE_IS_GROUP(node))
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
956 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
957 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
958 else {
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
959 gaim_blist_request_add_chat(NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
960 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
961 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
962
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
963 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
964 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
965 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
966 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
967 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
968
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
969 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
970 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
971 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
972 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
973 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
974 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
975 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
976 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
977 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
978 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
979 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
980 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
981 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
982 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
983 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
984 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
985
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
986 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
987 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
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 (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
990 show_confirm_del((GaimBuddy*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
991 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
992 show_confirm_del_blist_chat((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
993 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
994 show_confirm_del_group((GaimGroup*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
995 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
996 show_confirm_del_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
997 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
998 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
999
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1000 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1001 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1002 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1003 struct _gaim_gtk_blist_node *gtknode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1004 GtkTreeIter iter, parent;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1005 GaimBlistNode *bnode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1006 GtkTreePath *path;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1007
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1008 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1009 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1010
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1011 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1012
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1013 gtknode->contact_expanded = TRUE;
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 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1016 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1017 }
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1018
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1019 /* This ensures that the bottom buddy is visible, i.e. not scrolled off the alignment */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1020 get_iter_from_node(node, &parent);
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1021 gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent,
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1022 gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &parent) -1);
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1023 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1024 /* Let the treeview draw so it knows where to scroll */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1025 while (gtk_events_pending())
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1026 gtk_main_iteration();
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1027 gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0);
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1028
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1029
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1030 gaim_gtk_blist_update(NULL, node);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1031 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1032 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1033
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1034 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1035 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1036 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1037 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1038 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1039
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1040 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1041 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1042
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1043 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1044
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1045 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1046
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1047 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1048 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1049 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1050 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1051
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1052
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1053 static void
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1054 blist_node_menu_cb(GtkMenuItem *item, GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1055 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1056 GaimBlistNodeAction *act;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1057 act = (GaimBlistNodeAction *) g_object_get_data(G_OBJECT(item),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1058 "gaimcallback");
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1059 if(act->callback)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1060 act->callback(node, act->data);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1061 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1062
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1063
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1064 static void
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1065 append_blist_node_action (GtkWidget *menu, GaimBlistNodeAction *act,
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1066 GaimBlistNode *node, gboolean *dup_separator)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1067 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1068 if(act == NULL) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1069 if(! *dup_separator) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1070 gaim_separator(menu);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1071 *dup_separator = TRUE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1072 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1073 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1074 GtkWidget *menuitem;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1075
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1076 *dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1077
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1078 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1079 g_object_set_data(G_OBJECT(menuitem), "gaimcallback", act);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1080 g_signal_connect(G_OBJECT(menuitem), "activate",
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1081 G_CALLBACK(blist_node_menu_cb), node);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1082 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1083 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1084 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1085
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1086
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1087 void
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1088 gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1089 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1090 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1091 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1092 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1093
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1094 if(!prpl_info || !prpl_info->blist_node_menu)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1095 return;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1096
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1097 for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1098 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1099 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1100 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1101 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1102 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1103
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1104
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1105 void
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1106 gaim_gtk_append_blist_node_extended_menu (GtkWidget *menu, GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1107 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1108 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1109 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1110
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1111 for(l = ll = gaim_blist_node_get_extended_menu(node); l; l = l->next) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1112 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1113 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1114 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1115 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1116 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1117
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1118
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1119 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
1120 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1121 if (prpl_info && prpl_info->get_info) {
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
1122 gaim_new_item_from_stock(menu, _("Get _Info"), GAIM_STOCK_INFO,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1123 G_CALLBACK(gtk_blist_menu_info_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1124 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
1125 gaim_new_item_from_stock(menu, _("I_M"), GAIM_STOCK_IM,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1126 G_CALLBACK(gtk_blist_menu_im_cb), b, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1127 if (prpl_info && prpl_info->send_file) {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1128 if (!prpl_info->can_receive_file
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1129 || prpl_info->can_receive_file(b->account->gc, b->name)) {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1130 gaim_new_item_from_stock(menu, _("_Send File"), GAIM_STOCK_FILE_TRANSFER,
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1131 G_CALLBACK(gtk_blist_menu_send_file_cb), b, 0, 0, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1132 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1133 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1134 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1135 G_CALLBACK(gtk_blist_menu_bp_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1136 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1137 G_CALLBACK(gtk_blist_menu_showlog_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1138
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1139 gaim_gtk_append_blist_node_proto_menu(menu, b->account->gc, (GaimBlistNode *) b);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1140 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *) b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1141
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1142 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1143
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1144 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1145 G_CALLBACK(gtk_blist_menu_alias_cb), b, 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1146 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1147 G_CALLBACK(gaim_gtk_blist_remove_cb), b,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1148 0, 0, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1149 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1150
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1151 static gboolean gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1152 gpointer null)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1153 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1154 GaimBlistNode *node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1155 GValue val = { 0, };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1156 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1157 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1158
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1159 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1160 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1161 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1162
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1163 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1164 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1165 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1166
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1167 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1168 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1169 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1170
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1171 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1172 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1173 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1174 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1175 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1176 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1177 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1178 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1179 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1180 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1181
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1182 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1183 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1184
9013
d494fd1bd90b [gaim-migrate @ 9789]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
1185
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1186 static GtkWidget *
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1187 create_group_menu (GaimBlistNode *node, GaimGroup *g)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1188 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1189 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1190
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1191 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1192 gaim_new_item_from_stock(menu, _("Add a _Buddy"), GTK_STOCK_ADD,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1193 G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1194 gaim_new_item_from_stock(menu, _("Add a C_hat"), GTK_STOCK_ADD,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1195 G_CALLBACK(gaim_gtk_blist_add_chat_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1196 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1197 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1198 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1199 G_CALLBACK(show_rename_group), node, 0, 0, NULL);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1200
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1201 gaim_gtk_append_blist_node_extended_menu(menu, node);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1202
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1203 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1204 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1205
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1206
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1207 static GtkWidget *
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1208 create_chat_menu (GaimBlistNode *node,
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1209 GaimChat *c,
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1210 GaimPlugin *prpl,
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1211 GaimPluginProtocolInfo *prpl_info)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1212 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1213 GtkWidget *menu;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1214 gboolean autojoin;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1215
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1216 menu = gtk_menu_new();
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1217 autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1218 (gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1219
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1220 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1221 G_CALLBACK(gtk_blist_menu_join_cb), node, 0, 0, NULL);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1222 gaim_new_check_item(menu, _("Auto-Join"),
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1223 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1224
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1225 gaim_gtk_append_blist_node_proto_menu(menu, c->account->gc, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1226 gaim_gtk_append_blist_node_extended_menu(menu, node);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1227
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1228 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1229
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1230 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1231 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1232 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1233 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1234
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1235 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1236 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1237
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1238 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1239 create_contact_menu (GaimBlistNode *node)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1240 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1241 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1242
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1243 menu = gtk_menu_new();
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1244 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1245 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1246 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1247 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1248 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1249 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1250 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1251
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1252 gaim_gtk_append_blist_node_extended_menu(menu, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1253
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1254 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1255 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1256
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1257 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1258 create_buddy_menu (GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1259 GaimBuddy *b,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1260 GaimPlugin *prpl,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1261 GaimPluginProtocolInfo *prpl_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1262 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1263 struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1264 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1265 GtkWidget *menuitem;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1266 gboolean show_offline = gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies");
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1267
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1268 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1269 make_buddy_menu(menu, prpl_info, b);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1270
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1271 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1272 gaim_separator(menu);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1273
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1274 if(gtknode->contact_expanded) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1275 gaim_new_item_from_stock(menu, _("_Collapse"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1276 GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1277 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1278 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1279 } else {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1280 gaim_new_item_from_stock(menu, _("_Expand"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1281 GTK_STOCK_ZOOM_IN,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1282 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1283 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1284 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1285 if(node->child->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1286 GaimBlistNode *bnode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1287
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1288 for(bnode = node->child; bnode; bnode = bnode->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1289 GaimBuddy *buddy = (GaimBuddy*)bnode;
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1290 GdkPixbuf *buf;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1291 GtkWidget *submenu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1292 GtkWidget *image;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1293
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1294 if(buddy == b)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1295 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1296 if(!buddy->account->gc)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1297 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1298 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1299 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1300
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1301 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1302 buf = gaim_gtk_blist_get_status_icon(bnode,
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1303 GAIM_STATUS_ICON_SMALL);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1304 image = gtk_image_new_from_pixbuf(buf);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1305 g_object_unref(G_OBJECT(buf));
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1306 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1307 image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1308 gtk_widget_show(image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1309 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1310 gtk_widget_show(menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1311
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1312 submenu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1313 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1314 gtk_widget_show(submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1315
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1316 prpl = gaim_find_prpl(gaim_account_get_protocol_id(buddy->account));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1317 prpl_info = prpl ? GAIM_PLUGIN_PROTOCOL_INFO(prpl) : NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1318
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1319 make_buddy_menu(submenu, prpl_info, buddy);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1320 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1321 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1322 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1323 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1324 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1325
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1326 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1327 gaim_gtk_blist_show_context_menu(GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1328 GtkMenuPositionFunc func,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1329 GtkWidget *tv,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1330 guint button,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1331 guint32 time)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1332 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1333 struct _gaim_gtk_blist_node *gtknode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1334 GtkWidget *menu = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1335 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1336
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1337 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1338
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1339 /* Create a menu based on the thing we right-clicked on */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1340 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1341 GaimGroup *g = (GaimGroup *)node;
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1342 menu = create_group_menu(node, g);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1343 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1344 GaimChat *c = (GaimChat *)node;
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1345 GaimPlugin *prpl = NULL;
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1346 GaimPluginProtocolInfo *prpl_info = NULL;
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1347 prpl = gaim_find_prpl(gaim_account_get_protocol_id(c->account));
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1348 if (prpl != NULL)
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1349 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1350 menu = create_chat_menu(node, c, prpl, prpl_info);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1351 } else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1352 menu = create_contact_menu(node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1353 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1354 GaimBuddy *b;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1355 GaimPlugin *prpl = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1356 GaimPluginProtocolInfo *prpl_info = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1357
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1358 if (GAIM_BLIST_NODE_IS_CONTACT(node))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1359 b = gaim_contact_get_priority_buddy((GaimContact*)node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1360 else
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1361 b = (GaimBuddy *)node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1362
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1363 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1364 if (prpl != NULL)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1365 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1366 menu = create_buddy_menu(node, b, prpl, prpl_info);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1367 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1368
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1369 /* Now display the menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1370 if (menu != NULL) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1371 gtk_widget_show_all(menu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1372 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, func, tv, button, time);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1373 handled = TRUE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1374 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1375
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1376 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1377 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1378
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1379 static gboolean gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1380 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1381 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1382 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1383 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1384 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1385 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1386 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1387 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1388 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1389 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1390
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1391 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1392 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
1393 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1394 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1395 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1396 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1397 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1398
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1399 /* Right click draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1400 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1401 handled = gaim_gtk_blist_show_context_menu(node, NULL, tv, 3, event->time);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1402
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1403 /* CTRL+middle click expands or collapse a contact */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1404 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1405 (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1406 if (gtknode->contact_expanded)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1407 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1408 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1409 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1410 handled = TRUE;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1411
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1412 /* Double middle click gets info */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1413 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1414 ((GAIM_BLIST_NODE_IS_CONTACT(node)) || (GAIM_BLIST_NODE_IS_BUDDY(node)))) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1415 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1416 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1417 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1418 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1419 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1420
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1421 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1422 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1423 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1424
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1425 if (prpl && prpl_info->get_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1426 serv_get_info(b->account->gc, b->name);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1427 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1428 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1429
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1430 #if (1)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1431 /*
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1432 * This code only exists because GTK doesn't work. If we return
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1433 * FALSE here, as would be normal the event propoagates down and
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1434 * somehow gets interpreted as the start of a drag event.
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1435 *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1436 * Um, isn't it _normal_ to return TRUE here? Since the event
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1437 * was handled? --Mark
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1438 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1439 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1440 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1441 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1442 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1443 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1444 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1445 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1446 gtk_tree_path_free(path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1447
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1448 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1449 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1450
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1451 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1452 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1453 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1454 GaimBlistNode *node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1455 GValue val = { 0, };
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1456 GtkTreeIter iter;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1457 GtkTreeSelection *sel;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1458 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1459
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1460 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1461 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1462 return FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1463
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1464 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1465 &iter, NODE_COLUMN, &val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1466 node = g_value_get_pointer(&val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1467
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1468 /* Shift+F10 draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1469 handled = gaim_gtk_blist_show_context_menu(node, gaim_gtk_treeview_popup_menu_position_func, tv, 0, GDK_CURRENT_TIME);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1470
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1471 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1472 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1473
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1474 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
1475 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1476 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1477 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1478 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1479
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1480 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
1481 GtkWidget *checkitem) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1482 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1483 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1484 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1485 while (gtk_events_pending())
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1486 gtk_main_iteration();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1487 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1488 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1489
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1490 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1491 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1492
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1493 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1494 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1495 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1496 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1497 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1498 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1499
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1500 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1501 add_buddies_from_vcard(const char *prpl_id, GaimGroup *group, GList *list,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1502 const char *alias)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1503 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1504 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1505 GaimAccount *account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1506 GaimConnection *gc;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1507
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1508 if (list == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1509 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1510
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1511 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1512 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1513 gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1514 account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1515
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1516 if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1517 break;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1518
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1519 account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1520 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1521
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1522 if (account != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1523 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1524 for (l = list; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1525 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1526 gaim_blist_request_add_buddy(account, l->data,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1527 (group ? group->name : NULL),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1528 alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1529 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1530 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1531
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1532 g_list_foreach(list, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1533 g_list_free(list);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1534 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1535
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1536 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1537 parse_vcard(const char *vcard, GaimGroup *group)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1538 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1539 char *temp_vcard;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1540 char *s, *c;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1541 char *alias = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1542 GList *aims = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1543 GList *icqs = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1544 GList *yahoos = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1545 GList *msns = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1546 GList *jabbers = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1547
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1548 s = temp_vcard = g_strdup(vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1549
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1550 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1551 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1552 char *field, *value;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1553
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1554 field = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1555
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1556 /* Grab the field */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1557 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1558 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1559
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1560 if (*s == '\r') s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1561 if (*s == '\n')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1562 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1563 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1564 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1565 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1566
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1567 if (*s != '\0') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1568
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1569 if ((c = strchr(field, ';')) != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1570 *c = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1571
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1572 /* Proceed to the end of the line */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1573 value = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1574
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1575 while (*s != '\r' && *s != '\n' && *s != '\0')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1576 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1577
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1578 if (*s == '\r') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1579 if (*s == '\n') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1580
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1581 /* We only want to worry about a few fields here. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1582 if (!strcmp(field, "FN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1583 alias = g_strdup(value);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1584 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1585 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1586 !strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1587 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1588 char **values = g_strsplit(value, ":", 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1589 char **im;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1590
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1591 for (im = values; *im != NULL; im++)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1592 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1593 if (!strcmp(field, "X-AIM"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1594 aims = g_list_append(aims, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1595 else if (!strcmp(field, "X-ICQ"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1596 icqs = g_list_append(icqs, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1597 else if (!strcmp(field, "X-YAHOO"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1598 yahoos = g_list_append(yahoos, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1599 else if (!strcmp(field, "X-MSN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1600 msns = g_list_append(msns, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1601 else if (!strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1602 jabbers = g_list_append(jabbers, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1603 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1604
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1605 g_strfreev(values);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1606 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1607 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1608
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1609 g_free(temp_vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1610
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1611 if (aims == NULL && icqs == NULL && yahoos == NULL &&
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1612 msns == NULL && jabbers == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1613 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1614 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1615 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1616
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1617 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1618 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1619
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1620 add_buddies_from_vcard("prpl-oscar", group, aims, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1621 add_buddies_from_vcard("prpl-oscar", group, icqs, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1622 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1623 add_buddies_from_vcard("prpl-msn", group, msns, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1624 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1625
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1626 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1627 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1628
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1629 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1630 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1631
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1632 static void gaim_gtk_blist_drag_data_get_cb (GtkWidget *widget,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1633 GdkDragContext *dc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1634 GtkSelectionData *data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1635 guint info,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1636 guint time,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1637 gpointer *null)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1638 {
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1639 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1640 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1641 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
1642 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1643 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1644 GaimBlistNode *node = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1645 GValue val = {0};
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1646 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1647 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1648 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1649 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
1650 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1651 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1652 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1653 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1654 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1655 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1656
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1657 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1658 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1659 else if (data->target == gdk_atom_intern("application/x-im-contact", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1660 {
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1661 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1662 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1663 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1664 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1665 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1666 GaimConnection *gc;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1667 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1668 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1669 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1670 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1671
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1672 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
1673 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1674
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1675 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1676 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1677
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1678 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1679 sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1680 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1681 NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1682
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1683 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1684
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1685 if (GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1686 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1687 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1688 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1689 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1690 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1691 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1692 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1693 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1694 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1695 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1696 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1697 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1698
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1699 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1700
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1701 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1702 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1703 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1704 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1705 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1707 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1708 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1709 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1710
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1711 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1712 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1713 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1714 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1715 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1716 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1717 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1718 buddy->name);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1719
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1720 if (buddy->alias != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1721 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1722 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1723 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1724 buddy->alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1725 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1726
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1727 str = g_string_append(str, "\r\n");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1728
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1729 mime_str = g_string_free(str, FALSE);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1730
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1731 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1732 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1733 8, /* bits */
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1734 mime_str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1735 strlen(mime_str) + 1);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1736
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1737 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1738 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1739 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1740 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1741
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1742 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
1743 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1744 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1745 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1746 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1747 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1748 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1749 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1750 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1751 /* 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
1752 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1753 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1754 GValue val = {0};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1755 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1756
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1757 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1758 &iter, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1759 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1760 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1761 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1762 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1763
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1764 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1765 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1766 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1767 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1768 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1769 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1770 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1771 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1772 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1773 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1774 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1775 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1776 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1777 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1778 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1779 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1780 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1781 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1782 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1783 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1784 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1785 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1786 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1787 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1788 GaimBuddy *b = (GaimBuddy*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1789 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1790 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1791 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1792 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1793 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1794 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1795 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1796 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1797 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1798 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1799 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1800 node->prev);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1801 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1802 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1803 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1804 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1805 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1806 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1807 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1808 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1809 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1810 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1811 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1812 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1813 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1814 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1815 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1816 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1817 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1818 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1819 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1820 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1821 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1822 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1823 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1824 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1825 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1826 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1827 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1828 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1829 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1830 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1831 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1832 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1833 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1834 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1835 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1836 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1837 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1838 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1839 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1840 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1841 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1842 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1843 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1844 (GaimGroup*)node->parent->parent, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1845 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1846 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1847 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1848 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1849 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1850 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1851 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1852 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1853 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1854 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1855 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1856 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1857 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1858 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1859 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1860 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1861 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1862 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1863 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1864 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1865 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1866 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1867 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1868 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1869 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1870 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1871 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1872 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1873 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1874 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1875 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1876 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1877 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1878 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1879 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1880 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1881 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1882 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1883 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1884 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1885 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1886 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1887 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1888
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1889 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1890 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1891 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1892 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1893 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1894 FALSE) && sd->data)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1895 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1896 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1897 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1898 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1899 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1900 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1901 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1902 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1903
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1904 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
1905 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1906 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1907 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1908 GaimBlistNode *node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1909 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1910
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1911 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1912 &iter, path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1913 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1914 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1915 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1916
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1917 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1918 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1919 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1920 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1921 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1922 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1923 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1924 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1925 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1926 else if (GAIM_BLIST_NODE_IS_GROUP(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1927 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1928 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1929 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1930 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1931
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1932 if (gaim_gtk_parse_x_im_contact(sd->data, FALSE, &account,
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1933 &protocol, &username, &alias))
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1934 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1935 if (account == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1936 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1937 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1938 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1939 "can add that buddy."), NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1940 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1941 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1942 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1943 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1944 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1945 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1946 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1947 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1948
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1949 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1950 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1951 if (alias != NULL) g_free(alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1952
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1953 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1954 gtk_tree_path_free(path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1955
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1956 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1957 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1958 else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1959 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1960 gboolean result;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1961 GaimGroup *group = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1962 GtkTreePath *path = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1963 GtkTreeViewDropPosition position;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1964
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1965 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1966 x, y, &path, &position))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1967 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1968 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1969 GaimBlistNode *node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1970 GValue val = {0};
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1971
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1972 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1973 &iter, path);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1974 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1975 &iter, NODE_COLUMN, &val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1976 node = g_value_get_pointer(&val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1977
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1978 if (GAIM_BLIST_NODE_IS_BUDDY(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1979 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1980 group = (GaimGroup *)node->parent->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1981 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1982 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1983 GAIM_BLIST_NODE_IS_CONTACT(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1984 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1985 group = (GaimGroup *)node->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1986 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1987 else if (GAIM_BLIST_NODE_IS_GROUP(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1988 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1989 group = (GaimGroup *)node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1990 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1991 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1992
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1993 result = parse_vcard(sd->data, group);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1994
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1995 gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t);
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
1996 } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) {
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1997 GtkTreePath *path = NULL;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1998 GtkTreeViewDropPosition position;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1999
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2000 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2001 x, y, &path, &position))
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2002 {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2003 GtkTreeIter iter;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2004 GaimBlistNode *node;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2005 GValue val = {0};
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2006
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2007 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2008 &iter, path);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2009 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2010 &iter, NODE_COLUMN, &val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2011 node = g_value_get_pointer(&val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2012
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2013 if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2014 GaimBuddy *b = GAIM_BLIST_NODE_IS_BUDDY(node) ? (GaimBuddy*)node : gaim_contact_get_priority_buddy((GaimContact*)node);
9670
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2015 GList *tmp;
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2016 GList *files = gaim_uri_list_extract_filenames(sd->data);
9673
906949cd7a1e [gaim-migrate @ 10525]
Luke Schierer <lschiere@pidgin.im>
parents: 9670
diff changeset
2017 for(tmp = files; tmp != NULL ; tmp = g_list_next(tmp)) {
906949cd7a1e [gaim-migrate @ 10525]
Luke Schierer <lschiere@pidgin.im>
parents: 9670
diff changeset
2018 gchar *filename = tmp->data;
9670
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2019 /* XXX - Make ft API support creating a transfer with more than one file */
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2020 if (g_file_test(filename, G_FILE_TEST_EXISTS)
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2021 && !g_file_test(filename, G_FILE_TEST_IS_DIR)) {
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2022 serv_send_file(gaim_account_get_connection(b->account), b->name, filename);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2023 }
9670
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2024 g_free(filename);
9673
906949cd7a1e [gaim-migrate @ 10525]
Luke Schierer <lschiere@pidgin.im>
parents: 9670
diff changeset
2025 }
9670
ed3bbf36de75 [gaim-migrate @ 10522]
Luke Schierer <lschiere@pidgin.im>
parents: 9658
diff changeset
2026 g_list_free(files);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2027 }
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2028 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2029 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2030 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2031
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2032 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
2033 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2034 GtkStyle *style;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2035 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
2036 PangoLayout *layout;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2037 char *tooltiptext = gaim_get_tooltip_text(node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2038
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2039 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2040 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2041
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2042 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2043 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2044 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2045 pango_layout_set_width(layout, 300000);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2046 style = gtkblist->tipwindow->style;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2047
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2048 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
2049 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2050
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2051 #if GTK_CHECK_VERSION(2,2,0)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2052 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2053 0, 0, 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2054 #else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2055 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
2056 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2057
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2058 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, TRUE,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2059 NULL, gtkblist->tipwindow, "tooltip", 38, 4, layout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2060
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2061 g_object_unref (pixbuf);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2062 g_object_unref (layout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2063 g_free(tooltiptext);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2064
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2065 #ifdef WANT_DROP_SHADOW
8040
7c252b4bfbda [gaim-migrate @ 8724]
Nathan Walp <nwalp@pidgin.im>
parents: 8022
diff changeset
2066 shadow_paint(gtkblist, NULL, EAST_SIDE);
7c252b4bfbda [gaim-migrate @ 8724]
Nathan Walp <nwalp@pidgin.im>
parents: 8022
diff changeset
2067 shadow_paint(gtkblist, NULL, SOUTH_SIDE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2068 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2069
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2070 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2071 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2072
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2073 static void gaim_gtk_blist_tooltip_destroy()
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2074 {
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2075 if (gtkblist->tipwindow == NULL)
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2076 return;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2077
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2078 gtk_widget_destroy(gtkblist->tipwindow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2079 gtkblist->tipwindow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2080 #ifdef WANT_DROP_SHADOW
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2081 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2082 gdk_window_destroy (gtkblist->east_shadow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2083 gtkblist->east_shadow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2084
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2085 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2086 gdk_window_destroy (gtkblist->south_shadow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2087 gtkblist->south_shadow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2088 #endif
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2089 }
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2090
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2091 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2092 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2093 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2094 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2095 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2096 GValue val = {0};
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2097 int scr_w,scr_h, w, h, x, y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2098 PangoLayout *layout;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2099 gboolean tooltip_top = FALSE;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2100 char *tooltiptext = NULL;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2101 struct _gaim_gtk_blist_node *gtknode;
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2102 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2103 GdkWindowAttr attr;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2104 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2105
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2106 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
2107 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2108 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2109 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
2110 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2111
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2112 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
2113 && !GAIM_BLIST_NODE_IS_CHAT(node))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2114 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2115
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2116 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2117
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
2118 if (node->child && GAIM_BLIST_NODE_IS_CONTACT(node) &&
8960
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
2119 (((GaimContact*)node)->online > 1 ||
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
2120 (gaim_blist_node_get_bool(node, "show_offline") &&
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
2121 ((GaimContact*)node)->currentsize > 1)) &&
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
2122 !gtknode->contact_expanded &&
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
2123 gaim_prefs_get_bool("/gaim/gtk/blist/auto_expand_contacts")) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2124 GtkTreeIter i;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2125 gaim_gtk_blist_expand_contact_cb(NULL, node);
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2126 tooltip_top = TRUE; /* When the person expands, the new screennames will be below.
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2127 We'll draw the tip above the cursor so that the user can see
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2128 the included buddies */
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2129
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2130 while (gtk_events_pending())
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2131 gtk_main_iteration();
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2132
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2133 /* we check to see if we're still supposed to be moving, now that gtk events have
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2134 * happened, and the mouse might not still be in the buddy list */
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2135 if(!gtkblist->timeout) {
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2136 gaim_gtk_blist_collapse_contact_cb(NULL, node);
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2137 return FALSE;
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2138 }
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2139
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2140 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
2141 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
2142 gtkblist->mouseover_contact = node;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2143 gtk_tree_path_down (path);
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2144 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
2145 GdkRectangle rect;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2146 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
2147 gtkblist->contact_rect.height += rect.height;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2148 gtk_tree_path_next(path);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2149 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2150 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2151
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2152 gtk_tree_path_free(path);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2153
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2154 tooltiptext = gaim_get_tooltip_text(node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2155
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2156 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2157 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2158
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2159 if(gtkblist->tipwindow)
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2160 gtk_widget_destroy(gtkblist->tipwindow);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2161 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2162 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2163 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2164 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2165 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2166 G_CALLBACK(gaim_gtk_blist_paint_tip), node);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2167 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2168
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2169 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2170 attr.window_type = GDK_WINDOW_TEMP;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2171 attr.override_redirect = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2172 attr.x = gtkblist->tipwindow->allocation.x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2173 attr.y = gtkblist->tipwindow->allocation.y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2174 attr.width = gtkblist->tipwindow->allocation.width;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2175 attr.height = gtkblist->tipwindow->allocation.height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2176 attr.wclass = GDK_INPUT_OUTPUT;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2177 attr.visual = gtk_widget_get_visual (gtkblist->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2178 attr.colormap = gtk_widget_get_colormap (gtkblist->window);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2179
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2180 attr.event_mask = gtk_widget_get_events (gtkblist->tipwindow);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2181
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2182 attr.event_mask |= (GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK |
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2183 GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2184 if(gtkblist->east_shadow) {
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2185 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2186 gdk_window_destroy (gtkblist->east_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2187 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2188 gtkblist->east_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2189 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2190 gdk_window_set_user_data (gtkblist->east_shadow, gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2191 gdk_window_set_back_pixmap (gtkblist->east_shadow, NULL, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2192
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2193 if(gtkblist->south_shadow) {
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2194 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2195 gdk_window_destroy (gtkblist->south_shadow);
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2196 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2197 gtkblist->south_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2198 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2199 gdk_window_set_user_data (gtkblist->south_shadow, gtkblist->tipwindow);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2200 gdk_window_set_back_pixmap (gtkblist->south_shadow, NULL, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2201 #endif
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2202
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2203 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2204 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2205 pango_layout_set_width(layout, 300000);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2206 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2207 scr_w = gdk_screen_width();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2208 scr_h = gdk_screen_height();
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2209 pango_layout_get_size (layout, &w, &h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2210 w = PANGO_PIXELS(w) + 8;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2211 h = PANGO_PIXELS(h) + 8;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2212
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2213 /* 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
2214 * I should #define this or something */
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2215 w = w + 38;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2216 h = MAX(h, 38);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2217
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2218 gdk_window_get_pointer(NULL, &x, &y, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2219 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2220 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2221
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2222 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2223
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2224 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2225 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2226 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2227 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2228
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2229 if (y < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2230 y = 0;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2231
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2232 if (y != 0) {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2233 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2234 x -= (x + w + 5) - scr_w;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2235 else if (x < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2236 x = 0;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2237 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2238 x -= (w / 2 + 10);
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2239 if (x < 0)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2240 x += w + 15;
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2241 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2242
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2243 g_object_unref (layout);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2244 g_free(tooltiptext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2245 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2246 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2247 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2248
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2249 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2250 map_shadow_windows(gtkblist);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2251 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2252
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2253 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2254 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2255
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2256 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
2257 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2258 GtkTreePath *path;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2259 int delay;
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2260
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2261 delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2262
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2263 if (delay == 0)
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2264 return FALSE;
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2265
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2266 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2267 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
2268 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2269 /* We've left the cell. Remove the timeout and create a new one below */
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2270 gaim_gtk_blist_tooltip_destroy();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2271 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2272 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2273
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2274 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
2275 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->tip_rect);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2276
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2277 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2278 gtk_tree_path_free(path);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2279 gtkblist->timeout = g_timeout_add(delay, (GSourceFunc)gaim_gtk_blist_tooltip_timeout, tv);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2280
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2281 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2282 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
2283 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2284 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2285 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2286 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2287
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2288 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2289 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2290
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2291 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
2292 {
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2293
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2294 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2295 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2296 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2297 }
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2298 gaim_gtk_blist_tooltip_destroy();
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2299
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2300 if (gtkblist->mouseover_contact &&
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2301 !((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
2302 (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
2303 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2304 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2305 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2306 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2307
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2308 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2309 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2310 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2311 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2312 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2313 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2314
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2315
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2316 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2317 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2318 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2319 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2320 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2321 /* Buddies menu */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2322 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
2323 { N_("/Buddies/New Instant _Message..."), "<CTL>M", show_im_dialog, 0, "<StockItem>", GAIM_STOCK_IM },
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2324 { N_("/Buddies/Join a _Chat..."), "<CTL>C", gaim_gtk_blist_joinchat_show, 0, "<StockItem>", GAIM_STOCK_CHAT },
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
2325 { N_("/Buddies/Get User _Info..."), "<CTL>I", show_info_dialog, 0, "<StockItem>", GAIM_STOCK_INFO },
9533
03066f174777 [gaim-migrate @ 10361]
Ethan Blanton <elb@pidgin.im>
parents: 9525
diff changeset
2326 { N_("/Buddies/View User _Log..."), "<CTL>L", show_log_dialog, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2327 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
5398
dbed3f967327 [gaim-migrate @ 5774]
Luke Schierer <lschiere@pidgin.im>
parents: 5397
diff changeset
2328 { 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
2329 { 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
2330 { 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
2331 { 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
2332 { 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
2333 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2334 { 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
2335 { 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
2336
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2337 /* Tools */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2338 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2339 { N_("/Tools/_Away"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2340 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
8845
48086c7bd568 [gaim-migrate @ 9612]
Mark Doliner <mark@kingant.net>
parents: 8844
diff changeset
2341 { N_("/Tools/Account Ac_tions"), NULL, NULL, 0, "<Branch>" },
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2342 { N_("/Tools/Pl_ugin Actions"), NULL, NULL, 0, "<Branch>" },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2343 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2344 { 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
2345 { N_("/Tools/_File Transfers"), NULL, gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
2346 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, NULL },
7870
30ee5c52b8dc [gaim-migrate @ 8524]
Luke Schierer <lschiere@pidgin.im>
parents: 7859
diff changeset
2347 { 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
2348 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2349 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2350 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2351
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2352 /* Help */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2353 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2354 { 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
2355 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2356 { N_("/Help/_About"), NULL, show_about, 0, "<StockItem>", GAIM_STOCK_ABOUT },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2357 };
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 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2360 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2361 *********************************************************/
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2362 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2363 rename_group_cb(GaimGroup *g, const char *new_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2364 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2365 gaim_blist_rename_group(g, new_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2366 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2367
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
2368 /*
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
2369 * Should disallow empty group names.
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
2370 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2371 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2372 show_rename_group(GtkWidget *unused, GaimGroup *g)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2373 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2374 gaim_request_input(NULL, _("Rename Group"), _("New group name"),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2375 _("Please enter a new name for the selected group."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
2376 g->name, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2377 _("OK"), G_CALLBACK(rename_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2378 _("Cancel"), NULL, g);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2379 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2380
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2381 static char *gaim_get_tooltip_text(GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2382 {
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2383 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2384 GaimPluginProtocolInfo *prpl_info = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2385 char *text = NULL;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2386
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2387 if(GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2388 GaimChat *chat = (GaimChat *)node;
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2389 char *name = NULL;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2390 struct proto_chat_entry *pce;
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2391 GList *parts, *tmp;
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2392 GString *parts_text = g_string_new("");
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2393
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2394 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
2395 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2396
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2397 parts = prpl_info->chat_info(chat->account->gc);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2398
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2399 name = g_markup_escape_text(gaim_chat_get_name(chat), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2400
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2401 if(g_list_length(gaim_connections_get_all()) > 1) {
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2402 char *account = g_markup_escape_text(chat->account->username, -1);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2403 g_string_append_printf(parts_text, _("\n<b>Account:</b> %s"),
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2404 account);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2405 g_free(account);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2406 }
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2407 for(tmp = parts; tmp; tmp = tmp->next) {
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
2408 char *label, *tmp2, *value;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2409 pce = tmp->data;
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2410
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2411 if(!pce->secret) {
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2412
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2413 tmp2 = g_markup_escape_text(pce->label, -1);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2414 label = gaim_text_strip_mnemonic(tmp2);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2415 g_free(tmp2);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2416
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2417 value = g_markup_escape_text(g_hash_table_lookup(chat->components,
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2418 pce->identifier), -1);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2419
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2420 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
2421 g_free(label);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2422 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2423 }
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2424 g_free(pce);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2425 }
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2426 g_list_free(parts);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2427
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2428 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
2429 name, parts_text->str);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2430 g_string_free(parts_text, TRUE);
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2431 g_free(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2432 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2433 GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2434 GaimBuddy *b;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2435 char *statustext = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2436 char *contactaliastext = NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2437 char *aliastext = NULL, *nicktext = NULL;
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2438 char *loggedin = NULL, *idletime = NULL;
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2439 char *warning = NULL;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2440 char *accounttext = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2441
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2442 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2443 GaimContact *contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2444 b = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2445 if(contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2446 contactaliastext = g_markup_escape_text(contact->alias, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2447 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2448 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2449 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2450
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2451 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
2452 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2453
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2454 if (prpl_info && prpl_info->tooltip_text) {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2455 const char *end;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2456 statustext = prpl_info->tooltip_text(b);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2457
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2458 if(statustext && !g_utf8_validate(statustext, -1, &end)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2459 char *new = g_strndup(statustext,
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2460 g_utf8_pointer_to_offset(statustext, end));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2461 g_free(statustext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2462 statustext = new;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2463 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2464 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2465
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2466 if (!statustext && !GAIM_BUDDY_IS_ONLINE(b))
8861
07f57b71bd5e [gaim-migrate @ 9629]
Luke Schierer <lschiere@pidgin.im>
parents: 8845
diff changeset
2467 statustext = g_strdup(_("\n<b>Status:</b> Offline"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2468
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2469 if (b->signon > 0)
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2470 loggedin = gaim_str_seconds_to_string(time(NULL) - b->signon);
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2471
5341
ccec8893c1be [gaim-migrate @ 5717]
Mark Doliner <mark@kingant.net>
parents: 5340
diff changeset
2472 if (b->idle > 0)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2473 idletime = gaim_str_seconds_to_string(time(NULL) - b->idle);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2474
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2475 if(b->alias && b->alias[0])
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2476 aliastext = g_markup_escape_text(b->alias, -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2477
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2478 if(b->server_alias)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2479 nicktext = g_markup_escape_text(b->server_alias, -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2480
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2481 if (b->evil > 0)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2482 warning = g_strdup_printf(_("%d%%"), b->evil);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2483
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2484 if(g_list_length(gaim_connections_get_all()) > 1)
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2485 accounttext = g_markup_escape_text(b->account->username, -1);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2486
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2487 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>"
8592
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2488 "%s %s" /* Account */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2489 "%s %s" /* Contact Alias */
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2490 "%s %s" /* Alias */
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2491 "%s %s" /* Nickname */
8592
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2492 "%s %s" /* Logged In */
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2493 "%s %s" /* Idle */
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2494 "%s %s" /* Warning */
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2495 "%s" /* Status */
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2496 "%s",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2497 b->name,
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2498 accounttext ? _("\n<b>Account:</b>") : "", accounttext ? accounttext : "",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2499 contactaliastext ? _("\n<b>Contact Alias:</b>") : "", contactaliastext ? contactaliastext : "",
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2500 aliastext ? _("\n<b>Alias:</b>") : "", aliastext ? aliastext : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2501 nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "",
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2502 loggedin ? _("\n<b>Logged In:</b>") : "", loggedin ? loggedin : "",
5438
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2503 idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "",
6e7ba9efd1f4 [gaim-migrate @ 5820]
Sean Egan <seanegan@gmail.com>
parents: 5427
diff changeset
2504 b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "",
8592
1dde34c45c5b [gaim-migrate @ 9343]
Mark Doliner <mark@kingant.net>
parents: 8591
diff changeset
2505 statustext ? statustext : "",
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2506 !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
2507 !g_ascii_strcasecmp(b->name, "seanegn") ? _("\n<b>Status</b>: Awesome") :
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2508 !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
2509
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2510 if(warning)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2511 g_free(warning);
7950
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2512 if(loggedin)
7b8407d8c546 [gaim-migrate @ 8624]
Mark Doliner <mark@kingant.net>
parents: 7897
diff changeset
2513 g_free(loggedin);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2514 if(idletime)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2515 g_free(idletime);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2516 if(statustext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2517 g_free(statustext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2518 if(nicktext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2519 g_free(nicktext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2520 if(aliastext)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2521 g_free(aliastext);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2522 if(accounttext)
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2523 g_free(accounttext);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2524 }
8824
f08245ed03aa [gaim-migrate @ 9587]
Sean Egan <seanegan@gmail.com>
parents: 8823
diff changeset
2525 gaim_signal_emit(gaim_gtk_blist_get_handle(),
8817
48c6552be372 [gaim-migrate @ 9579]
Sean Egan <seanegan@gmail.com>
parents: 8815
diff changeset
2526 "drawing-tooltip", node, &text);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2527 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2528 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2529
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2530 struct _emblem_data {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2531 char *filename;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2532 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2533 int y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2534 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2535
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2536 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2537 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2538 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2539 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2540 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2541 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2542 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2543 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2544 {NULL, 0, 0}, {NULL, 15, 0}};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2545
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2546 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2547 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2548
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2549 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2550 if(!gtknode->contact_expanded)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2551 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2552 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2553 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2554 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2555 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2556 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2557 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2558 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2559
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2560 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2561 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2562 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2563 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2564
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2565 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2566 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2567 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2568 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2569
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2570 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2571 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2572 return 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 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2575
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2576 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2577 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2578 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2579 if(prpl_info && prpl_info->list_emblems && buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2580 if(buddy->present != GAIM_BUDDY_SIGNING_OFF)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2581 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2582 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2583 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2584 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2585 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2586
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2587 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2588 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2589 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2590 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2591 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2592
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2593 if(buddy && buddy->present == GAIM_BUDDY_SIGNING_ON) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2594 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
2595 } else if(buddy && buddy->present == GAIM_BUDDY_SIGNING_OFF) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2596 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
2597 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2598 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2599 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2600 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2601 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2602 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2603 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2604 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2605
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2606 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2607 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2608
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2609 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2610 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2611
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2612 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2613 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2614 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2615
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2616 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2617 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2618 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2619 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2620 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2621 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2622 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2623 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2624 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2625 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2626 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2627 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2628 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2629 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2630 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2631 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2632 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2633 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2634 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2635 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2636 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2637 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2638 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2639 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2640 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2641 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2642 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2643 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2644 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2645 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2646
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2647 if(buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2648 if(buddy->present == GAIM_BUDDY_OFFLINE)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2649 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2650 else if(buddy->idle &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2651 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2652 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
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
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2655 return scale;
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 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2659 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2660 GdkPixbuf *buf, *ret;
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2661 GdkPixbufLoader *loader;
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2662 GaimBuddyIcon *icon;
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2663 const char *data;
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2664 size_t len;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2665
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2666 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2667 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2668
9396
84594a281500 [gaim-migrate @ 10208]
Tim Ringenbach <marv@pidgin.im>
parents: 9340
diff changeset
2669 if (!(icon = gaim_buddy_get_icon(b)))
84594a281500 [gaim-migrate @ 10208]
Tim Ringenbach <marv@pidgin.im>
parents: 9340
diff changeset
2670 if (!(icon = gaim_buddy_icons_find(b->account, b->name))) /* Not sure I like this...*/
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2671 return NULL;
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2672
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2673
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2674 loader = gdk_pixbuf_loader_new();
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2675 data = gaim_buddy_icon_get_data(icon, &len);
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2676 gdk_pixbuf_loader_write(loader, data, len, NULL);
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2677 buf = gdk_pixbuf_loader_get_pixbuf(loader);
9337
d0380151c6d1 [gaim-migrate @ 10145]
Tim Ringenbach <marv@pidgin.im>
parents: 9335
diff changeset
2678 if (buf)
d0380151c6d1 [gaim-migrate @ 10145]
Tim Ringenbach <marv@pidgin.im>
parents: 9335
diff changeset
2679 g_object_ref(G_OBJECT(buf));
9324
af707cc1e229 [gaim-migrate @ 10132]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2680 gdk_pixbuf_loader_close(loader, NULL);
9337
d0380151c6d1 [gaim-migrate @ 10145]
Tim Ringenbach <marv@pidgin.im>
parents: 9335
diff changeset
2681 g_object_unref(G_OBJECT(loader));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2682
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2683 if (buf) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2684 if (!GAIM_BUDDY_IS_ONLINE(b))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2685 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2686 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
2687 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2688
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2689 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2690 g_object_unref(G_OBJECT(buf));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2691 return ret;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2692 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2693 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2694 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2695
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2696 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
2697 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2698 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2699 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2700 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2701 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2702 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2703 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2704 int ihrs, imin;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2705 char *idletime = NULL, *warning = NULL, *statustext = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2706 time_t t;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2707 /* XXX Clean up this crap */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2708
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2709 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2710 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2711 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2712
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2713 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2714 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2715 else
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
2716 name = gaim_buddy_get_alias(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2717 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2718
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2719 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2720
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2721 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2722 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2723
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2724 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2725 if ((b->idle && !selected &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2726 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2727 !GAIM_BUDDY_IS_ONLINE(b)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2728 if (selected)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2729 text = g_strdup(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2730 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2731 text = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2732 esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2733 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2734 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2735 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2736 else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2737 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2738 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2739 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2740
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2741 time(&t);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2742 ihrs = (t - b->idle) / 3600;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2743 imin = ((t - b->idle) / 60) % 60;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2744
8122
36674144c510 [gaim-migrate @ 8826]
Christian Hammond <chipx86@chipx86.com>
parents: 8113
diff changeset
2745 if (prpl_info && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2746 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2747 const char *end;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2748
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2749 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2750 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2751 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2752 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2753 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2754 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2755
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2756 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2757 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2758 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2759 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2760 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2761 g_strdelimit(tmp, "\n", ' ');
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2762 gaim_str_strip_cr(tmp);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2763
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2764 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2765 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2766 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2767 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2768 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2769 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2770 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2771 c = g_utf8_next_char(c); /* this is fun */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2772 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2773
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2774 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2775
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2776 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2777 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2778 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2779 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2780
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2781 statustext = g_strdup_printf(buf, tmp);
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 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2784 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2785 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2786
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2787 if (b->idle > 0 &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2788 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2789 if (ihrs)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2790 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2791 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2792 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2793 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2794
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2795 if (b->evil > 0 &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2796 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level"))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2797 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2798
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2799 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2800 statustext = g_strdup(_("Offline "));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2801
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2802 if (b->idle && !selected &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2803 gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2805 text = g_strdup_printf("<span color='dim grey'>%s</span>\n"
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2806 "<span color='dim grey' size='smaller'>%s%s%s</span>",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2807 esc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2808 statustext != NULL ? statustext : "",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2809 idletime != NULL ? idletime : "",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2810 warning != NULL ? warning : "");
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2811 } else if (statustext == NULL && idletime == NULL && warning == NULL &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2812 GAIM_BUDDY_IS_ONLINE(b)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2813 text = g_strdup(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2814 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2815 text = g_strdup_printf("%s\n"
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2816 "<span %s size='smaller'>%s%s%s</span>", esc,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2817 selected ? "" : "color='dim grey'",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2818 statustext != NULL ? statustext : "",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2819 idletime != NULL ? idletime : "",
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2820 warning != NULL ? warning : "");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2821 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2822 if (idletime)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2823 g_free(idletime);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2824 if (warning)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2825 g_free(warning);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2826 if (statustext)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2827 g_free(statustext);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2828 if (esc)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2829 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2830
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2831 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2832 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2833
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2834 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2835 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2836 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2837
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2838 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
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 /* 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
2841 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2842 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2843 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2844
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2845 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2846 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2847 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2848
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2849 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2850 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2851 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2852 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2853 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2854
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2855 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2856 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2857 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2858 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2859
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2860 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2861 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2862 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2863 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2864 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2865
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2866 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2867 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2868 GaimBlistNode *gnode, *cnode;
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 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2871 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2872 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2873 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2874 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2875 GaimBuddy *buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2876 if(buddy && buddy->idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2877 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2878 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2879 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2880 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2881
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2882 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2883 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2884 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2885
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2886 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
2887 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2888 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
2889 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2890
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2891 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2892 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2893
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2894 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2895 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2896
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2897 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2898 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2899 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
2900 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2901 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2902 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2903 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2904 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2905 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2906 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2907
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2908 static void
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2909 sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2910 {
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
2911 GaimGtkBuddyList *gtkblist = GAIM_GTK_BLIST(blist);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2912 GtkWidget *widget;
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
2913
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2914 gaim_gtk_blist_update_protocol_actions();
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8222
diff changeset
2915 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2916
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2917 /* Make menu items sensitive/insensitive where appropriate */
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2918 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Join a Chat..."));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2919 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2920
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2921 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8938
diff changeset
2922 gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
8938
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
2923
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
2924 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
2925 gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable());
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
2926
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
2927 gaim_gtk_blist_update_toolbar();
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
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2930
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2931 static void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2932 plugin_changed_cb(GaimPlugin *p, gpointer *data)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2933 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2934 gaim_gtk_blist_update_plugin_actions();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2935 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2936
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2937
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2938 /* 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
2939 * it anything, so it remains without arguments. If you need anything
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2940 * more specific, do as below, and create another callback that calls
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2941 * this */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2942 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2943 raise_on_events_cb()
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2944 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2945 if(gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2946 gaim_prefs_get_bool("/gaim/gtk/blist/raise_on_events")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2947 gtk_widget_show(gtkblist->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2948 gtk_window_deiconify(GTK_WINDOW(gtkblist->window));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2949 gdk_window_raise(gtkblist->window->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2950 }
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
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2953 /**********************************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2954 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2955 **********************************************************************************/
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2956 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2957 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2958 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2959
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2960 gtkblist = g_new0(GaimGtkBuddyList, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2961 blist->ui_data = gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2962
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2963 /* 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
2964 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2965 gtkblist, GAIM_CALLBACK(raise_on_events_cb), NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2966 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2967 gtkblist, GAIM_CALLBACK(raise_on_events_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2968 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2969
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2970 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2971 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2972 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2973 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
2974
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2975 void gaim_gtk_blist_update_columns()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2976 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2977 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2978 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2979
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2980 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2981 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2982 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2983 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2984 } else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2985 gtk_tree_view_column_set_visible(gtkblist->idle_column,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2986 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2987 gtk_tree_view_column_set_visible(gtkblist->warning_column,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2988 gaim_prefs_get_bool("/gaim/gtk/blist/show_warning_level"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2989 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2990 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2991 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2992
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
2993 enum {DRAG_BUDDY, DRAG_ROW, DRAG_VCARD, DRAG_TEXT, DRAG_URI,NUM_TARGETS};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2994
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2995 static char *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2996 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2997 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2998 return _((char *)path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2999 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3000
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3001 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3002 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3003 gaim_gtk_blist_sort_method_reg("none", _("None"), sort_method_none);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3004 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3005 gaim_gtk_blist_sort_method_reg("alphabetical", _("Alphabetical"), sort_method_alphabetical);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3006 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
3007 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
3008 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3009 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
3010 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3011
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3012 static void _prefs_change_redo_list() {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3013 redo_buddy_list(gaim_get_blist(), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3014 }
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 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
3017 gpointer val, gpointer data) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3018 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3019 gaim_gtk_blist_sort_method_set(val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3020 }
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 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3023 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3024 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3025 GtkTreeViewColumn *column;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3026 GtkWidget *sw;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3027 GtkWidget *button;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3028 GtkSizeGroup *sg;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3029 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3030 GtkTreeSelection *selection;
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3031 GtkTargetEntry dte[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
3032 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3033 {"text/x-vcard", 0, DRAG_VCARD },
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3034 {"text/uri-list", 0, DRAG_URI},
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3035 {"text/plain", 0, DRAG_TEXT}};
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3036 GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3037 {"application/x-im-contact", 0, DRAG_BUDDY},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3038 {"text/x-vcard", 0, DRAG_VCARD }};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3039 if (gtkblist && gtkblist->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3040 gtk_widget_show(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3041 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3042 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3043
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3044 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3045
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3046 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3047 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3048 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3049
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3050 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3051 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3052
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3053 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
3054 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
3055 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
3056 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3057
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3058 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3059 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3060 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3061 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3062 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
3063 gtk_item_factory_set_translate_func (gtkblist->ift,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3064 item_factory_translate_func,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3065 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3066 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
3067 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3068 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3069 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3070 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3071 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
3072
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3073 awaymenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Away"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3074 do_away_menu();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3075
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3076 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
3077 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3078
8844
76013c5ef153 [gaim-migrate @ 9611]
Luke Schierer <lschiere@pidgin.im>
parents: 8824
diff changeset
3079 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Account Actions"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3080 gaim_gtk_blist_update_protocol_actions();
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3081
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3082 pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Plugin Actions"));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3083 gaim_gtk_blist_update_plugin_actions();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3084 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3085 sw = gtk_scrolled_window_new(NULL,NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3086 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
3087 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
3088
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3089 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3090 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, G_TYPE_STRING,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3091 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
3092
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3093 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
3094 gtk_widget_set_size_request(gtkblist->treeview, -1, 200);
9176
7dc10a14c568 [gaim-migrate @ 9971]
Luke Schierer <lschiere@pidgin.im>
parents: 9113
diff changeset
3095 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
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 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3098
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3099 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3100 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
3101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3102
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3103 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3104 gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
9557
1ea8d59a7957 [gaim-migrate @ 10393]
Sean Egan <seanegan@gmail.com>
parents: 9556
diff changeset
3105 GDK_BUTTON1_MASK, ste, 3,
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3106 GDK_ACTION_COPY);
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3107 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
9557
1ea8d59a7957 [gaim-migrate @ 10393]
Sean Egan <seanegan@gmail.com>
parents: 9556
diff changeset
3108 dte, 5,
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3109 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3110
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3111 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
3112 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
3113
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3114 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3115 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
3116 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
3117
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3118 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3119
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3120 column = gtk_tree_view_column_new ();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3121
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3122 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3123 gtk_tree_view_column_pack_start (column, rend, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3124 gtk_tree_view_column_set_attributes (column, rend,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3125 "pixbuf", STATUS_ICON_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3126 "visible", STATUS_ICON_VISIBLE_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3127 NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3128 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3129
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3130 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3131 gtk_tree_view_column_pack_start (column, rend, TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3132 gtk_tree_view_column_set_attributes (column, rend,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3133 "markup", NAME_COLUMN,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3134 NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3135 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3136
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3137 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3138
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3139 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3140 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
3141 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
3142 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3143
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3144 rend = gtk_cell_renderer_text_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3145 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
3146 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
3147 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
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 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3150 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
3151 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3152 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
3153
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3154 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
3155 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
3156 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
3157 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
3158 g_signal_connect(G_OBJECT(gtkblist->treeview), "key-press-event", G_CALLBACK(gtk_blist_key_press_cb), NULL);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
3159 g_signal_connect(G_OBJECT(gtkblist->treeview), "popup-menu", G_CALLBACK(gaim_gtk_blist_popup_menu_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3160
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3161 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3162 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
3163
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3164 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3165 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3166 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3167
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3168 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3169 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3170 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3171 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
3172 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3173 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
3174 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3175
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3176 /* OK... let's show this bad boy. */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3177 gaim_gtk_blist_refresh(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3178 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3179 gtk_widget_show_all(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3180
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3181 /**************************** Button Box **************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3182 /* 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
3183
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3184 gtkblist->tooltips = gtk_tooltips_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3185
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3186 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3187 gtkblist->bbox = gtk_hbox_new(TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3188 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
3189 gtk_widget_show(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3190
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
3191 button = gaim_pixbuf_button_from_stock(_("I_M"), GAIM_STOCK_IM, GAIM_BUTTON_VERTICAL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3192 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3193 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3194 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3195 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
3196 gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3197 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Send a message to the selected buddy"), NULL);
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3198 g_object_set_data(G_OBJECT(button), "button_name", "im");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3199 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3200
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
3201 button = gaim_pixbuf_button_from_stock(_("Get _Info"), GAIM_STOCK_INFO, GAIM_BUTTON_VERTICAL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3202 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3203 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3204 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3205 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
3206 gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3207 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Get information on the selected buddy"), NULL);
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3208 g_object_set_data(G_OBJECT(button), "button_name", "info");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3209 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3210
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
3211 button = gaim_pixbuf_button_from_stock(_("_Chat"), GAIM_STOCK_CHAT, GAIM_BUTTON_VERTICAL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3212 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3213 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3214 gtk_size_group_add_widget(sg, button);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3215 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
3216 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Join a chat room"), NULL);
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3217 gtk_widget_set_sensitive(button, gaim_gtk_blist_joinchat_is_showable());
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3218 g_object_set_data(G_OBJECT(button), "button_name", "chat");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3219 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3220
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
3221 button = gaim_pixbuf_button_from_stock(_("_Away"), GAIM_STOCK_ICON_AWAY, GAIM_BUTTON_VERTICAL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3222 gtk_box_pack_start(GTK_BOX(gtkblist->bbox), button, FALSE, FALSE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3223 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3224 gtk_size_group_add_widget(sg, button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3225 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
3226 gtk_tooltips_set_tip(GTK_TOOLTIPS(gtkblist->tooltips), button, _("Set an away message"), NULL);
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3227 g_object_set_data(G_OBJECT(button), "button_name", "away");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3228 gtk_widget_show(button);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3229
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3230 /* this will show the right image/label widgets for us */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3231 gaim_gtk_blist_update_toolbar();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3232
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3233 /* start the refresh timer */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3234 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3235 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
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 gtkblist->refresh_timer = g_timeout_add(30000,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3238 (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3241 /* attach prefs callbacks */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3242 /* for the toolbar buttons */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3243 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3244 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3245 gaim_prefs_connect_callback("/gaim/gtk/blist/button_style",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3246 gaim_gtk_blist_update_toolbar, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3247 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3248 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3249 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buttons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3250 gaim_gtk_blist_update_toolbar, NULL)));
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 /* things that affect how buddies are displayed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3253 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3254 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3255 gaim_prefs_connect_callback("/gaim/gtk/blist/grey_idle_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3256 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3257 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3258 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3259 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buddy_icons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3260 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3261 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3262 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3263 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3264 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3265 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3266 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3267 gaim_prefs_connect_callback("/gaim/gtk/blist/show_idle_time",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3268 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3269 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3270 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3271 gaim_prefs_connect_callback("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3272 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3273 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3274 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3275 gaim_prefs_connect_callback("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3276 _prefs_change_redo_list, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3277
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3278 /* sorting */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3279 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3280 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3281 gaim_prefs_connect_callback("/gaim/gtk/blist/sort_type",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3282 _prefs_change_sort_method, NULL)));
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 /* things that affect what columns are displayed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3285 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3286 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3287 gaim_prefs_connect_callback("/gaim/gtk/blist/show_buddy_icons",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3288 gaim_gtk_blist_update_columns, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3289 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3290 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3291 gaim_prefs_connect_callback("/gaim/gtk/blist/show_idle_time",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3292 gaim_gtk_blist_update_columns, NULL)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3293 blist_prefs_callbacks = g_slist_prepend(blist_prefs_callbacks,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3294 GINT_TO_POINTER(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3295 gaim_prefs_connect_callback("/gaim/gtk/blist/show_warning_level",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3296 gaim_gtk_blist_update_columns, NULL)));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3297
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3298 /* Setup some gaim signal handlers. */
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3299 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3300 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3301 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3302 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3303
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3304 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3305 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3306 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3307 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3308
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3309 /* emit our created signal */
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3310 gaim_signal_emit(gaim_gtk_blist_get_handle(), "gtkblist-created", list);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3311 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3312
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3313 /* XXX: does this need fixing? */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3314 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3315 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3316 GaimBlistNode *gnode, *cnode, *bnode;
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 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3319 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3320 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3321 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3322 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3323 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3324 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3325
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3326 for(bnode = cnode->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3327 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3328 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3329 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3330 gaim_gtk_blist_hide_node(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3331 gaim_gtk_blist_update(list, bnode);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3334 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3335 } else if(GAIM_BLIST_NODE_IS_CHAT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3336 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3337 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3338
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3339 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3340 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3341 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3342 gaim_gtk_blist_update(list, gnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3343 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3344 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3345
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3346 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3347 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3348 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3349 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3350
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3351 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3352 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3353 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3354 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3355 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3356
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3357 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3358 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3359
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3360 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3361 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3362
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3363 gtkblist->refresh_timer = g_timeout_add(30000,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3364 (GSourceFunc)gaim_gtk_blist_refresh_timer, blist);
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3365 } else {
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3366 g_source_remove(gtkblist->refresh_timer);
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3367 gtkblist->refresh_timer = 0;
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3368 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3369 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3370
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3371 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3372 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
3373 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3374
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3375 /* XXX: why do we assume we have a buddy here? */
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3376 if (!gtknode) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3377 #if 0
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3378 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
3379 #endif
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3380 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3381 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3382
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3383 if (!gtkblist) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3384 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
3385 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3386 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3387
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3388 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3389 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3390
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3391 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3392 return FALSE;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3393 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
3394 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3395 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3396 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3397 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3398 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3399 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3400
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3401 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3402 gaim_gtk_blist_update_toolbar_icons (GtkWidget *widget, gpointer data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3403 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3404 GaimButtonStyle style = gaim_prefs_get_int("/gaim/gtk/blist/button_style");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3405
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3406 if (GTK_IS_IMAGE(widget)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3407 if (style == GAIM_BUTTON_IMAGE || style == GAIM_BUTTON_TEXT_IMAGE)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3408 gtk_widget_show(widget);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3409 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3410 gtk_widget_hide(widget);
7620
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 else if (GTK_IS_LABEL(widget)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3413 if (style == GAIM_BUTTON_IMAGE)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3414 gtk_widget_hide(widget);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3415 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3416 gtk_widget_show(widget);
7620
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 else if (GTK_IS_CONTAINER(widget)) {
9577
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3419 if (GTK_IS_BUTTON(widget) && !strcmp(g_object_get_data(G_OBJECT(widget), "button_name"), "chat"))
4c36ffbdbf8d [gaim-migrate @ 10420]
Ethan Blanton <elb@pidgin.im>
parents: 9557
diff changeset
3420 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3421 gtk_container_foreach(GTK_CONTAINER(widget),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3422 gaim_gtk_blist_update_toolbar_icons, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3423 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3424 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3425
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3426 void gaim_gtk_blist_update_toolbar() {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3427 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3428 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3429
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3430 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
3431 gtk_widget_hide(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3432 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3433 gtk_container_foreach(GTK_CONTAINER(gtkblist->bbox),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3434 gaim_gtk_blist_update_toolbar_icons, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3435 gtk_widget_show(gtkblist->bbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3436 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3437 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3438
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3439 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3440 {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3441 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3442
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3443 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3444 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3445
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3446 /* There's something I don't understand here */
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3447 /* g_free(node->ui_data);
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3448 node->ui_data = NULL; */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3449 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3450
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3451 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3452 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3453 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3454
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3455 /* 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
3456 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3457 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3458 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3459 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3460 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3461 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3462 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3463 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3464
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3465 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3466 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3467
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3468 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3469 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3470 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3471 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3472
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3473 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3474 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3475 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3476 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3477
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3478 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3479 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3480 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3481
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3482 static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
7620
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 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3485 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3486 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3487
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3488 if(!gtknode || !iter)
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3489 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3490
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3491 if(node->parent && !get_iter_from_node(node->parent, &parent_iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3492 return FALSE;
7620
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 if(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3495 curptr = &cur;
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 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
3498 *iter = current_sort_method->func(node, list, parent_iter, curptr);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3499 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3500 *iter = sort_method_none(node, list, parent_iter, curptr);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3501 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3502
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3503 gtk_tree_row_reference_free(gtknode->row);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3504 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3505 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3506 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3507 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3508 newpath);
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3509 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3510
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3511 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3512 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3513 -1);
7620
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 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3516 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3517 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3518
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3519 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3520 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3521 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
3522 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3523 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3524 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
3525 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3526 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3527 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
3528 gtk_tree_path_free(expand);
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
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3532 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3533 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3534
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3535 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
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 GaimGroup *group;
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3538 int count;
7620
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 g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3541
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3542 group = (GaimGroup*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3543
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3544 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3545 count = gaim_blist_get_group_size(group, FALSE);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3546 else
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3547 count = gaim_blist_get_group_online_count(group);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3548 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups") || count > 0) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3549 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3550 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3551
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3552 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3553 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3554
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3555 esc = g_markup_escape_text(group->name, -1);
8945
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3556 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3557 esc, gaim_blist_get_group_online_count(group),
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3558 gaim_blist_get_group_size(group, FALSE));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3559 g_free(esc);
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 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3562 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3563 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3564 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3565 NODE_COLUMN, node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3566 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3567 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3568 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3569 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3570 }
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3573 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3574 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3575 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3576 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3577 char *warning = NULL, *idle = NULL;
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 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3580
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3581 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3582 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3583 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3584
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3585 avatar = gaim_gtk_blist_get_buddy_icon(buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3586 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
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 if (buddy->idle > 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3589 time_t t;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3590 int ihrs, imin;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3591 time(&t);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3592 ihrs = (t - buddy->idle) / 3600;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3593 imin = ((t - buddy->idle) / 60) % 60;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3594 if(ihrs > 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3595 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3596 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3597 idle = g_strdup_printf("(%d)", imin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3598 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3599
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3600 if (buddy->evil > 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3601 warning = g_strdup_printf("%d%%", buddy->evil);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3602
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3603 if (gaim_prefs_get_bool("/gaim/gtk/blist/grey_idle_buddies") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3604 buddy->idle) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3605
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3606 if(warning && !selected) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3607 char *w2 = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3608 warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3609 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3610 warning = w2;
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3613 if(idle && !selected) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3614 char *i2 = g_strdup_printf("<span color='dim grey'>%s</span>",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3615 idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3616 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3617 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3618 }
7620
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3621 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3622 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3623 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3624 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3625 WARNING_COLUMN, warning,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3626 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3627 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3628 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3629
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3630 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3631 if(idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3632 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3633 if(warning)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3634 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3635 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3636 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3637 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3638 g_object_unref(avatar);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3639 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3640
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3641 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3642 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3643 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3644 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3645 struct _gaim_gtk_blist_node *gtknode;
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 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3648
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3649 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3650 gaim_gtk_blist_update_group(list, node->parent);
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 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3653 contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3654 buddy = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3655
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3656 if(buddy && (buddy->present != GAIM_BUDDY_OFFLINE ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3657 (gaim_account_is_connected(buddy->account) &&
8960
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
3658 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
3659 gaim_blist_node_get_bool(node, "show_offline"))) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3660 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3661
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3662 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3663 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3664
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3665 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3666 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3667 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3668
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3669 status = gaim_gtk_blist_get_status_icon(node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3670 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3671 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
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 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3674
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3675 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3676 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3677 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3678 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3679 WARNING_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3680 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3681 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3682 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3683 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3684 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3685 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3686 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3687 buddy_node(buddy, &iter, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3688 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3689 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3690 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3691 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3692 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3693
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3694 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3695 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3696 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3697 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3698 struct _gaim_gtk_blist_node *gtkparentnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3699
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3700 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3701
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3702 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3703 contact = (GaimContact*)node->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3704 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3705
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3706 /* First things first, update the contact */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3707 gaim_gtk_blist_update_contact(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3708
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3709 if(gtkparentnode->contact_expanded &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3710 (buddy->present != GAIM_BUDDY_OFFLINE ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3711 (gaim_account_is_connected(buddy->account) &&
8960
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
3712 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
7c008d98ef33 [gaim-migrate @ 9734]
Nathan Walp <nwalp@pidgin.im>
parents: 8952
diff changeset
3713 gaim_blist_node_get_bool(node->parent, "show_offline"))) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3714 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3715
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3716 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3717 return;
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3718
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3719 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3720
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3721 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3722 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3723 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3724
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3725 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3726
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3727 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3728 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3729 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3730
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3731 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3732
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3733 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3734 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3735
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3736 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3737
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3738 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3739 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3740 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3741 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3742
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3743 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3744 return;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3745
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3746 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3747 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3748 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3749
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3750 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
3751
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3752 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3753 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3754 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3755 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3756 -1);
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 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3759 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3760 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3761 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3762 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3763 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3764 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3765
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3766 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3767 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3768 if(!gtkblist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3769 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3770
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3771 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3772 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3773 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3774 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3775 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3776 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3777 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3778 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3779 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3780 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3781 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3782 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3783 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3784 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3785 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3786 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3787
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3788 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3789 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3790
7620
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 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3793 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3794 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3795 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3796
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3797 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3798 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3799 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3800 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3801
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3802 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3803
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
3804 gaim_gtk_blist_tooltip_destroy();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3805
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3806 gtk_object_sink(GTK_OBJECT(gtkblist->tooltips));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3807
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3808 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3809 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3810 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3811 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3812
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3813 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3814 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3815 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3816 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3817 gtkblist->idle_column = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3818 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
3819 gtkblist->bbox = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3820 g_object_unref(G_OBJECT(gtkblist->ift));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3821 protomenu = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3822 pluginmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3823 awaymenu = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3824 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3825
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3826 while(blist_prefs_callbacks) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3827 gaim_prefs_disconnect_callback(GPOINTER_TO_INT(blist_prefs_callbacks->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3828 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
3829 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3830 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3831
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3832 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
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 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3835 return;
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 if (show) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3838 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3839 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3840 } else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3841 if (!gaim_connections_get_all() || docklet_count) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3842 #ifdef _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3843 wgaim_systray_minimize(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3844 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3845 gtk_widget_hide(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3846 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3847 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3848 }
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 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3851
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3852 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3853 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3854 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3855 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3856 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3857 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3858 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3859
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3860 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3861 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3862 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3863 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3864 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3865 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3866 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3867 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3868 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3869 gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3870 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3871 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3872 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3873 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3874 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3875 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3876 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3877 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3878 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3879
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3880 return tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3881 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3882
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3883 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3884 add_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3885 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3886 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3887 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3888 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3889 }
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 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3892 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3893 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3894 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3895 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3896
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3897 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3898 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
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 const char *grp, *who, *whoalias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3901 GaimConversation *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3902 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3903 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3904
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3905 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3906 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3907 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3908 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
3909 whoalias = gtk_entry_get_text(GTK_ENTRY(data->entry_for_alias));
9658
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
3910 if (*whoalias == '\0')
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
3911 whoalias = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3912
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3913 c = gaim_find_conversation_with_account(who, data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3914
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3915 if ((g = gaim_find_group(grp)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3916 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3917 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3918 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3919 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3920
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3921 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3922 gaim_blist_add_buddy(b, NULL, g, NULL);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3923 serv_add_buddy(gaim_account_get_connection(data->account), b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3924
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3925 /*
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3926 * XXX
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3927 * It really seems like it would be better if the call to serv_add_buddy()
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3928 * and gaim_conversation_update() were done in blist.c, possibly in the
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3929 * gaim_blist_add_buddy() function. Maybe serv_add_buddy() should be
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3930 * renamed to gaim_blist_add_new_buddy() or something, and have it call
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3931 * gaim_blist_add_buddy() after it creates it. --Mark
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3932 *
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3933 * No that's not good. blist.c should only deal with adding nodes to the
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3934 * local list. We need a new, non-gtk file that calls both serv_add_buddy
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3935 * and gaim_blist_add_buddy(). Or something. --Mark
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3936 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3937
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3938 if (c != NULL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3939 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
3940 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3941 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3942 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3943
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3944 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3945 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3946
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3947 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3948 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3949 const char *group, const char *alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3950 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3951 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3952 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3953 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3954 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3955 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3956 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3957 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3958
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3959 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3960 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3961 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3962 : gaim_connection_get_account(gaim_connections_get_all()->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3963
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3964 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3965 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3966
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3967 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
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 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
3970 NULL, GTK_DIALOG_NO_SEPARATOR,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3971 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3972 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3973 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3974
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3975 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
3976 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3977 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3978 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
3979 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
3980 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
3981 gtk_window_set_type_hint(GTK_WINDOW(data->window),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
3982 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
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 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3985 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3986 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3987 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3988
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3989 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3990 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3991
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3992 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3993 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3994 "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
3995 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3996 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3997
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3998 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3999 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4000 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4001 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4003 hbox = gtk_hbox_new(FALSE, 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4004 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4005
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4006 g_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4007 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
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 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4010 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4011 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4012 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4013 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 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 label = gtk_label_new(_("Screen Name:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4016 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4017 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
4018
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4019 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4020 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
4021 gtk_widget_grab_focus(data->entry);
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 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4024 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4025
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4026 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4027 gaim_set_accessible_label (data->entry, label);
7620
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 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4030 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4031 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
4032
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4033 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4034 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4035 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4036
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4037 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4038 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4039
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4040 gtk_entry_set_activates_default (GTK_ENTRY(data->entry_for_alias), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4041 gaim_set_accessible_label (data->entry_for_alias, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4042
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4043 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4044 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4045 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
4046
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4047 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 gtk_table_attach_defaults(GTK_TABLE(table), data->combo, 1, 2, 2, 3);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4050 gaim_set_accessible_label (data->combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4051
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4053 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4054 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4055 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
4056
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4057 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4058 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4059
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4060 gtk_table_attach_defaults(GTK_TABLE(table), data->account_box, 1, 2, 3, 4);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4061 gaim_set_accessible_label (data->account_box, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4062
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4063 /* End of account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4065 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4066 G_CALLBACK(add_buddy_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4067
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4068 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4069
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4070 if (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4071 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
4072 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4073
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4074 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4075 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4076 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4077 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4078 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4079 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4080 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4081 const char *group_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4082
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4083 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
4084 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4085
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4086 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4087 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4088 if (g_object_get_data(tmp->data, "is_spin"))
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 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4091 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4092 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093 gtk_spin_button_get_value_as_int(tmp->data)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4094 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4095 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4097 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4098 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4099 g_strdup(gtk_entry_get_text(tmp->data)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4100 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4101 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4102
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4103 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4104 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4105 components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4106
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4107 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
4108
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4109 if ((group = gaim_find_group(group_name)) == NULL)
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 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4112 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4113 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4114
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4115 if (chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4116 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4117 gaim_blist_add_chat(chat, group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4118 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4119
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4120 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4121 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4122
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4123 g_free(data);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4126 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4127 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4128 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4129 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4130 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4131 add_chat_cb(NULL, data);
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 else
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 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4136 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4137 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4138 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4139 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4140
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4141 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4142 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4143 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4144 GaimConnection *gc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4145 GList *list, *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4146 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4147 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4148
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4149 gc = gaim_account_get_connection(data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4150
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4151 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4152 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4153 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4154 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4155 }
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 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4161
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4162 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
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 for (tmp = list; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4165 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4166 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4167 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4168
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4169 pce = tmp->data;
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 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4172 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
4173
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
4174 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4176 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4177 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4178
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4179 if (pce->is_int)
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 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4182 GtkWidget *spin;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4183 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4184 1, 10, 10);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4185 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4186 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
4187 g_object_set_data(G_OBJECT(spin), "identifier", pce->identifier);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4188 data->entries = g_list_append(data->entries, spin);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4189 gtk_widget_set_size_request(spin, 50, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4190 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
4191 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4192 gaim_set_accessible_label (spin, label);
7620
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 else
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 GtkWidget *entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4197
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4198 g_object_set_data(G_OBJECT(entry), "identifier", pce->identifier);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4199 data->entries = g_list_append(data->entries, entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4200
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4201 if (pce->def)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4202 gtk_entry_set_text(GTK_ENTRY(entry), pce->def);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4203
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4204 if (focus)
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 gtk_widget_grab_focus(entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4207 focus = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4208 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4209
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4210 if (pce->secret)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4211 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
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 gtk_box_pack_end(GTK_BOX(rowbox), entry, TRUE, TRUE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4214
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4215 g_signal_connect(G_OBJECT(entry), "activate",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4216 G_CALLBACK(add_chat_cb), data);
7891
62f885e37afd [gaim-migrate @ 8551]
Ethan Blanton <elb@pidgin.im>
parents: 7889
diff changeset
4217 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4218 gaim_set_accessible_label (entry, label);
7620
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4221 g_free(pce);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4222 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4223
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4224 g_list_free(list);
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 gtk_widget_show_all(data->entries_box);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4227 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4228
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4229 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4230 add_chat_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4231 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4232 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4233 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4234 gaim_account_get_protocol_id(account)) == 0)
7620
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 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4237 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4238 else
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 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4241 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4242 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4243 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4244
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4245 static gboolean
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4246 add_chat_check_account_func(GaimAccount *account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4247 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4248 GaimConnection *gc = gaim_account_get_connection(account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4249
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4250 return (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4251 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4252
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4253 void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4254 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4255 const char *alias)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4256 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4257 GaimGtkAddChatData *data;
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4258 GaimGtkBuddyList *gtkblist;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4259 GList *l;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4260 GaimConnection *gc;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4261 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4262 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4263 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4264 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4265 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4266
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4267 data = g_new0(GaimGtkAddChatData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4268
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4269 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4270 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4272 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4273
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4274 if (account != NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4275 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4276 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4277 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4279 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4280 /* Select an account with chat capabilities */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4281 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4282 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4283 gc = (GaimConnection *)l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4284
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4285 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4286 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4287 data->account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4288 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4289 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4290 }
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4293 if (data->account == NULL)
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 gaim_notify_error(NULL, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4296 _("You are not currently signed on with any "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4297 "protocols that have the ability to chat."), NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4298 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4299 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4300
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4301 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4302
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4303 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4304 NULL, GTK_DIALOG_NO_SEPARATOR,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4305 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4306 GTK_STOCK_ADD, GTK_RESPONSE_OK,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4307 NULL);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4308
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4309 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4310 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4311 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4312 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), 12);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4313 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4314 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4315 gtk_window_set_type_hint(GTK_WINDOW(data->window),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4316 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4317
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4318 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4319 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4320 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4321 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4322
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4323 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4324 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4325
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4326 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4327 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4328 "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
4329 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4330 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4331 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4332 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4333
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4334 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4335 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4336
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4337 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4338 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4339 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4340 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4341
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4342 data->account_menu = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4343 G_CALLBACK(add_chat_select_account_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4344 add_chat_check_account_func, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4345 gtk_box_pack_start(GTK_BOX(rowbox), data->account_menu, TRUE, TRUE, 0);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4346 gaim_set_accessible_label (data->account_menu, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4347
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4348 data->entries_box = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4349 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4350 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
4351
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4352 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4353
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4354 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4355 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4356
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4357 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4358 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4359 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4360 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4361
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4362 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4363 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4364 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4365 gtk_box_pack_end(GTK_BOX(rowbox), data->alias_entry, TRUE, TRUE, 0);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4366 gaim_set_accessible_label (data->alias_entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4367
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4368 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4369 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4370
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4371 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4372 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4373 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4374 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4375
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4376 data->group_combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4377 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
4378 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
4379
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4380 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4381 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4382 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
4383 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4384 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4385 gaim_set_accessible_label (data->group_combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4386
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4387 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4388 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4389
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4390 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4391 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4392
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4393 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4394 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4395 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4396 GaimGroup *group;
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4397
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4398 group = gaim_group_new(group_name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4399 gaim_blist_add_group(group, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4400 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4401
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4402 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4403 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4404 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
4405 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4406 _("Please enter the name of the group to be added."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
4407 NULL, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4408 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4409 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4410 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4411
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4412 void gaim_gtk_blist_docklet_toggle() {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4413 /* Useful for the docklet plugin and also for the win32 tray icon*/
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
4414 /* This is called when one of those is clicked--it will show/hide the
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4415 buddy list/login window--depending on which is active */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4416 if (gaim_connections_get_all()) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4417 if (gtkblist && gtkblist->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4418 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4419 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
4420 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4421 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4422 wgaim_systray_maximize(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4423 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4424 gaim_blist_set_visible(TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4425 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4426 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4427 /* we're logging in or something... do nothing */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4428 /* or should I make the blist? */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4429 gaim_debug(GAIM_DEBUG_WARNING, "blist",
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4430 "docklet_toggle called with gaim_connections_get_all() "
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4431 "but no blist!\n");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4432 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4433 } else if (mainwindow) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4434 if (GTK_WIDGET_VISIBLE(mainwindow)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4435 if (GAIM_WINDOW_ICONIFIED(mainwindow)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4436 gtk_window_present(GTK_WINDOW(mainwindow));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4437 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4438 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4439 wgaim_systray_minimize(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4440 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4441 gtk_widget_hide(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4442 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4443 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4444 #if _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4445 wgaim_systray_maximize(mainwindow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4446 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4447 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4448 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4449 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4450 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4451 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4452 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4453
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4454 void gaim_gtk_blist_docklet_add()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4455 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4456 docklet_count++;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4457 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4458
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4459 void gaim_gtk_blist_docklet_remove()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4460 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4461 docklet_count--;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4462 if (!docklet_count) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4463 if (gaim_connections_get_all())
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4464 gaim_blist_set_visible(TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4465 else if (mainwindow)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4466 gtk_window_present(GTK_WINDOW(mainwindow));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4467 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4468 show_login();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4469 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4470 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4471
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4472 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4473 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4474 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4475 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4476 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4477 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4478 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4479 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4480 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4481 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4482 gaim_gtk_blist_request_add_chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4483 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4484 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4485
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4486
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4487 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4488 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4489 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4490 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4491 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4492
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4493 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4494 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4495 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4496 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4497 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4498 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4499 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4500 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4501 for(cnode = gnode->child; cnode; cnode = cnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4502 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4503 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4504
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4505 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4506 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4507
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4508 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4509
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4510 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4511 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4512
8197
7c45eb829340 [gaim-migrate @ 8919]
Nathan Walp <nwalp@pidgin.im>
parents: 8143
diff changeset
4513 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
8198
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4514 (gaim_blist_node_get_string((GaimBlistNode*)chat,
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4515 "gtk-autojoin") != NULL))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4516 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4517 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4518 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4519 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4520
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4521 void *
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4522 gaim_gtk_blist_get_handle() {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4523 static int handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4524
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4525 return &handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4526 }
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4527
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4528 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4529 {
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4530 void *gtk_blist_handle = gaim_gtk_blist_get_handle();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4531
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4532 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4533 gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4534 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4535
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4536 /* Initialize prefs */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4537 gaim_prefs_add_none("/gaim/gtk/blist");
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4538 gaim_prefs_add_bool("/gaim/gtk/blist/auto_expand_contacts", TRUE);
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4539 gaim_prefs_add_int("/gaim/gtk/blist/button_style", GAIM_BUTTON_TEXT_IMAGE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4540 gaim_prefs_add_bool("/gaim/gtk/blist/grey_idle_buddies", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4541 gaim_prefs_add_bool("/gaim/gtk/blist/raise_on_events", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4542 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4543 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4544 gaim_prefs_add_bool("/gaim/gtk/blist/show_idle_time", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4545 gaim_prefs_add_bool("/gaim/gtk/blist/show_offline_buddies", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4546 gaim_prefs_add_bool("/gaim/gtk/blist/show_warning_level", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4547 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "");
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4548 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4549 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4550 gaim_prefs_add_int("/gaim/gtk/blist/width", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4551 gaim_prefs_add_int("/gaim/gtk/blist/height", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4552 gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4553
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4554 /* Register our signals */
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4555 gaim_signal_register(gtk_blist_handle, "gtkblist-created",
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4556 gaim_marshal_VOID__POINTER, NULL, 1,
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4557 gaim_value_new(GAIM_TYPE_SUBTYPE,
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4558 GAIM_SUBTYPE_BLIST));
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4559
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4560 gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4561 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4562 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_NODE),
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4563 gaim_value_new_outgoing(GAIM_TYPE_STRING));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4564 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4565
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4566 void
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4567 gaim_gtk_blist_uninit(void) {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4568 gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4569 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4570
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4571 /*********************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4572 * Public utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4573 *********************************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4574
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4575 GdkPixbuf *
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4576 create_prpl_icon(GaimAccount *account)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4577 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4578 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4579 GaimPluginProtocolInfo *prpl_info = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4580 GdkPixbuf *status = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4581 char *filename = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4582 const char *protoname = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4583 char buf[256];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4584
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
4585 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4586
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4587 if (prpl != NULL) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4588 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4589
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4590 if (prpl_info->list_icon != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4591 protoname = prpl_info->list_icon(account, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4592 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4593
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4594 if (protoname == NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4595 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4596
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4597 /*
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4598 * Status icons will be themeable too, and then it will look up
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4599 * protoname from the theme
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4600 */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4601 g_snprintf(buf, sizeof(buf), "%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4602
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4603 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4604 "default", buf, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4605 status = gdk_pixbuf_new_from_file(filename, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4606 g_free(filename);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4607
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4608 return status;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4609 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4610
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4611
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4612 /*********************************************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4613 * Buddy List sorting functions *
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4614 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4615
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4616 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
4617 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4618 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
4619 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4620 method->name = g_strdup(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4621 method->func = func;;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4622 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
4623 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4624
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4625 void gaim_gtk_blist_sort_method_unreg(const char *id){
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4626 GSList *l = gaim_gtk_blist_sort_methods;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4627
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4628 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4629 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4630 if(!strcmp(method->id, id)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4631 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
4632 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4633 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4634 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4635 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4636 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4637 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4638 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4639
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4640 void gaim_gtk_blist_sort_method_set(const char *id){
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4641 GSList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4642
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4643 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4644 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4645
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4646 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
4647 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4648
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4649 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4650 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4651 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4652 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4653 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4654 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4655 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4656
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4657 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4658
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4659 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4660 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4661 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4662
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4663 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
4664 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4665 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4666 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4667 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4668
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4669 if(cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4670 return *cur;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4671
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4672 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4673 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4674 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4675
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4676 gtk_tree_store_insert_after(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4677 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4678 sibling ? &sibling_iter : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4679
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4680 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4681 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4682
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4683 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4684
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4685 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
4686 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4687 GtkTreeIter more_z, iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4688 GaimBlistNode *n;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4689 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4690
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4691 const char *my_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4692
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4693 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4694 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4695 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4696 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4697 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4698 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4699 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4700
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4701
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4702 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
4703 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4704 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4705 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4706
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4707 do {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4708 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4709 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4710
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4711 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
4712 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4713
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4714 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4715 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4716 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4717 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4718 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4719 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4720 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4721
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4722 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4723
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4724 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4725 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4726 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4727 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4728 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4729 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4730 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4731 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4732 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4733 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4734 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4735 } 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
4736
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4737 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4738 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4739 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4740 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4741 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4742 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4743 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4744 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4745
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4746 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
4747 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4748 GtkTreeIter more_z, iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4749 GaimBlistNode *n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4750 GValue val = {0,};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4751
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4752 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4753
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4754 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4755 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4756 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4757 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4758 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4759
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4760 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4761 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4762 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4763 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4764 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4765
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4766
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4767 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
4768 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4769 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4770 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4771
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4772 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4773 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4774
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4775 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
4776 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4777
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4778 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4779 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4780 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4781 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4782 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4783
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4784 cmp = gaim_utf8_strcasecmp(my_buddy ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4785 gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4786 : NULL, this_buddy ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4787 gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4788 : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4789
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4790 /* Hideous */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4791 if(!this_buddy ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4792 ((my_buddy->present > this_buddy->present) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4793 (my_buddy->present == this_buddy->present &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4794 (((my_buddy->uc & UC_UNAVAILABLE) < (this_buddy->uc & UC_UNAVAILABLE)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4795 (((my_buddy->uc & UC_UNAVAILABLE) == (this_buddy->uc & UC_UNAVAILABLE)) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4796 (((my_buddy->idle == 0) && (this_buddy->idle != 0)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4797 (this_buddy->idle && (my_buddy->idle > this_buddy->idle)) ||
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4798 ((my_buddy->idle == this_buddy->idle) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4799 (cmp < 0 || (cmp == 0 && node < n))))))))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4800 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4801 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4802 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4803 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4804 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4805 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4806 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4807 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4808 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4809 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4810 } 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
4811
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4812 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4813 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4814 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4815 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4816 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4817 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4818 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4819 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4820
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4821 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
4822 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4823 GtkTreeIter more_z, iter;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4824 GaimBlistNode *n = NULL, *n2;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4825 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4826
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4827 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4828 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4829
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4830 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
4831 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4832
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4833 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4834 for (n = node->child; n; n = n->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
4835 log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n))->name, ((GaimBuddy*)(n))->account);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4836 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4837 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4838 /* 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
4839 * from the chat info in the blist, yet */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4840 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4841 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4842
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4843 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4844 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4845 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4846 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4847 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4848
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4849
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4850 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
4851 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4852 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4853 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4854
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4855 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4856 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4857
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4858 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
4859 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4860 this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4861
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4862 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4863 for (n2 = n->child; n2; n2 = n2->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
4864 this_log_size += gaim_log_get_total_size(GAIM_LOG_IM, ((GaimBuddy*)(n2))->name, ((GaimBuddy*)(n2))->account);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4865 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4866 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4867 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4868 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4869
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4870 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4871
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4872 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
4873 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4874 (cmp < 0 || (cmp == 0 && node < n)))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4875 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4876 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4877 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4878 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4879 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4880 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4881 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4882 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4883 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4884 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4885 } 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
4886
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4887 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4888 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4889 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4890 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4891 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4892 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4893 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4894 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4895
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4896 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4897
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4898
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4899 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4900 plugin_act(GtkObject *obk, GaimPluginAction *pam)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4901 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4902 if (pam->callback) pam->callback(pam);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4903 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4904
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4905
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4906
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4907 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4908 build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin, gpointer context)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4909 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4910 GtkWidget *menuitem = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4911 GaimPluginAction *action = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4912 GList *l, *ll;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4913
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4914 for (l = ll = GAIM_PLUGIN_ACTIONS(plugin, context); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4915 if (l->data) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4916 action = (GaimPluginAction *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4917 action->plugin = plugin;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4918 action->context = context;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4919
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4920 menuitem = gtk_menu_item_new_with_label(action->label);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4921 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4922 g_signal_connect(G_OBJECT(menuitem), "activate",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4923 G_CALLBACK(plugin_act), action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4924 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4925 gtk_widget_show(menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4926 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4927 else
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4928 gaim_separator(menu);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4929 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4930
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4931 g_list_free(ll);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4932 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4933
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4934
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4935 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4936 gaim_gtk_blist_update_protocol_actions(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4937 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4938 GtkWidget *menuitem, *submenu;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4939 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4940 GaimConnection *gc = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4941 GaimPlugin *plugin = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4942 int count = 0;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4943
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4944 if (protomenu == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4945 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4946
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4947 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4948 for (l = gtk_container_get_children(GTK_CONTAINER(protomenu)); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4949 GaimPluginAction *action;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4950
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4951 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4952 action = (GaimPluginAction *) g_object_get_data(G_OBJECT(menuitem),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4953 "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4954 g_free(action);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4955
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4956 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4957 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4958
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4959 /* Count the number of accounts with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4960 for (l = gaim_connections_get_all(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4961 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4962 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4963
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4964 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4965 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4966
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4967 /* no need to count past 2, so don't */
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4968 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4969 break;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4970 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4971
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4972 if (count == 0) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4973 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4974 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4975 gtk_widget_set_sensitive(menuitem, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4976 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4977 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4978
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4979 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4980 /* Find the one account that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4981 for (l = gaim_connections_get_all(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4982 gc = l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4983 plugin = gc->prpl;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4984
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4985 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4986 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4987 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4988
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4989 build_plugin_actions(protomenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4990 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4991
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4992 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4993 for (l = gaim_connections_get_all(); l; l = l->next) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4994 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4995 GdkPixbuf *pixbuf, *scale;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4996 GtkWidget *image;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4997 char *buf;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4998
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4999 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5000 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5001
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5002 if (!GAIM_CONNECTION_IS_CONNECTED(gc) || !GAIM_PLUGIN_HAS_ACTIONS(plugin))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5003 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5004
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5005 account = gaim_connection_get_account(gc);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5006 buf = g_strconcat(gaim_account_get_username(account), " (",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5007 plugin->info->name, ")", NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5008 menuitem = gtk_image_menu_item_new_with_label(buf);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5009 g_free(buf);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5010
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5011 pixbuf = create_prpl_icon(account);
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5012 if (pixbuf) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5013 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5014 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5015 image = gtk_image_new_from_pixbuf(scale);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5016 g_object_unref(G_OBJECT(pixbuf));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5017 g_object_unref(G_OBJECT(scale));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5018 gtk_widget_show(image);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5019 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5020 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5021
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5022 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5023 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5024
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5025 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5026 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5027 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5028
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5029 build_plugin_actions(submenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5030 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5031 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5032 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5033
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5034
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5035 void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5036 gaim_gtk_blist_update_plugin_actions(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5037 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5038 GtkWidget *menuitem, *submenu;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5039 GaimPlugin *plugin = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5040 GList *l;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5041 int count = 0;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5042
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5043 if (pluginmenu == NULL)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5044 return;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5045
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5046 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5047 for (l = gtk_container_get_children(GTK_CONTAINER(pluginmenu)); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5048 GaimPluginAction *action;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5049
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5050 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5051 action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5052 g_free(action);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5053
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5054 gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(menuitem));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5055 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5056
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5057 /* Count the number of plugins with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5058 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5059 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5060
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5061 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5062 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5063
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5064 /* no need to count past 2, so don't */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5065 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5066 break;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5067 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5068
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5069 if (count == 0) {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5070 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5071 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5072 gtk_widget_set_sensitive(menuitem, FALSE);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5073 gtk_widget_show(menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5074 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5075
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5076 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5077 /* Find the one plugin that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5078 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5079 plugin = (GaimPlugin *) l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5080
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5081 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5082 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5083 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5084
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5085 build_plugin_actions(pluginmenu, plugin, NULL);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5086 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5087
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5088 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5089 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5090 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5091
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5092 if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5093 continue;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5094
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5095 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5096 continue;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5097
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5098 menuitem = gtk_image_menu_item_new_with_label(plugin->info->name);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5099 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5100 gtk_widget_show(menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5101
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5102 submenu = gtk_menu_new();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5103 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5104 gtk_widget_show(submenu);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5105
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5106 build_plugin_actions(submenu, plugin, NULL);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5107 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5108 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5109 }