annotate src/gtkblist.c @ 11158:2c930d591492

[gaim-migrate @ 13245] This is what the command actually does, I'm not sure if jabber should allow for invi tes to other rooms than the one the command is run from. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 25 Jul 2005 23:46:34 +0000
parents 096020ae09a9
children a511b77a368b
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 /*
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
2 * @file gtkblist.c GTK+ BuddyList API
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
3 * @ingroup gtkui
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
4 *
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
7 * 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
8 * 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
9 * source distribution.
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * 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
13 * the Free Software Foundation; either version 2 of the License, or
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 */
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9778
diff changeset
26 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9778
diff changeset
27 #include "gtkgaim.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
28
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
29 #include "account.h"
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
30 #include "connection.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
31 #include "core.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
32 #include "debug.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
33 #include "notify.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
34 #include "prpl.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
35 #include "prefs.h"
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
36 #include "plugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
37 #include "request.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
38 #include "signals.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
39 #include "sound.h"
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
40 #include "gtkstock.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
41 #include "util.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
42
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
43 #include "gtkaccount.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
44 #include "gtkblist.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
45 #include "gtkconv.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
46 #include "gtkdebug.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9686
diff changeset
47 #include "gtkdialogs.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
48 #include "gtkft.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
49 #include "gtklog.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
50 #include "gtkpounce.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
51 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
52 #include "gtkprivacy.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
53 #include "gtkroomlist.h"
10418
bed2c96bc1fb [gaim-migrate @ 11669]
Mark Doliner <mark@kingant.net>
parents: 10382
diff changeset
54 #include "gtksavedstatuses.h"
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
55 #include "gtksound.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
56 #include "gtkstatusbox.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
57 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
58
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
61 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
62
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
63 /* if someone explicitly asked for drop shadows, we also need to make
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
64 sure that their environment can support it. If not, tough */
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
65 #ifdef WANT_DROP_SHADOW
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
66 # if !GTK_CHECK_VERSION(2,2,0) || (defined(__APPLE__) && defined(__MACH__))
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
67 # undef WANT_DROP_SHADOW
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
68 # endif
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
69 #endif
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
70
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71 typedef struct
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 GaimAccount *account;
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 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
76 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
77 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
78 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
79 GtkWidget *account_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 } GaimGtkAddBuddyData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
85 GaimAccount *account;
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
86 gchar *default_chat_name;
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
87
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
88 GtkWidget *window;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
89 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
90 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
91 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
92 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
93 GtkSizeGroup *sg;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
94
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
95 GList *entries;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
96
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
97 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
98
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
99 typedef struct
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
100 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
101 GaimAccount *account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
102
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
103 GtkWidget *window;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
104 GtkWidget *account_menu;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
105 GtkWidget *entries_box;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
106 GtkSizeGroup *sg;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
107
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
108 GList *entries;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
109 } GaimGtkJoinChatData;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
110
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
111
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
112 static GtkWidget *protomenu = NULL;
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
113 static GtkWidget *pluginmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
115 GSList *gaim_gtk_blist_sort_methods = NULL;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
116 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
117 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
118
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
119 /* 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
120 * 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
121 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
122 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
123 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
124 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
125 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
126 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 /* part of the best damn Docklet code this side of Tahiti */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 static gboolean gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 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
132 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
133 static char *gaim_get_tooltip_text(GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 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
135 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
136 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
137 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
138
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
139 static void gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
140
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
141 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
142 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
143 gboolean contact_expanded;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
144 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
145
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
146
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
147 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
148 /**************************** Weird drop shadow stuff *******************/
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
149 /* This is based on a patch for drop shadows in GTK+ menus available at
10311
b7566fc34c6c [gaim-migrate @ 11505]
Mark Doliner <mark@kingant.net>
parents: 10297
diff changeset
150 * http://www.xfce.org/gtkmenu-shadow/
b7566fc34c6c [gaim-migrate @ 11505]
Mark Doliner <mark@kingant.net>
parents: 10297
diff changeset
151 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
152
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
153 enum side {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
154 EAST_SIDE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
155 SOUTH_SIDE
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
10850
fa06fda62868 [gaim-migrate @ 12522]
Mark Doliner <mark@kingant.net>
parents: 10814
diff changeset
158 static const double shadow_strip_l[5] = {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
159 .937, .831, .670, .478, .180
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
160 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
161
10850
fa06fda62868 [gaim-migrate @ 12522]
Mark Doliner <mark@kingant.net>
parents: 10814
diff changeset
162 static const double bottom_left_corner[25] = {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
163 1.00, .682, .423, .333, .258,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
164 1.00, .898, .800, .682, .584,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
165 1.00, .937, .874, .800, .737,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
166 1.00, .968, .937, .898, .866,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
167 1.00, .988, .976, .960, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
168 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
169
10850
fa06fda62868 [gaim-migrate @ 12522]
Mark Doliner <mark@kingant.net>
parents: 10814
diff changeset
170 static const double bottom_right_corner[25] = {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
171 .258, .584, .737, .866, .945,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
172 .584, .682, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
173 .737, .800, .874, .937, .976,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
174 .866, .898, .937, .968, .988,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
175 .945, .960, .976, .988, .996
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
176 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
177
10850
fa06fda62868 [gaim-migrate @ 12522]
Mark Doliner <mark@kingant.net>
parents: 10814
diff changeset
178 static const double top_right_corner[25] = {
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
179 1.00, 1.00, 1.00, 1.00, 1.00,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
180 .686, .898, .937, .968, .988,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
181 .423, .803, .874, .937, .976,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
182 .333, .686, .800, .898, .960,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
183 .258, .584, .737, .866, .945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
184 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
185
10850
fa06fda62868 [gaim-migrate @ 12522]
Mark Doliner <mark@kingant.net>
parents: 10814
diff changeset
186 static const double top_left_corner[25] = {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
187 .988, .968, .937, .898, .498,
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
188 .976, .937, .874, .803, .423,
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
189 .960, .898, .800, .686, .333,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
190 .945, .866, .737, .584, .258,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
191 .941, .847, .698, .521, .215
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
192 };
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
193
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
194
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
195 static gboolean xcomposite_is_present()
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
196 {
10018
bae1cd16e854 [gaim-migrate @ 10938]
Luke Schierer <lschiere@pidgin.im>
parents: 10017
diff changeset
197 static gboolean result = FALSE;
bae1cd16e854 [gaim-migrate @ 10938]
Luke Schierer <lschiere@pidgin.im>
parents: 10017
diff changeset
198 #ifndef _WIN32
bae1cd16e854 [gaim-migrate @ 10938]
Luke Schierer <lschiere@pidgin.im>
parents: 10017
diff changeset
199 static gboolean known = FALSE;
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
200 int i, j, k;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
201
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
202 if (!known) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
203 /* I don't actually care about versions/etc. */
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
204 if (XQueryExtension(GDK_DISPLAY(), "Composite", &i, &j, &k) == True)
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
205 result = TRUE;
10017
ef935958e84c [gaim-migrate @ 10937]
Ethan Blanton <elb@pidgin.im>
parents: 10015
diff changeset
206 known = TRUE;
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
207 }
10018
bae1cd16e854 [gaim-migrate @ 10938]
Luke Schierer <lschiere@pidgin.im>
parents: 10017
diff changeset
208 #endif
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
209
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
210 return result;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
211 }
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
212
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
213 static GdkPixbuf *
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
214 get_pixbuf(GtkWidget *menu, int x, int y, int width, int height)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
215 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
216 GdkPixbuf *dest, *src;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
217 GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET(menu));
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
218 GdkWindow *root = gdk_screen_get_root_window (screen);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
219 gint screen_height = gdk_screen_get_height (screen);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
220 gint screen_width = gdk_screen_get_width (screen);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
221 gint original_width = width;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
222 gint original_height = height;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
223
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
224 if (x < 0) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
225 width += x;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
226 x = 0;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
227 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
228
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
229 if (y < 0) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
230 height += y;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
231 y = 0;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
232 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
233
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
234 if (x + width > screen_width) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
235 width = screen_width - x;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
236 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
237
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
238 if (y + height > screen_height) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
239 height = screen_height - y;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
240 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
241
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
242 if (width <= 0 || height <= 0)
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
243 return NULL;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
244
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
245 dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
246 original_width, original_height);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
247 src = gdk_pixbuf_get_from_drawable(NULL, root, NULL, x, y, 0, 0,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
248 width, height);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
249 gdk_pixbuf_copy_area (src, 0, 0, width, height, dest, 0, 0);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
250
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
251 g_object_unref (G_OBJECT (src));
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
252
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
253 return dest;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
254 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
255
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
256 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
257 shadow_paint(GaimGtkBuddyList *blist, GdkRectangle *area, enum side shadow)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
258 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
259 gint width, height;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
260 GdkGC *gc = gtkblist->tipwindow->style->black_gc;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
261
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
262 switch (shadow) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
263 case EAST_SIDE:
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
264 if (gtkblist->east != NULL) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
265 if (area)
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
266 gdk_gc_set_clip_rectangle (gc, area);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
267
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
268 width = gdk_pixbuf_get_width (gtkblist->east);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
269 height = gdk_pixbuf_get_height (gtkblist->east);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
270
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
271 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->east_shadow), gc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
272 gtkblist->east, 0, 0, 0, 0, width, height,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
273 GDK_RGB_DITHER_NONE, 0, 0);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
274
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
275 if (area)
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
276 gdk_gc_set_clip_rectangle (gc, NULL);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
277 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
278 break;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
279
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
280 case SOUTH_SIDE:
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
281 if (blist->south != NULL) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
282 if (area)
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
283 gdk_gc_set_clip_rectangle (gc, area);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
284
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
285 width = gdk_pixbuf_get_width (gtkblist->south);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
286 height = gdk_pixbuf_get_height (gtkblist->south);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
287
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
288 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->south_shadow), gc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
289 gtkblist->south, 0, 0, 0, 0, width, height,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
290 GDK_RGB_DITHER_NONE, 0, 0);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
291
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
292 if (area)
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
293 gdk_gc_set_clip_rectangle (gc, NULL);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
294 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
295 break;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
296 }
7620
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
299 static void
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
300 pixbuf_add_shadow (GdkPixbuf *pb, enum side shadow)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
301 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
302 gint width, rowstride, height;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
303 gint i;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
304 guchar *pixels, *p;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
305
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
306 width = gdk_pixbuf_get_width (pb);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
307 height = gdk_pixbuf_get_height (pb);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
308 rowstride = gdk_pixbuf_get_rowstride (pb);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
309 pixels = gdk_pixbuf_get_pixels (pb);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
310
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
311 switch (shadow) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
312 case EAST_SIDE:
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
313 if (height > 5) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
314 for (i = 0; i < width; i++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
315 gint j, k;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
316
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
317 p = pixels + (i * rowstride);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
318 for (j = 0, k = 0; j < 3 * width; j += 3, k++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
319 p[j] = (guchar) (p[j] * top_right_corner [i * width + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
320 p[j + 1] = (guchar) (p[j + 1] * top_right_corner [i * width + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
321 p[j + 2] = (guchar) (p[j + 2] * top_right_corner [i * width + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
322 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
323 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
324
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
325 i = 5;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
326 } else {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
327 i = 0;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
328 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
329
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
330 for (; i < height; i++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
331 gint j, k;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
332
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
333 p = pixels + (i * rowstride);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
334 for (j = 0, k = 0; j < 3 * width; j += 3, k++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
335 p[j] = (guchar) (p[j] * shadow_strip_l[width - 1 - k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
336 p[j + 1] = (guchar) (p[j + 1] * shadow_strip_l[width - 1 - k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
337 p[j + 2] = (guchar) (p[j + 2] * shadow_strip_l[width - 1 - k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
338 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
339 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
340 break;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
341
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
342 case SOUTH_SIDE:
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
343 for (i = 0; i < height; i++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
344 gint j, k;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
345
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
346 p = pixels + (i * rowstride);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
347 for (j = 0, k = 0; j < 3 * height; j += 3, k++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
348 p[j] = (guchar) (p[j] * bottom_left_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
349 p[j + 1] = (guchar) (p[j + 1] * bottom_left_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
350 p[j + 2] = (guchar) (p[j + 2] * bottom_left_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
351 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
352
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
353 p = pixels + (i * rowstride) + 3 * height;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
354 for (j = 0, k = 0; j < (width * 3) - (6 * height); j += 3, k++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
355 p[j] = (guchar) (p[j] * bottom_right_corner [i * height]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
356 p[j + 1] = (guchar) (p[j + 1] * bottom_right_corner [i * height]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
357 p[j + 2] = (guchar) (p[j + 2] * bottom_right_corner [i * height]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
358 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
359
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
360 p = pixels + (i * rowstride) + ((width * 3) - (3 * height));
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
361 for (j = 0, k = 0; j < 3 * height; j += 3, k++) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
362 p[j] = (guchar) (p[j] * bottom_right_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
363 p[j + 1] = (guchar) (p[j + 1] * bottom_right_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
364 p[j + 2] = (guchar) (p[j + 2] * bottom_right_corner[i * height + k]);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
365 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
366 }
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
367 break;
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
368 }
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
371 static gboolean
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
372 map_shadow_windows (gpointer data)
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 GaimGtkBuddyList *blist = (GaimGtkBuddyList*)data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
375 GtkWidget *widget = blist->tipwindow;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
376 GdkPixbuf *pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
377 int x, y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
378
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
379 gtk_window_get_position(GTK_WINDOW(widget), &x, &y);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
380 pixbuf = get_pixbuf(widget,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
381 x + widget->allocation.width, y,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
382 5, widget->allocation.height + 5);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
383 if (pixbuf != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
384 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
385 pixbuf_add_shadow (pixbuf, EAST_SIDE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
386 if (blist->east != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
387 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
388 g_object_unref (G_OBJECT (blist->east));
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 blist->east = pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
391 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
392
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
393 pixbuf = get_pixbuf (widget,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
394 x, y + widget->allocation.height,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
395 widget->allocation.width + 5, 5);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
396 if (pixbuf != NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
397 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
398 pixbuf_add_shadow (pixbuf, SOUTH_SIDE);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
399 if (blist->south != NULL)
7620
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 g_object_unref (G_OBJECT (blist->south));
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 blist->south = pixbuf;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
404 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
405
9686
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
406 gdk_window_move_resize (blist->east_shadow,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
407 x + widget->allocation.width, MAX(0,y),
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
408 5, MIN(widget->allocation.height, gdk_screen_height()));
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
409
9686
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
410 gdk_window_move_resize (blist->south_shadow,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
411 MAX(0,x), y + widget->allocation.height,
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
412 MIN(widget->allocation.width + 5, gdk_screen_width()), 5);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
413
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
414 gdk_window_show (blist->east_shadow);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
415 gdk_window_show (blist->south_shadow);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
416 shadow_paint(blist, NULL, EAST_SIDE);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
417 shadow_paint(blist, NULL, SOUTH_SIDE);
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
418
882e7e423457 [gaim-migrate @ 10538]
Sean Egan <seanegan@gmail.com>
parents: 9673
diff changeset
419 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
420 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
421
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
422 /**************** END WEIRD DROP SHADOW STUFF ***********************************/
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
423 #endif /* ifdef WANT_DROP_SHADOW */
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
424
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
425
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
426 static char dim_grey_string[8] = "";
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
427 static char *dim_grey()
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
428 {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
429 if (!gtkblist)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
430 return "dim grey";
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
431 if (!dim_grey_string[0]) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
432 GtkStyle *style = gtk_widget_get_style(gtkblist->treeview);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
433 snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
434 style->text_aa[GTK_STATE_NORMAL].red >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
435 style->text_aa[GTK_STATE_NORMAL].green >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
436 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
437 }
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
438 return dim_grey_string;
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
439 }
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
440
5228
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 * Callbacks *
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
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
445 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
446 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
447 if (docklet_count)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 gaim_blist_set_visible(FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 else
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
450 gaim_core_quit();
5228
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 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453 return TRUE;
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
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
456 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
459 * 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
460 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
461 * 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
462 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
463 gint x, y;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
464
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
465 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
466 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
467 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
468 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
469 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
470 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
471
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
472 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
473 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
474 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
475 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
476 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
477
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
478 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
479 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
480
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
481 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
482 if (x + event->width < 0 ||
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
483 y + event->height < 0 ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
484 x > gdk_screen_width() ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
485 y > gdk_screen_height()) {
7620
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 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
488 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
489
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
490 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
491 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
492 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
493 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
494 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
495
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
496 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
497 return FALSE;
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
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
500 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
501 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
502 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
503 gaim_gtk_blist_obscured = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
504 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
505 gaim_gtk_blist_obscured = 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 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
508 return FALSE;
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
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
511 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
512 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
513 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
514 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
515
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
516 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
517 {
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
518 gaim_gtkdialogs_im_with_user(b->account, b->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
519 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
520
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
521 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
522 {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
523 serv_send_file(b->account->gc, b->name, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
524 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
525
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
526 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
527 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
528 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
529 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
530 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
531
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
532 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
533 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
534 serv_join_chat(chat->account->gc, chat->components);
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
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
537 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1,
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
538 char *arg2, gpointer nada)
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
539 {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
540 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
541 GtkTreePath *path;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
542 GValue val = {0,};
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
543 GaimBlistNode *node;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
544
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
545 path = gtk_tree_path_new_from_string (arg1);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
546 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
547 gtk_tree_path_free (path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
548 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
549 node = g_value_get_pointer(&val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
550 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), TRUE);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
551 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
552 switch (node->type){
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
553 case GAIM_BLIST_CONTACT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
554 gaim_blist_alias_buddy(gaim_contact_get_priority_buddy((GaimContact*)node), arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
555 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
556 case GAIM_BLIST_BUDDY_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
557 gaim_blist_alias_buddy((GaimBuddy*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
558 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
559 case GAIM_BLIST_GROUP_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
560 gaim_blist_rename_group((GaimGroup*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
561 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
562 case GAIM_BLIST_CHAT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
563 gaim_blist_alias_chat((GaimChat*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
564 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
565 default:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
566 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
567 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
568 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
569
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
570 static void
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
571 gtk_blist_edit_starting(GtkCellRenderer *renderer,
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
572 GtkCellEditable *editable,
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
573 gchar *pathstr,
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
574 gpointer user_data)
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
575 {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
576 GtkTreePath *path;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
577 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
578 GaimBlistNode *node;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
579 GValue val = {0,};
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
580
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
581 path = gtk_tree_path_new_from_string (pathstr);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
582 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
583 gtk_tree_path_free (path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
584 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
585 node = g_value_get_pointer(&val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
586
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
587 switch (node->type) {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
588 case GAIM_BLIST_BUDDY_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
589 gtk_entry_set_text(GTK_ENTRY(editable), ((GaimBuddy*)node)->alias);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
590 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
591 case GAIM_BLIST_CONTACT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
592 gtk_entry_set_text(GTK_ENTRY(editable), (gaim_contact_get_priority_buddy((GaimContact*)node))->alias);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
593 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
594 case GAIM_BLIST_GROUP_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
595 gtk_entry_set_text(GTK_ENTRY(editable), ((GaimGroup*)node)->name);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
596 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
597 case GAIM_BLIST_CHAT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
598 gtk_entry_set_text(GTK_ENTRY(editable), ((GaimChat*)node)->alias);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
599 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
600 default:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
601 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
602 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
603 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
604
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
605 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
606 {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
607 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
608 GtkTreePath *path;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
609
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
610 if (!(get_iter_from_node(node, &iter))) {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
611 /* This is either a bug, or the buddy is in a collapsed contact */
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
612 node = node->parent;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
613 if (!get_iter_from_node(node, &iter))
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
614 /* Now it's definitely a bug */
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
615 return;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
616 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
617 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
618 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
619 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), FALSE);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
620 gtk_widget_grab_focus(gtkblist->treeview);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
621 gtk_tree_view_set_cursor(GTK_TREE_VIEW(gtkblist->treeview), path, gtkblist->text_column, TRUE);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
622 gtk_tree_path_free(path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
623 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
624
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
625 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
626 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
627 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
628 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
629
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
630 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
631 {
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
632 GaimLogType type;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
633 GaimAccount *account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
634 char *name = NULL;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
635
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
636 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
637 GaimBuddy *b = (GaimBuddy*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
638 type = GAIM_LOG_IM;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
639 name = g_strdup(b->name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
640 account = b->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
641 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
642 GaimChat *c = (GaimChat*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
643 GaimPluginProtocolInfo *prpl_info = NULL;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
644 type = GAIM_LOG_CHAT;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
645 account = c->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
646 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account)));
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
647 if (prpl_info && prpl_info->get_chat_name) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
648 name = prpl_info->get_chat_name(c->components);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
649 }
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
650 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
651 gaim_gtk_log_show_contact((GaimContact *)node);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
652 return;
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
653 } else
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
654 return;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
655
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
656 if (name && account) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
657 gaim_gtk_log_show(type, name, account);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
658 g_free(name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
659 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
660 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
661
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663 {
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8470
diff changeset
664 gaim_gtk_syslog_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
665 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668 {
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10229
diff changeset
669 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
670 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
672 static void
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
673 do_join_chat(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
674 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
675 if (data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
676 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
677 GHashTable *components =
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
678 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
679 GList *tmp;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
680
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
681 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
682 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
683 if (g_object_get_data(tmp->data, "is_spin"))
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 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
686 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
687 g_strdup_printf("%d",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
688 gtk_spin_button_get_value_as_int(tmp->data)));
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 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
691 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
692 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
693 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
694 g_strdup(gtk_entry_get_text(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
695 }
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
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
698 serv_join_chat(gaim_account_get_connection(data->account), components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
699
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
700 g_hash_table_destroy(components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
701 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
702 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
703
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
704 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
705 do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
706 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
707 switch(id)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
708 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
709 case GTK_RESPONSE_OK:
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
710 do_join_chat(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
711
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
712 break;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
713 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
714
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
715 gtk_widget_destroy(GTK_WIDGET(dialog));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
716 g_list_free(info->entries);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
717 g_free(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
718 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
719
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
720 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
721 * Check the values of all the text entry boxes. If any required input
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
722 * strings are empty then don't allow the user to click on "OK."
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
723 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
724 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
725 joinchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
726 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
727 GaimGtkJoinChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
728 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
729 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
730 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
731 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
732
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
733 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
734
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
735 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
736 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
737 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
738 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
739 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
740 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
741 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
742 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
743 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
744 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
745
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
746 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), GTK_RESPONSE_OK, sensitive);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
747 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
748
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
749 static void
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
750 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
751 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
752 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
753 GList *list = NULL, *tmp = NULL;
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
754 GHashTable *defaults = NULL;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
755 struct proto_chat_entry *pce;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
756 gboolean focus = TRUE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
757
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
758 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
759
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
760 gc = gaim_account_get_connection(data->account);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
761
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
762 while (GTK_BOX(data->entries_box)->children)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
763 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
764 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
765 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
766 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
767
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
768 if (data->entries != NULL)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
769 g_list_free(data->entries);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
770
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
771 data->entries = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
772
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
773 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
774 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
775
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
776 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
777 defaults = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, NULL);
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
778
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
779 for (tmp = list; tmp; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
780 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
781 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
782 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
783 GtkWidget *input;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
784
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
785 pce = tmp->data;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
786
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
787 rowbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
788 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
789
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
790 label = gtk_label_new_with_mnemonic(pce->label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
791 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
792 gtk_size_group_add_widget(data->sg, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
793 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
794
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
795 if (pce->is_int)
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 GtkObject *adjust;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
798 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
799 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
800 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
801 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
802 gtk_box_pack_end(GTK_BOX(rowbox), input, FALSE, FALSE, 0);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
803 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
804 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
805 {
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
806 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
807 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
808 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
809 value = g_hash_table_lookup(defaults, pce->identifier);
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
810 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
811 gtk_entry_set_text(GTK_ENTRY(input), value);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
812 if (pce->secret)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
813 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
814 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
815 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
816 G_CALLBACK(joinchat_set_sensitive_if_input_cb), data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
817 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
818
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
819 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
820 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
821 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
822 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
823 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
824 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
825 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
826 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
827 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
828 g_object_set_data(G_OBJECT(input), "is_spin", GINT_TO_POINTER(pce->is_int));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
829 g_object_set_data(G_OBJECT(input), "required", GINT_TO_POINTER(pce->required));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
830 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
831
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
832 g_free(pce);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
833 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
834
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
835 g_list_free(list);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
836 g_hash_table_destroy(defaults);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
837
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
838 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
839 joinchat_set_sensitive_if_input_cb(NULL, data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
840
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
841 gtk_widget_show_all(data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
842 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
843
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
844 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
845 joinchat_select_account_cb(GObject *w, GaimAccount *account,
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
846 GaimGtkJoinChatData *data)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
847 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
848 if (strcmp(gaim_account_get_protocol_id(data->account),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
849 gaim_account_get_protocol_id(account)) == 0)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
850 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
851 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
852 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
853 else
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 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
856 rebuild_joinchat_entries(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 }
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 static gboolean
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
861 chat_account_filter_func(GaimAccount *account)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
862 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
863 GaimConnection *gc = gaim_account_get_connection(account);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
864 GaimPluginProtocolInfo *prpl_info = NULL;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
865
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
866 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
867
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
868 return (prpl_info->chat_info != NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
869 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
870
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
871 gboolean
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
872 gaim_gtk_blist_joinchat_is_showable()
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
873 {
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
874 GList *c;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
875 GaimConnection *gc;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
876
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
877 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
878 gc = c->data;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
879
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
880 if (chat_account_filter_func(gaim_connection_get_account(gc)))
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
881 return TRUE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
882 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
883
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
884 return FALSE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
885 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
886
8305
57bdd25752c1 [gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents: 8303
diff changeset
887 void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
888 gaim_gtk_blist_joinchat_show(void)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
889 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
890 GtkWidget *hbox, *vbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
891 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
892 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
893 GaimGtkBuddyList *gtkblist;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
894 GtkWidget *img = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
895 GaimGtkJoinChatData *data = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
896
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
897 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
898 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
899 GTK_ICON_SIZE_DIALOG);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
900 data = g_new0(GaimGtkJoinChatData, 1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
901
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
902 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
903 NULL, GTK_DIALOG_NO_SEPARATOR,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
904 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8305
diff changeset
905 GAIM_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
906 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
907 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
908 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
909 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
910 gtk_container_set_border_width(
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
911 GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), 6);
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
912 gtk_window_set_role(GTK_WINDOW(data->window), "join_chat");
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
913
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
914 hbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
915 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
916 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
917 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
918
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
919 vbox = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
920 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
921 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
922
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
923 label = gtk_label_new(_("Please enter the appropriate information "
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
924 "about the chat you would like to join.\n"));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
925 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
926 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
927 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
928
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
929 rowbox = gtk_hbox_new(FALSE, 12);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
930 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
931
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
932 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
933
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
934 label = gtk_label_new_with_mnemonic(_("_Account:"));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
935 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
936 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
937 gtk_size_group_add_widget(data->sg, label);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
938
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
939 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE,
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
940 G_CALLBACK(joinchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
941 chat_account_filter_func, data);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
942 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
943 gtk_label_set_mnemonic_widget(GTK_LABEL(label),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
944 GTK_WIDGET(data->account_menu));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
945 gaim_set_accessible_label (data->account_menu, label);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
946
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
947 data->entries_box = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
948 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
949 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
950
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
951 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
952
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
953 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
954
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
955 g_signal_connect(G_OBJECT(data->window), "response",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
956 G_CALLBACK(do_joinchat), data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
957
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
958 g_object_unref(data->sg);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
959
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
960 gtk_widget_show_all(data->window);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
961 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
962
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
963 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
964 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
965 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
966
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
967 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
968
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
969 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
970
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
971 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
972 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
973 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
974 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
975
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
976 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
977 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
978 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
979
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
980 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
981
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
982 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
983
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
984 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
985 gaim_blist_node_set_bool(node, "collapsed", TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
986 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
987 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
988 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
989 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
990
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
991 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
992 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
993 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
994 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
995
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
996 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
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 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
999 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1000
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1001 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
1002 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1003
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1004 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1005 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1006 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1007 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1008
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
1009 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1010 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1011 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1012 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1013 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1014 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1015 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1016 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1017 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1018 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1019
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1020 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1021 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1022 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
1023 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1024 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1025
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1026 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1027 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
1028 if (GAIM_BLIST_NODE_IS_BUDDY(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
1029 gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent->parent, NULL, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1030 if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
1031 gaim_blist_request_add_chat(NULL, (GaimGroup*)node->parent, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1032 else if (GAIM_BLIST_NODE_IS_GROUP(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
1033 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1034 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1035 else {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
1036 gaim_blist_request_add_chat(NULL, NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1037 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1038 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1039
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1040 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1041 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1042 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1043 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1044 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1045
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1046 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1047 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
1048 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1049 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
1050 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1051 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1052 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1053 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
1054 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1055 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1056 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1057 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1058 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1059 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1060 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1061 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1062
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1063 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1064 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1065 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1066 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
1067 gaim_gtkdialogs_remove_buddy((GaimBuddy*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1068 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
1069 gaim_gtkdialogs_remove_chat((GaimChat*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1070 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
1071 gaim_gtkdialogs_remove_group((GaimGroup*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1072 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
1073 gaim_gtkdialogs_remove_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1074 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1075 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1076
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1077 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1078 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1079 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1080 struct _gaim_gtk_blist_node *gtknode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1081 GtkTreeIter iter, parent;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1082 GaimBlistNode *bnode;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
1083 GtkTreePath *path;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1084
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1085 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1086 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1087
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1088 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1089
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1090 gtknode->contact_expanded = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1091
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1092 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1093 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1094 }
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
1095
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1096 /* 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
1097 get_iter_from_node(node, &parent);
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
1098 gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent,
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1099 gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &parent) -1);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1100 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
1101 /* Let the treeview draw so it knows where to scroll */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1102 while (gtk_events_pending())
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1103 gtk_main_iteration();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
1104 gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0);
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
1105
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1106
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1107 gaim_gtk_blist_update(NULL, node);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
1108 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1109 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1110
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1111 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1112 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1113 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1114 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1115 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1116
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1117 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1118 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1119
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1120 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1121
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1122 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1123
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1124 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1125 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1126 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1127 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1128
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1129
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1130 static void
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1131 blist_node_menu_cb(GtkMenuItem *item, GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1132 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1133 GaimBlistNodeAction *act;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1134 act = (GaimBlistNodeAction *) g_object_get_data(G_OBJECT(item),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1135 "gaimcallback");
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1136 if(act->callback)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1137 act->callback(node, act->data);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1138 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1139
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1140
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1141 static void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1142 append_blist_node_action(GtkWidget *menu, GaimBlistNodeAction *act,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1143 GaimBlistNode *node, gboolean *dup_separator)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1144 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1145 if(act == NULL) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1146 if(! *dup_separator) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1147 gaim_separator(menu);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1148 *dup_separator = TRUE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1149 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1150 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1151 GtkWidget *menuitem;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1152
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1153 if (act->children == NULL) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1154 *dup_separator = FALSE;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1155
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1156 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
11038
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1157 if (act->callback != NULL) {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1158 g_object_set_data(G_OBJECT(menuitem), "gaimcallback",
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1159 act);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1160 g_signal_connect(G_OBJECT(menuitem), "activate",
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1161 G_CALLBACK(blist_node_menu_cb), node);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1162 } else {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1163 gtk_widget_set_sensitive(menuitem, FALSE);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
1164 }
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1165 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1166 } else {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1167 GtkWidget *submenu = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1168 GList *l = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1169
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1170 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1171 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1172
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1173 submenu = gtk_menu_new();
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1174 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1175
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1176 for (l = act->children; l; l = l->next) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1177 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1178
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1179 append_blist_node_action(submenu, act, node, dup_separator);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1180
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1181 g_list_free(act->children);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1182 act->children = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1183 }
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1184 }
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1185 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1186 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1187
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1188
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1189 void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1190 gaim_gtk_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc,
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
1191 GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1192 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1193 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1194 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1195 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1196
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1197 if(!prpl_info || !prpl_info->blist_node_menu)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1198 return;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1199
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1200 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
1201 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1202 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1203 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1204 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1205 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1206
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1207
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1208 void
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1209 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
1210 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1211 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1212 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1213
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1214 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
1215 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1216 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1217 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1218 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1219 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1220
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1221
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1222 void
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1223 gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub) {
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1224 GaimPluginProtocolInfo *prpl_info;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1225 GaimContact *contact;
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1226 gboolean contact_expanded = FALSE;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1227
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1228 g_return_if_fail(menu);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1229 g_return_if_fail(buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1230
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1231 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1232
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1233 contact = gaim_buddy_get_contact(buddy);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1234 if (contact) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1235 contact_expanded = ((struct _gaim_gtk_blist_node *)(((GaimBlistNode*)contact)->ui_data))->contact_expanded;
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1236 }
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1237
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1238 if (prpl_info && prpl_info->get_info) {
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
1239 gaim_new_item_from_stock(menu, _("Get _Info"), GAIM_STOCK_INFO,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1240 G_CALLBACK(gtk_blist_menu_info_cb), buddy, 0, 0, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1241 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
1242 gaim_new_item_from_stock(menu, _("I_M"), GAIM_STOCK_IM,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1243 G_CALLBACK(gtk_blist_menu_im_cb), buddy, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1244 if (prpl_info && prpl_info->send_file) {
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1245 if (!prpl_info->can_receive_file ||
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1246 prpl_info->can_receive_file(buddy->account->gc, buddy->name))
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1247 {
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1248 gaim_new_item_from_stock(menu, _("_Send File"),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1249 GAIM_STOCK_FILE_TRANSFER,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1250 G_CALLBACK(gtk_blist_menu_send_file_cb),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1251 buddy, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1252 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
1253 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1254 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1255 G_CALLBACK(gtk_blist_menu_bp_cb), buddy, 0, 0, NULL);
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1256
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1257 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1258 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1259 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1260 contact, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1261 } else if (!sub) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1262 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1263 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1264 }
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1265
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1266 gaim_gtk_append_blist_node_proto_menu(menu, buddy->account->gc,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1267 (GaimBlistNode *)buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1268 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1269
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1270 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1271
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1272 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1273 gaim_new_item_from_stock(menu, _("_Alias Buddy..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1274 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1275 gaim_new_item_from_stock(menu, _("_Remove Buddy"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1276 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1277 gaim_new_item_from_stock(menu, _("Alias Contact..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1278 G_CALLBACK(gtk_blist_menu_alias_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1279 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1280 gaim_new_item_from_stock(menu, _("Remove Contact"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1281 G_CALLBACK(gaim_gtk_blist_remove_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1282 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1283 } else {
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1284 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1285 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1286 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1287 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1288 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1289 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1290 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1291
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1292 static gboolean
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1293 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1294 GaimBlistNode *node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1295 GValue val = { 0, };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1296 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1297 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1298
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1299 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1300 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1301 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1302
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1303 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1304 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1305 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1306
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1307 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1308 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1309 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1310
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1311 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1312 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1313 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1314 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1315 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1316 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1317 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1318 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1319 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1320 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1321
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1322 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1323 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1324
9013
d494fd1bd90b [gaim-migrate @ 9789]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
1325
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1326 static GtkWidget *
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1327 create_group_menu (GaimBlistNode *node, GaimGroup *g)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1328 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1329 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1330
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1331 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1332 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
1333 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
1334 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
1335 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
1336 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1337 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1338 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
1339 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1340
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1341 gaim_gtk_append_blist_node_extended_menu(menu, node);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1342
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1343 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1344 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1345
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1346
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1347 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1348 create_chat_menu(GaimBlistNode *node, GaimChat *c) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1349 GtkWidget *menu;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1350 gboolean autojoin;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1351
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1352 menu = gtk_menu_new();
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1353 autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1354 (gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1355
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1356 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1357 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
1358 gaim_new_check_item(menu, _("Auto-Join"),
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1359 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1360 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1361 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1362
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1363 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
1364 gaim_gtk_append_blist_node_extended_menu(menu, node);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1365
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1366 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1367
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1368 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1369 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1370 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1371 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
1372
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1373 return menu;
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 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1377 create_contact_menu (GaimBlistNode *node)
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 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1380
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1381 menu = gtk_menu_new();
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1382
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1383 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1384 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1385 node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1386
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1387 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1388
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1389 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1390 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1391 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1392 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1393
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1394 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1395
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1396 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1397 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1398 node, 0, 0, NULL);
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1399
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1400 gaim_gtk_append_blist_node_extended_menu(menu, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1401
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1402 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1403 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1404
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1405 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1406 create_buddy_menu(GaimBlistNode *node, GaimBuddy *b) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1407 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
1408 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1409 GtkWidget *menuitem;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1410 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
1411
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1412 menu = gtk_menu_new();
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1413 gaim_gtk_blist_make_buddy_menu(menu, b, FALSE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1414
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1415 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1416 gaim_separator(menu);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1417
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1418 if(gtknode->contact_expanded) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1419 gaim_new_item_from_stock(menu, _("_Collapse"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1420 GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1421 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1422 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1423 } else {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1424 gaim_new_item_from_stock(menu, _("_Expand"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1425 GTK_STOCK_ZOOM_IN,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1426 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1427 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1428 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1429 if(node->child->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1430 GaimBlistNode *bnode;
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 for(bnode = node->child; bnode; bnode = bnode->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1433 GaimBuddy *buddy = (GaimBuddy*)bnode;
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1434 GdkPixbuf *buf;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1435 GtkWidget *submenu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1436 GtkWidget *image;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1437
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1438 if(buddy == b)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1439 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1440 if(!buddy->account->gc)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1441 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1442 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1443 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1444
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1445 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1446 buf = gaim_gtk_blist_get_status_icon(bnode,
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1447 GAIM_STATUS_ICON_SMALL);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1448 image = gtk_image_new_from_pixbuf(buf);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1449 g_object_unref(G_OBJECT(buf));
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1450 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1451 image);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1452 gtk_widget_show(image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1453 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1454 gtk_widget_show(menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1455
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1456 submenu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1457 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1458 gtk_widget_show(submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1459
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1460 gaim_gtk_blist_make_buddy_menu(submenu, buddy, TRUE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1461 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1462 }
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 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1465 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1466
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1467 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1468 gaim_gtk_blist_show_context_menu(GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1469 GtkMenuPositionFunc func,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1470 GtkWidget *tv,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1471 guint button,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1472 guint32 time)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1473 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1474 struct _gaim_gtk_blist_node *gtknode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1475 GtkWidget *menu = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1476 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1477
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1478 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1479
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1480 /* Create a menu based on the thing we right-clicked on */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1481 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1482 GaimGroup *g = (GaimGroup *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1483
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1484 menu = create_group_menu(node, g);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1485 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1486 GaimChat *c = (GaimChat *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1487
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1488 menu = create_chat_menu(node, c);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1489 } else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1490 menu = create_contact_menu(node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1491 } 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
1492 GaimBuddy *b;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1493
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1494 if (GAIM_BLIST_NODE_IS_CONTACT(node))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1495 b = gaim_contact_get_priority_buddy((GaimContact*)node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1496 else
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1497 b = (GaimBuddy *)node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1498
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1499 menu = create_buddy_menu(node, b);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1500 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1501
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1502 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1503 /* Unhook the tooltip-timeout since we don't want a tooltip
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1504 * to appear and obscure the context menu we are about to show
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1505 This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1506 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1507 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1508 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1509 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1510 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1511
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1512 /* Now display the menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1513 if (menu != NULL) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1514 gtk_widget_show_all(menu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1515 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
1516 handled = TRUE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1517 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1518
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1519 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1520 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1521
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1522 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
1523 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1524 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1525 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1526 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1527 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1528 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1529 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1530 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1531 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1532 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1533
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1534 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1535 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
1536 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1537 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
1538 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
1539 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1540 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1541
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1542 /* Right click draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1543 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1544 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
1545
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1546 /* CTRL+middle click expands or collapse a contact */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1547 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1548 (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1549 if (gtknode->contact_expanded)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1550 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1551 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1552 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1553 handled = TRUE;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1554
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1555 /* Double middle click gets info */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1556 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1557 ((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
1558 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1559 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1560 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1561 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1562 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1563
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1564 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1565 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1566 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1567
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1568 if (prpl && prpl_info->get_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1569 serv_get_info(b->account->gc, b->name);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1570 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1571 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1572
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1573 #if (1)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1574 /*
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
1575 * This code only exists because GTK+ doesn't work. If we return
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1576 * FALSE here, as would be normal the event propoagates down and
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1577 * somehow gets interpreted as the start of a drag event.
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1578 *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1579 * 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
1580 * was handled? --Mark
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1581 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1582 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1583 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1584 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1585 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1586 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1587 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1588 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1589 gtk_tree_path_free(path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1590
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1591 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1592 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1593
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1594 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1595 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1596 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1597 GaimBlistNode *node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1598 GValue val = { 0, };
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1599 GtkTreeIter iter;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1600 GtkTreeSelection *sel;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1601 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1602
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1603 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1604 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1605 return FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1606
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1607 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1608 &iter, NODE_COLUMN, &val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1609 node = g_value_get_pointer(&val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1610
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1611 /* Shift+F10 draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1612 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
1613
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1614 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1615 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1616
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1617 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
1618 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1619 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1620 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1621 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1622
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1623 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
1624 GtkWidget *checkitem) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1625 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1626 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1627 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1628 while (gtk_events_pending())
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1629 gtk_main_iteration();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1630 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1631 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1632
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1633 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1634 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1635
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1636 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1637 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1638 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1639 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1640 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1641 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1642
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1643 static void gaim_gtk_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item)
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1644 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1645 gaim_prefs_set_bool("/gaim/gtk/sound/mute", GTK_CHECK_MENU_ITEM(item)->active);
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1646 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1647
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1648 static void gaim_gtk_blist_mute_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1649 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1650 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift,
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1651 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1652 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1653
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1654 static void gaim_gtk_blist_sound_method_pref_cb(const char *name, GaimPrefType type, gpointer value, gpointer data)
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1655 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1656 gboolean sensitive = TRUE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1657
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1658 if(!strcmp(value, "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1659 sensitive = FALSE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1660
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1661 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive);
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1662 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1663
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1664 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1665 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
1666 const char *alias)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1667 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1668 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1669 GaimAccount *account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1670 GaimConnection *gc;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1671
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1672 if (list == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1673 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1674
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1675 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1676 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1677 gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1678 account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1679
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1680 if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1681 break;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1682
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1683 account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1684 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1685
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1686 if (account != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1687 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1688 for (l = list; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1689 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1690 gaim_blist_request_add_buddy(account, l->data,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1691 (group ? group->name : NULL),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1692 alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1693 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1694 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1695
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1696 g_list_foreach(list, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1697 g_list_free(list);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1698 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1699
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1700 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1701 parse_vcard(const char *vcard, GaimGroup *group)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1702 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1703 char *temp_vcard;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1704 char *s, *c;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1705 char *alias = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1706 GList *aims = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1707 GList *icqs = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1708 GList *yahoos = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1709 GList *msns = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1710 GList *jabbers = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1711
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1712 s = temp_vcard = g_strdup(vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1713
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1714 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1715 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1716 char *field, *value;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1717
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1718 field = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1719
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1720 /* Grab the field */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1721 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1722 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1723
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1724 if (*s == '\r') s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1725 if (*s == '\n')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1726 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1727 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1728 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1729 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1730
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1731 if (*s != '\0') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1732
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1733 if ((c = strchr(field, ';')) != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1734 *c = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1735
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1736 /* Proceed to the end of the line */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1737 value = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1738
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1739 while (*s != '\r' && *s != '\n' && *s != '\0')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1740 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1741
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1742 if (*s == '\r') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1743 if (*s == '\n') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1744
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1745 /* We only want to worry about a few fields here. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1746 if (!strcmp(field, "FN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1747 alias = g_strdup(value);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1748 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1749 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1750 !strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1751 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1752 char **values = g_strsplit(value, ":", 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1753 char **im;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1754
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1755 for (im = values; *im != NULL; im++)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1756 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1757 if (!strcmp(field, "X-AIM"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1758 aims = g_list_append(aims, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1759 else if (!strcmp(field, "X-ICQ"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1760 icqs = g_list_append(icqs, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1761 else if (!strcmp(field, "X-YAHOO"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1762 yahoos = g_list_append(yahoos, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1763 else if (!strcmp(field, "X-MSN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1764 msns = g_list_append(msns, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1765 else if (!strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1766 jabbers = g_list_append(jabbers, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1767 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1768
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1769 g_strfreev(values);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1770 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1771 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1772
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1773 g_free(temp_vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1774
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1775 if (aims == NULL && icqs == NULL && yahoos == NULL &&
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1776 msns == NULL && jabbers == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1777 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1778 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1779 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1780
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1781 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1782 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1783
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1784 add_buddies_from_vcard("prpl-oscar", group, aims, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1785 add_buddies_from_vcard("prpl-oscar", group, icqs, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1786 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1787 add_buddies_from_vcard("prpl-msn", group, msns, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1788 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1789
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1790 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1791 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1792
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1793 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1794 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1795
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1796 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1797 static void gaim_gtk_blist_drag_begin(GtkWidget *widget,
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1798 GdkDragContext *drag_context, gpointer user_data)
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1799 {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1800 gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1801
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1802
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1803 /* Unhook the tooltip-timeout since we don't want a tooltip
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1804 * to appear and obscure the dragging operation.
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1805 * This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1806 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1807 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1808 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1809 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1810 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1811 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1812
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1813 static void gaim_gtk_blist_drag_data_get_cb(GtkWidget *widget,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1814 GdkDragContext *dc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1815 GtkSelectionData *data,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1816 guint info,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1817 guint time,
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1818 gpointer null)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1819 {
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1820
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1821 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1822 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1823 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
1824 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1825 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1826 GaimBlistNode *node = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1827 GValue val = {0};
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1828 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1829 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1830 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1831 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
1832 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1833 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1834 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1835 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1836 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1837 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1838
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1839 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1840 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1841 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
1842 {
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1843 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1844 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1845 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1846 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1847 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1848 GaimConnection *gc;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1849 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1850 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1851 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1852 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1853
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1854 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
1855 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1856
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1857 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1858 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1859
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1860 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1861 sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1862 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1863 NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1864
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1865 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1866
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1867 if (GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1868 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1869 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1870 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1871 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1872 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1873 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1874 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1875 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1876 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1877 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1878 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1879 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1880
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1881 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1882
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1883 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1884 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1885 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1886 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1887 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1888
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1889 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1890 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1891 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1892
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1893 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1894 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1895 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1896 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1897 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1898 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1899 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1900 buddy->name);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1901
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1902 if (buddy->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 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1905 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1906 buddy->alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1907 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1908
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1909 str = g_string_append(str, "\r\n");
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 mime_str = g_string_free(str, FALSE);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1912
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1913 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1914 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1915 8, /* bits */
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1916 (const guchar *)mime_str,
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1917 strlen(mime_str) + 1);
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 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1920 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1921 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1922 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1923
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1924 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
1925 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1926 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1927 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1928 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1929 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1930 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1931 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1932 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
1933 /* 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
1934 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1935 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1936 GValue val = {0};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1937 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1938
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1939 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1940 &iter, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1941 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1942 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1943 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1944 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1945
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1946 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1947 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1948 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1949 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1950 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1951 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1952 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1953 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1954 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1955 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1956 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1957 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1958 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1959 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1960 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1961 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1962 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1963 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1964 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1965 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1966 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1967 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1968 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1969 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1970 GaimBuddy *b = (GaimBuddy*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1971 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1972 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1973 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1974 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1975 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1976 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1977 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1978 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1979 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1980 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1981 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1982 node->prev);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1983 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1984 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1985 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1986 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1987 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1988 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1989 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1990 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1991 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1992 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1993 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1994 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1995 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1996 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1997 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1998 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1999 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2000 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2001 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2002 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2003 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2004 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2005 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2006 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2007 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2008 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2009 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2010 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2011 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2012 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2013 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2014 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2015 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2016 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2017 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2018 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2019 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2020 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2021 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2022 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2023 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2024 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2025 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2026 (GaimGroup*)node->parent->parent, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2027 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2028 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2029 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2030 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2031 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2032 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2033 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2034 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2035 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2036 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2037 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2038 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2039 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2040 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2041 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2042 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2043 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2044 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2045 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2046 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2047 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2048 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2049 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2050 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2051 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2052 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2053 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2054 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2055 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2056 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2057 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2058 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2059 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2060 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2061 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2062 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2063 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2064 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2065 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2066 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2067 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2068 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2069 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2070
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2071 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2072 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2073 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2074 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2075 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2076 FALSE) && sd->data)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2077 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2078 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2079 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2080 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
2081 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2082 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2083 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2084 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2085
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2086 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
2087 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2088 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2089 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2090 GaimBlistNode *node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2091 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2092
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2093 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2094 &iter, path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2095 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2096 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2097 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2098
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2099 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2100 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2101 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2102 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2103 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2104 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2105 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2106 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2107 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2108 else if (GAIM_BLIST_NODE_IS_GROUP(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2109 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2110 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2111 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2112 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2113
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
2114 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
2115 &protocol, &username, &alias))
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2116 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2117 if (account == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2118 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2119 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2120 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2121 "can add that buddy."), NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2122 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2123 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2124 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2125 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2126 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2127 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2128 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2129 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2130
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2131 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2132 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2133 if (alias != NULL) g_free(alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2134
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2135 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2136 gtk_tree_path_free(path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2137
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2138 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
2139 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2140 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
2141 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2142 gboolean result;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2143 GaimGroup *group = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2144 GtkTreePath *path = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2145 GtkTreeViewDropPosition position;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2146
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2147 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
2148 x, y, &path, &position))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2149 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2150 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2151 GaimBlistNode *node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2152 GValue val = {0};
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2153
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2154 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2155 &iter, path);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2156 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2157 &iter, NODE_COLUMN, &val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2158 node = g_value_get_pointer(&val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2159
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2160 if (GAIM_BLIST_NODE_IS_BUDDY(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2161 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2162 group = (GaimGroup *)node->parent->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2163 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2164 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2165 GAIM_BLIST_NODE_IS_CONTACT(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2166 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2167 group = (GaimGroup *)node->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2168 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2169 else if (GAIM_BLIST_NODE_IS_GROUP(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2170 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2171 group = (GaimGroup *)node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2172 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2173 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2174
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
2175 result = parse_vcard((const gchar *)sd->data, group);
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2176
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2177 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
2178 } 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
2179 GtkTreePath *path = NULL;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2180 GtkTreeViewDropPosition position;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2181
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2182 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2183 x, y, &path, &position))
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2184 {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2185 GtkTreeIter iter;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2186 GaimBlistNode *node;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2187 GValue val = {0};
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2188
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2189 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2190 &iter, path);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2191 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2192 &iter, NODE_COLUMN, &val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2193 node = g_value_get_pointer(&val);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2194
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2195 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
2196 GaimBuddy *b = GAIM_BLIST_NODE_IS_BUDDY(node) ? (GaimBuddy*)node : gaim_contact_get_priority_buddy((GaimContact*)node);
10229
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
2197 gaim_dnd_file_manage(sd, b->account, b->name);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
2198 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
2199 } else {
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
2200 gtk_drag_finish(dc, FALSE, FALSE, t);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
2201 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2202 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
2203 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2204 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2205
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2206 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBlistNode *node,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2207 gboolean scaled, gboolean greyed)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2208 {
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2209 GdkPixbuf *buf, *ret = NULL;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2210 GdkPixbufLoader *loader;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2211 GaimBuddyIcon *icon;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
2212 const guchar *data;
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
2213 gsize len;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2214 GaimBuddy *buddy = (GaimBuddy *)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2215
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2216 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2217 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2218 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2219 buddy = (GaimBuddy*)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2220 } else {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2221 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2222 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2223
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2224 #if 0
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2225 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2226 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2227 #endif
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2228
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2229 if (!(icon = gaim_buddy_get_icon(buddy)))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2230 if (!(icon = gaim_buddy_icons_find(buddy->account, buddy->name))) /* Not sure I like this...*/
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2231 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2232
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2233 loader = gdk_pixbuf_loader_new();
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2234 data = gaim_buddy_icon_get_data(icon, &len);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2235 gdk_pixbuf_loader_write(loader, data, len, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2236 buf = gdk_pixbuf_loader_get_pixbuf(loader);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2237 if (buf)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2238 g_object_ref(G_OBJECT(buf));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2239 gdk_pixbuf_loader_close(loader, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2240 g_object_unref(G_OBJECT(loader));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2241
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2242 if (buf) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2243 GaimAccount *account = gaim_buddy_get_account(buddy);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2244 GaimPluginProtocolInfo *prpl_info = NULL;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2245 int orig_width, orig_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2246 int scale_width, scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2247
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2248 if(account && account->gc)
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2249 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2250
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2251 if (greyed) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2252 GaimPresence *presence = gaim_buddy_get_presence(buddy);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2253 if (!GAIM_BUDDY_IS_ONLINE(buddy))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2254 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2255 if (gaim_presence_is_idle(presence))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2256 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2257 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2258
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2259 /* i'd use the gaim_gtk_buddy_icon_get_scale_size() thing,
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2260 * but it won't tell me the original size, which I need for scaling
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2261 * purposes */
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2262 scale_width = orig_width = gdk_pixbuf_get_width(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2263 scale_height = orig_height = gdk_pixbuf_get_height(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2264
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2265 gaim_buddy_icon_get_scale_size(prpl_info ? &prpl_info->icon_spec : NULL, &scale_width, &scale_height);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2266
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2267 if (scaled) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2268 if(scale_height > scale_width) {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2269 scale_width = 30.0 * (double)scale_width / (double)scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2270 scale_height = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2271 } else {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2272 scale_height = 30.0 * (double)scale_height / (double)scale_width;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2273 scale_width = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2274 }
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2275
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2276 ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 30, 30);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2277 gdk_pixbuf_fill(ret, 0x00000000);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2278 gdk_pixbuf_scale(buf, ret, (30-scale_width)/2, (30-scale_height)/2, scale_width, scale_height, (30-scale_width)/2, (30-scale_height)/2, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2279 } else {
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2280 ret = gdk_pixbuf_scale_simple(buf,scale_width,scale_height, GDK_INTERP_BILINEAR);
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2281 }
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2282 g_object_unref(G_OBJECT(buf));
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2283 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2284
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2285 return ret;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2286 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2287
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2288 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
2289 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2290 GtkStyle *style;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2291 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
2292 PangoLayout *layout;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2293 char *tooltiptext = gaim_get_tooltip_text(node);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2294 GdkPixbuf *avatar = NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2295 int layout_width, layout_height;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2296
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2297 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2298 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2299
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2300 avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2301
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2302 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2303 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2304 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2305 pango_layout_set_width(layout, 300000);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2306 {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2307 int w, h;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2308 pango_layout_get_size (layout, &w, &h);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2309 layout_width = PANGO_PIXELS(w) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2310 layout_height = PANGO_PIXELS(h) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2311 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2312 style = gtkblist->tipwindow->style;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2313
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2314 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2315 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
5228
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 #if GTK_CHECK_VERSION(2,2,0)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2318 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2319 0, 0, 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2320 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2321 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2322 avatar, 0, 0, layout_width + 38 + 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2323 #else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2324 gdk_pixbuf_render_to_drawable(pixbuf, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2325 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2326 gdk_pixbuf_render_to_drawable(avatar,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2327 GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, layout_width + 38 + 4,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2328 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2329 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2330
10778
e4cbe9401018 [gaim-migrate @ 12399]
Sean Egan <seanegan@gmail.com>
parents: 10738
diff changeset
2331 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2332 NULL, gtkblist->tipwindow, "tooltip", 38 + 4, 4, layout);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2333
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2334 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2335 g_object_unref (avatar);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2336
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2337 g_object_unref (pixbuf);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2338 g_object_unref (layout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2339 g_free(tooltiptext);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2340
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2341 #ifdef WANT_DROP_SHADOW
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2342 if (!xcomposite_is_present()) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2343 shadow_paint(gtkblist, NULL, EAST_SIDE);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2344 shadow_paint(gtkblist, NULL, SOUTH_SIDE);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2345 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2346 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2347
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2348 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2349 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2350
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2351 static void gaim_gtk_blist_tooltip_destroy()
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2352 {
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2353 if (gtkblist->tipwindow == NULL)
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2354 return;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2355
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2356 gtk_widget_destroy(gtkblist->tipwindow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2357 gtkblist->tipwindow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2358 #ifdef WANT_DROP_SHADOW
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2359 if (!xcomposite_is_present()) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2360 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2361 gdk_window_destroy (gtkblist->east_shadow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2362 gtkblist->east_shadow = NULL;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2363
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2364 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2365 gdk_window_destroy (gtkblist->south_shadow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2366 gtkblist->south_shadow = NULL;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2367 }
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2368 #endif
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2369 }
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2370
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2371
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2372 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2373 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2374 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2375 GtkTreeIter iter;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2376 GaimBlistNode *node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2377 GValue val = {0};
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2378 struct _gaim_gtk_blist_node *gtknode;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2379
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2380 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y, &path, NULL, NULL, NULL))
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2381 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2382 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2383 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &val);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2384 node = g_value_get_pointer(&val);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2385
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2386 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2387 gtk_tree_path_free(path);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2388 return FALSE;
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2389 }
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2390
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2391 gtknode = node->ui_data;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2392
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2393 if (!gtknode->contact_expanded) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2394 GtkTreeIter i;
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2395
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2396 gaim_gtk_blist_expand_contact_cb(NULL, node);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2397
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2398 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->contact_rect);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2399 gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2400 gtkblist->mouseover_contact = node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2401 gtk_tree_path_down (path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2402 while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2403 GdkRectangle rect;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2404 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2405 gtkblist->contact_rect.height += rect.height;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2406 gtk_tree_path_next(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2407 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2408 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2409 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2410 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2411 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2412
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2413 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2414 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2415 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2416 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2417 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2418 GValue val = {0};
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2419 int scr_w, scr_h, w, h, x, y;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2420 #if GTK_CHECK_VERSION(2,2,0)
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2421 int mon_num;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2422 GdkScreen *screen = NULL;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2423 #endif
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2424 PangoLayout *layout;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2425 gboolean tooltip_top = FALSE;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2426 char *tooltiptext = NULL;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2427 struct _gaim_gtk_blist_node *gtknode;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2428 GdkRectangle mon_size;
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2429 #ifdef WANT_DROP_SHADOW
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2430 GdkWindowAttr attr;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2431 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2432
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2433 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
2434 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2435 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2436 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
2437 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2438
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2439 gtk_tree_path_free(path);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2440
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2441 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
2442 && !GAIM_BLIST_NODE_IS_CHAT(node))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2443 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2444
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2445 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2446
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2447 tooltiptext = gaim_get_tooltip_text(node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2448
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2449 if(!tooltiptext)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2450 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2451
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2452 if(gtkblist->tipwindow)
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2453 gtk_widget_destroy(gtkblist->tipwindow);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2454 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2455 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2456 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2457 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2458 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2459 G_CALLBACK(gaim_gtk_blist_paint_tip), node);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2460 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2461
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2462 #ifdef WANT_DROP_SHADOW
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2463 if (!xcomposite_is_present()) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2464 attr.window_type = GDK_WINDOW_TEMP;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2465 attr.override_redirect = TRUE;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2466 attr.x = gtkblist->tipwindow->allocation.x;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2467 attr.y = gtkblist->tipwindow->allocation.y;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2468 attr.width = gtkblist->tipwindow->allocation.width;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2469 attr.height = gtkblist->tipwindow->allocation.height;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2470 attr.wclass = GDK_INPUT_OUTPUT;
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2471 attr.visual = gtk_widget_get_visual (gtkblist->window);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2472 attr.colormap = gtk_widget_get_colormap (gtkblist->window);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2473
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2474 attr.event_mask = gtk_widget_get_events (gtkblist->tipwindow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2475
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2476 attr.event_mask |= (GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK |
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2477 GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK );
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2478 if(gtkblist->east_shadow) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2479 gdk_window_set_user_data (gtkblist->east_shadow, NULL);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2480 gdk_window_destroy (gtkblist->east_shadow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2481 }
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2482 gtkblist->east_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2483 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2484 gdk_window_set_user_data (gtkblist->east_shadow, gtkblist->tipwindow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2485 gdk_window_set_back_pixmap (gtkblist->east_shadow, NULL, FALSE);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2486
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2487 if(gtkblist->south_shadow) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2488 gdk_window_set_user_data (gtkblist->south_shadow, NULL);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2489 gdk_window_destroy (gtkblist->south_shadow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2490 }
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2491 gtkblist->south_shadow = gdk_window_new(gtk_widget_get_root_window(gtkblist->tipwindow), &attr,
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2492 GDK_WA_NOREDIR | GDK_WA_VISUAL | GDK_WA_COLORMAP);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2493 gdk_window_set_user_data (gtkblist->south_shadow, gtkblist->tipwindow);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2494 gdk_window_set_back_pixmap (gtkblist->south_shadow, NULL, FALSE);
7897
e90d3d430798 [gaim-migrate @ 8557]
Nathan Walp <nwalp@pidgin.im>
parents: 7891
diff changeset
2495 }
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
2496 #endif /* ifdef WANT_DROP_SHADOW */
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2497
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2498 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2499 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2500 pango_layout_set_width(layout, 300000);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2501 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext));
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2502 pango_layout_get_size (layout, &w, &h);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2503
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2504 #if GTK_CHECK_VERSION(2,2,0)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2505 gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2506 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2507 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2508
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2509 scr_w = mon_size.width + mon_size.x;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2510 scr_h = mon_size.height + mon_size.y;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2511 #else
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2512 scr_w = gdk_screen_width();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2513 scr_h = gdk_screen_height();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2514 gdk_window_get_pointer(NULL, &x, &y, NULL);
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2515 mon_size.x = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2516 mon_size.y = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2517 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2518
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2519 w = PANGO_PIXELS(w) + 8;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2520 h = PANGO_PIXELS(h) + 8;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2521
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2522 /* 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
2523 * I should #define this or something */
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2524 w = w + 38;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2525 h = MAX(h, 38);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2526
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2527 /* Now the size of the buddy icon */
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2528 {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2529 GdkPixbuf *avatar = NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2530
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2531 if ((avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE))) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2532 w += gdk_pixbuf_get_width(avatar) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2533 h = MAX(h, gdk_pixbuf_get_height(avatar) + 8);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2534 g_object_unref(avatar);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2535 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2536 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2537
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2538 #if GTK_CHECK_VERSION(2,2,0)
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2539 if (w > mon_size.width)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2540 w = mon_size.width - 10;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2541
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2542 if (h > mon_size.height)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2543 h = mon_size.height - 10;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2544 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2545
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2546 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2547 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2548
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2549 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2550
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2551 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2552 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2553 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2554 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2555
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2556 if (y < mon_size.y)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2557 y = mon_size.y;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2558
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2559 if (y != mon_size.y) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2560 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2561 x -= (x + w + 5) - scr_w;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2562 else if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2563 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2564 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2565 x -= (w / 2 + 10);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2566 if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2567 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2568 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2569
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2570 g_object_unref (layout);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2571 g_free(tooltiptext);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2572 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2573 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2574 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2575
7662
63ac63ec4b46 [gaim-migrate @ 8306]
Ethan Blanton <elb@pidgin.im>
parents: 7650
diff changeset
2576 #ifdef WANT_DROP_SHADOW
10015
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2577 if (!xcomposite_is_present()) {
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2578 map_shadow_windows(gtkblist);
ab342e285f3a [gaim-migrate @ 10934]
Ethan Blanton <elb@pidgin.im>
parents: 10012
diff changeset
2579 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2580 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2581
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2582 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2583 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2584
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2585 static gboolean gaim_gtk_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context,
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2586 gint x, gint y, guint time, gpointer user_data)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2587 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2588 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2589 int delay;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2590
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2591 delay = 500;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2592
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2593 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2594 if ((y > gtkblist->tip_rect.y) && ((y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y))
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2595 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2596 /* We've left the cell. Remove the timeout and create a new one below */
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2597 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2598 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2599
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2600 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), x, y, &path, NULL, NULL, NULL);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2601 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->tip_rect);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2602
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2603 if (path)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2604 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2605 gtkblist->drag_timeout = g_timeout_add(delay, (GSourceFunc)gaim_gtk_blist_expand_timeout, tv);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2606
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2607 if (gtkblist->mouseover_contact) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2608 if ((y < gtkblist->contact_rect.y) || ((y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2609 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2610 gtkblist->mouseover_contact = NULL;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2611 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2612 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2613
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2614 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2615 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2616
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2617 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
2618 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2619 GtkTreePath *path;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2620 int delay;
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2621
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2622 delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2623
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2624 if (delay == 0)
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2625 return FALSE;
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2626
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2627 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2628 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
2629 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2630 /* 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
2631 gaim_gtk_blist_tooltip_destroy();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2632 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2633 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2634
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2635 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
2636 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
2637
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2638 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2639 gtk_tree_path_free(path);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2640 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
2641
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2642 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2643 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
2644 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2645 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2646 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2647 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2648
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2649 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2650 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2651
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2652 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
2653 {
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2654
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2655 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2656 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2657 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2658 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2659
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2660 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2661 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2662 gtkblist->drag_timeout = 0;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2663 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2664
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2665 gaim_gtk_blist_tooltip_destroy();
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2666
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2667 if (gtkblist->mouseover_contact &&
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2668 !((e->x > gtkblist->contact_rect.x) && (e->x < (gtkblist->contact_rect.x + gtkblist->contact_rect.width)) &&
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2669 (e->y > gtkblist->contact_rect.y) && (e->y < (gtkblist->contact_rect.y + gtkblist->contact_rect.height)))) {
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2670 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2671 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2672 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2673 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2674
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2675 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2676 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2677 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2678 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2679 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2680 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2681
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 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2684 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2685 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2686 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2687 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2688 /* Buddies menu */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2689 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
9714
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2690 { N_("/Buddies/New Instant _Message..."), "<CTL>M", gaim_gtkdialogs_im, 0, "<StockItem>", GAIM_STOCK_IM },
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
2691 { N_("/Buddies/Join a _Chat..."), "<CTL>C", gaim_gtk_blist_joinchat_show, 0, "<StockItem>", GAIM_STOCK_CHAT },
9714
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2692 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO },
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2693 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2694 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
11025
8d2007d738d5 [gaim-migrate @ 12899]
Mark Doliner <mark@kingant.net>
parents: 11023
diff changeset
2695 { N_("/Buddies/Show _Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>"},
8d2007d738d5 [gaim-migrate @ 12899]
Mark Doliner <mark@kingant.net>
parents: 11023
diff changeset
2696 { 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
2697 { 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
2698 { 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
2699 { 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
2700 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2701 { 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
2702
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2703 /* Tools */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2704 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2705 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
8845
48086c7bd568 [gaim-migrate @ 9612]
Mark Doliner <mark@kingant.net>
parents: 8844
diff changeset
2706 { N_("/Tools/Account Ac_tions"), NULL, NULL, 0, "<Branch>" },
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
2707 { N_("/Tools/Pl_ugin Actions"), NULL, NULL, 0, "<Branch>" },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2708 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
2709 { N_("/Tools/_Statuses"), NULL, gaim_gtk_status_window_show, 0, "<StockItem>", GAIM_STOCK_ICON_AWAY },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2710 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
2711 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
10694
06f68443e6e5 [gaim-migrate @ 12246]
Mark Doliner <mark@kingant.net>
parents: 10664
diff changeset
2712 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR },
10019
8cc6f0bfa215 [gaim-migrate @ 10943]
Luke Schierer <lschiere@pidgin.im>
parents: 10018
diff changeset
2713 { N_("/Tools/_File Transfers"), "<CTL>T", gaim_show_xfer_dialog, 0, "<StockItem>", GAIM_STOCK_FILE_TRANSFER },
10694
06f68443e6e5 [gaim-migrate @ 12246]
Mark Doliner <mark@kingant.net>
parents: 10664
diff changeset
2714 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX },
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
2715 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
2716 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>"},
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2717 { 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
2718
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2719 /* Help */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2720 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2721 { 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
2722 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
9753
60705fd4f411 [gaim-migrate @ 10620]
Mark Doliner <mark@kingant.net>
parents: 9749
diff changeset
2723 { N_("/Help/_About"), NULL, gaim_gtkdialogs_about, 0, "<StockItem>", GAIM_STOCK_ABOUT },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2724 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2725
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2726 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2727 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2728 *********************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2729
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2730 static char *gaim_get_tooltip_text(GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2731 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2732 GString *str = g_string_new("");
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2733 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2734 GaimPluginProtocolInfo *prpl_info = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2735 char *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2736
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2737 if (GAIM_BLIST_NODE_IS_CHAT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2738 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2739 GaimChat *chat;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2740 GList *cur;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2741 struct proto_chat_entry *pce;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2742 char *name, *value;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2743
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2744 chat = (GaimChat *)node;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2745 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
2746 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2747
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2748 tmp = g_markup_escape_text(gaim_chat_get_name(chat), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2749 g_string_append_printf(str, "<span size='larger' weight='bold'>%s</span>", tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2750 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2751
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2752 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2753 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2754 tmp = g_markup_escape_text(chat->account->username, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2755 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2756 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2757 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2758
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
2759 if (prpl_info->chat_info != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2760 cur = prpl_info->chat_info(chat->account->gc);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2761 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2762 cur = NULL;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2763
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2764 while (cur != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2765 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2766 pce = cur->data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2767
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2768 if (!pce->secret && (!pce->required &&
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2769 g_hash_table_lookup(chat->components, pce->identifier) == NULL))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2770 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2771 tmp = gaim_text_strip_mnemonic(pce->label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2772 name = g_markup_escape_text(tmp, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2773 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2774 value = g_markup_escape_text(g_hash_table_lookup(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2775 chat->components, pce->identifier), -1);
10924
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2776 g_string_append_printf(str, "\n<b>%s</b> %s",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2777 name ? name : "",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2778 value ? value : "");
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2779 g_free(name);
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2780 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2781 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2782
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2783 g_free(pce);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2784 cur = g_list_remove(cur, pce);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2785 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2786 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2787 else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_BUDDY(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2788 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2789 GaimContact *c;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2790 GaimBuddy *b;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2791 GaimPresence *presence;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2792 char *tmp;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2793 gboolean idle;
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2794 time_t idle_secs, signon;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2795 unsigned int warning_level;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2796
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2797 if (GAIM_BLIST_NODE_IS_CONTACT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2798 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2799 c = (GaimContact *)node;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2800 b = gaim_contact_get_priority_buddy(c);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2801 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2802 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2803 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804 b = (GaimBuddy *)node;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2805 c = gaim_buddy_get_contact(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2806 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2807
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2808 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
2809 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2810
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2811 presence = gaim_buddy_get_presence(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2812
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2813 /* Buddy Name */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2814 tmp = g_markup_escape_text(gaim_buddy_get_name(b), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2815 g_string_append_printf(str, "<span size='larger' weight='bold'>%s</span>", tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2816 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2817
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2818 /* Account */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2819 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2820 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2821 tmp = g_markup_escape_text(gaim_account_get_username(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2822 gaim_buddy_get_account(b)), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2823 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2824 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2825 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2826
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2827 /* Contact Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2828 if (GAIM_BLIST_NODE_IS_CONTACT(node) &&
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2829 (c->alias != NULL))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2830 {
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2831 tmp = g_markup_escape_text(c->alias, -1);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2832 g_string_append_printf(str, _("\n<b>Contact Alias:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2833 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2834 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2835
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2836 /* Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2837 if ((b->alias != NULL) && (b->alias[0] != '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2838 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2839 tmp = g_markup_escape_text(b->alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2840 g_string_append_printf(str, _("\n<b>Alias:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2841 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2842 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2843
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2844 /* Nickname/Server Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2845 if (b->server_alias != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2846 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2847 tmp = g_markup_escape_text(b->server_alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2848 g_string_append_printf(str, _("\n<b>Nickname:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2849 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2850 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2851
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2852 /* Logged In */
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2853 signon = gaim_presence_get_login_time(presence);
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2854 if (GAIM_BUDDY_IS_ONLINE(b) && signon > 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2855 {
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2856 tmp = gaim_str_seconds_to_string(time(NULL) - signon);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2857 g_string_append_printf(str, _("\n<b>Logged In:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2858 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2859 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2860
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2861 /* Idle */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2862 idle = gaim_presence_is_idle(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2863 if (idle)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2864 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2865 idle_secs = gaim_presence_get_idle_time(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2866 if (idle_secs > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2867 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2868 tmp = gaim_str_seconds_to_string(time(NULL) - idle_secs);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2869 g_string_append_printf(str, _("\n<b>Idle:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2870 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2871 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2872 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2873
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2874 /* Last Seen */
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2875 if (!GAIM_BUDDY_IS_ONLINE(b))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2876 {
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2877 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2878 GaimBlistNode *bnode;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2879 int lastseen = 0;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2880
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2881 if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2882 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2883 /* We're either looking at buddy for a collapsed contact or
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2884 * a contact (which is expanded) so we show the most recent
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2885 * (largest) last_seen time for any of the buddies under
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2886 * the contact. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2887 for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2888 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2889 int value = gaim_blist_node_get_int(bnode, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2890 if (value > lastseen)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2891 lastseen = value;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2892 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2893 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2894 else
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2895 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2896 /* We're dealing with a buddy under an expanded contact,
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2897 * so we show the last_seen time for the buddy. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2898 lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2899 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2900
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2901 if (lastseen > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2902 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2903 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2904 g_string_append_printf(str, _("\n<b>Last Seen:</b> %s ago"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2905 g_free(tmp);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2906 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2907 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2908
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2909 /* Warning */
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
2910 warning_level = gaim_presence_get_warning_level(presence);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2911 if (warning_level > 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2912 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2913 tmp = g_strdup_printf(_("%d%%"), warning_level);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2914 g_string_append_printf(str, _("\n<b>Warned:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2915 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2916 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2917
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2918 /* Offline? */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2919 if (!GAIM_BUDDY_IS_ONLINE(b)) {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2920 g_string_append_printf(str, _("\n<b>Status:</b> Offline"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2921 }
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2922
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2923 if (prpl_info && prpl_info->tooltip_text)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2924 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2925 /* Additional text from the PRPL */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2926 const char *end;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2927 tmp = prpl_info->tooltip_text(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2928
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2929 if (tmp && !g_utf8_validate(tmp, -1, &end))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2930 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2931 char *new = g_strndup(tmp, g_utf8_pointer_to_offset(tmp, end));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2932 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2933 tmp = new;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2934 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2935
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2936 g_string_append(str, tmp);
10476
d02e70b5d197 [gaim-migrate @ 11763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10475
diff changeset
2937 g_free(tmp);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2938 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2939
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2940 /* These are Easter Eggs. Patches to remove them will be rejected. */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2941 if (!g_ascii_strcasecmp(b->name, "robflynn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2942 g_string_append(str, _("\n<b>Description:</b> Spooky"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2943 if (!g_ascii_strcasecmp(b->name, "seanegn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2944 g_string_append(str, _("\n<b>Status:</b> Awesome"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2945 if (!g_ascii_strcasecmp(b->name, "chipx86"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2946 g_string_append(str, _("\n<b>Status:</b> Rockin'"));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2947 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2948
8824
f08245ed03aa [gaim-migrate @ 9587]
Sean Egan <seanegan@gmail.com>
parents: 8823
diff changeset
2949 gaim_signal_emit(gaim_gtk_blist_get_handle(),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
2950 "drawing-tooltip", node, str);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2951
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2952 return g_string_free(str, FALSE);
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
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2955 struct _emblem_data {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9949
diff changeset
2956 const char *filename;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2957 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2958 int y;
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
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2961 GdkPixbuf *
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2962 gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2963 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2964 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2965 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2966 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2967 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2968 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2969 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2970 {NULL, 0, 0}, {NULL, 15, 0}};
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2971 GaimPresence *presence = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2972 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2973 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2974
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2975 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2976 if(!gtknode->contact_expanded)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2977 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2978 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2979 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2980 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2981 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2982 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2983 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2984 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2985
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2986 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2987 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2988 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2989 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2990
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2991 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2992 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2993 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2994 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2995
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2996 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2997 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2998 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2999
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3000 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3001
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3002 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3003 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3004 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3005 if(prpl_info && prpl_info->list_emblems && buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3006 if(buddy->present != GAIM_BUDDY_SIGNING_OFF)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3007 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3008 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3009 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3010 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3011 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3012
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3013 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3014 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3015 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3016 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3017 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3018
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3019 if(buddy && buddy->present == GAIM_BUDDY_SIGNING_ON) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3020 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
3021 } else if(buddy && buddy->present == GAIM_BUDDY_SIGNING_OFF) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3022 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
3023 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3024 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3025 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3026 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3027 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3028 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3029 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3030 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3031
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3032 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3033 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3034
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3035 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3036 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3037
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3038 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3039 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3040 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3041
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3042 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3043 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3044 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3045 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3046 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3047 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3048 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3049 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3050 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3051 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3052 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3053 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3054 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3055 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3056 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3057 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3058 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3059 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3060 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3061 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3062 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3063 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3064 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3065 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3066 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3067 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3068 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3069 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3070 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3071 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3072
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3073 if(buddy) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3074 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3075
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3076 if (!GAIM_BUDDY_IS_ONLINE(buddy))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3077 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3078 else if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3079 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3080 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3081 }
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3082
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3083 if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy)))
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3084 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3085 GdkPixbuf *emblem;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3086 char *filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "blocked.png", NULL);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3087
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3088 emblem = gdk_pixbuf_new_from_file(filename, NULL);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3089 g_free(filename);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3090
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3091 if (emblem)
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3092 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3093 gdk_pixbuf_composite(emblem, scale,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3094 0, 0, scalesize, scalesize,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3095 0, 0,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3096 (double)scalesize / gdk_pixbuf_get_width(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3097 (double)scalesize / gdk_pixbuf_get_height(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3098 GDK_INTERP_BILINEAR,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3099 224);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3100 g_object_unref(emblem);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3101 }
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
3102 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3103 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3104
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3105 return scale;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3106 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3107
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3108 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
3109 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3110 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3111 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3112 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3113 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3114 GaimContact *contact;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3115 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3116 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3117 char *idletime = NULL, *warning = NULL, *statustext = NULL;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3118 unsigned int warning_level;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3119 time_t t;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3120 /* XXX Clean up this crap */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3121
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3122 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3123 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3124 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3125
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3126 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3127 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3128 else
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
3129 name = gaim_buddy_get_alias(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3130 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3131
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
3132 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3133
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3134 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3135 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3136
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3137 presence = gaim_buddy_get_presence(b);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3138
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3139 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3140
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3141 if ((gaim_presence_is_idle(presence) || !GAIM_BUDDY_IS_ONLINE(b)) && !selected)
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3142 {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3143 text = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3144 dim_grey(), esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3145 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3146 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3147 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3148 else
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3149 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3150 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3151
8122
36674144c510 [gaim-migrate @ 8826]
Christian Hammond <chipx86@chipx86.com>
parents: 8113
diff changeset
3152 if (prpl_info && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3153 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3154 const char *end;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3155
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3156 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3157 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3158 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3159 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3160 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3161 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3162
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
3163 #if !GTK_CHECK_VERSION(2,6,0)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3164 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3165 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3166 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3167 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3168 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3169 g_strdelimit(tmp, "\n", ' ');
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3170 gaim_str_strip_cr(tmp);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3171
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3172 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3173 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3174 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3175 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3176 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3177 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3178 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3179 c = g_utf8_next_char(c); /* this is fun */
5228
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
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3182 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3183
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3184 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3185 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3186 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3187 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3188
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3189 statustext = g_strdup_printf(buf, tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3190
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3191 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3192 }
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
3193 #else
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
3194 statustext = tmp;
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
3195 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3196 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3197
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3198 if (gaim_presence_is_idle(presence)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3199 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3200
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3201 if (idle_secs > 0) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3202 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3203
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3204 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3205 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3206 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3207
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3208 if (ihrs)
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3209 idletime = g_strdup_printf(_("Idle (%dh %02dm) "), ihrs, imin);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3210 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3211 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3212 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3213 else
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3214 idletime = g_strdup(_("Idle "));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3215 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3216
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3217 warning_level = gaim_presence_get_warning_level(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3218
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3219 if (warning_level > 0) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3220 warning = g_strdup_printf(_("Warned (%d%%) "), warning_level);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3221 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3222
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3223 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3224 statustext = g_strdup(_("Offline "));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3225
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3226 if (gaim_presence_is_idle(presence) && !selected) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3227 text = g_strdup_printf("<span color='%s'>%s</span>\n"
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3228 "<span color='%s' size='smaller'>%s%s%s%s%s</span>",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3229 dim_grey(), esc, dim_grey(),
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3230 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3231 (idletime != NULL && statustext != NULL) ? " - " : "",
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3232 idletime != NULL ? idletime : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3233 (warning != NULL && (statustext != NULL || idletime != NULL)) ? " - " : "",
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3234 warning != NULL ? warning : "");
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3235 } else if (statustext == NULL && idletime == NULL && warning == NULL &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3236 GAIM_BUDDY_IS_ONLINE(b)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3237 text = g_strdup(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3238 } else {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3239 if (selected)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3240 text = g_strdup_printf("%s\n"
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3241 "<span size='smaller'>%s%s%s%s%s</span>", esc,
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3242 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3243 (idletime != NULL && statustext != NULL) ? " - " : "",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3244 idletime != NULL ? idletime : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3245 (warning != NULL && (statustext != NULL || idletime != NULL)) ? " - " : "",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3246 warning != NULL ? warning : "");
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3247 else
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3248 text = g_strdup_printf("%s\n"
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3249 "<span color='%s' size='smaller'>%s%s%s%s%s</span>", esc,
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
3250 dim_grey(),
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3251 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3252 (idletime != NULL && statustext != NULL) ? " - " : "",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3253 idletime != NULL ? idletime : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
3254 (warning != NULL && (statustext != NULL || idletime != NULL)) ? " - " : "",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3255 warning != NULL ? warning : "");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3256 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3257 if (idletime)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3258 g_free(idletime);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3259 if (warning)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3260 g_free(warning);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3261 if (statustext)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3262 g_free(statustext);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3263 if (esc)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3264 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3265
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3266 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3267 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3268
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3269 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3270 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3271 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3272
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3273 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3274
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3275 /* 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
3276 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3277 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3278 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3279
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3280 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3281 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3282 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3283
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3284 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3285 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3286 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3287 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3288 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3289
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3290 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3291 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3292 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3293 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3294
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3295 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3296 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3297 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3298 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3299 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3300
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3301 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3302 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3303 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3304
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3305 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3306 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3307 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3308 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3309 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3310 GaimBuddy *buddy;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3311
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3312 buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3313
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3314 if (buddy &&
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3315 gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3316 gaim_gtk_blist_update(list, cnode);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3317 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3318 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3319 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3320
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3321 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3322 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3323 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3324
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3325 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
3326 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3327 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
3328 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3329
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3330 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3331 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3332
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3333 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3334 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3335
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3336 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3337 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3338 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
3339 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3340 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3341 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3342 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3343 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3344 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3345 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3346
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3347 static const char *require_connection[] =
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3348 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3349 N_("/Buddies/New Instant Message..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3350 N_("/Buddies/Join a Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3351 N_("/Buddies/Get User Info..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3352 N_("/Buddies/Add Buddy..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3353 N_("/Buddies/Add Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3354 N_("/Buddies/Add Group..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3355 };
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3356
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3357 static const int require_connection_size = sizeof(require_connection)
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3358 / sizeof(*require_connection);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3359
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3360 /**
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3361 * Rebuild dynamic menus and make menu items sensitive/insensitive
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3362 * where appropriate.
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3363 */
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3364 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3365 update_menu_bar(GaimGtkBuddyList *gtkblist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3366 {
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3367 GtkWidget *widget;
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3368 gboolean sensitive;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3369 int i;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3370
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3371 g_return_if_fail(gtkblist != NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3372
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3373 gaim_gtk_blist_update_protocol_actions();
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8222
diff changeset
3374 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3375
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3376 sensitive = (gaim_connections_get_all() != NULL);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3377
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3378 for (i = 0; i < require_connection_size; i++)
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3379 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3380 widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3381 gtk_widget_set_sensitive(widget, sensitive);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3382 }
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3383
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3384 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
3385 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3386
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3387 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
3388 gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
8938
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3389
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3390 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3391 gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable());
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3392 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3393
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3394 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3395 sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3396 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3397 GaimGtkBuddyList *gtkblist = GAIM_GTK_BLIST(blist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3398
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3399 update_menu_bar(gtkblist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3400 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3401
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3402 static void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3403 plugin_changed_cb(GaimPlugin *p, gpointer *data)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3404 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3405 gaim_gtk_blist_update_plugin_actions();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3406 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3407
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3408 /**********************************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3409 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3410 **********************************************************************************/
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
3411
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3412 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3413 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3414 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3415
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3416 gtkblist = g_new0(GaimGtkBuddyList, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3417 blist->ui_data = gtkblist;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3418 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3419
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3420 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3421 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3422 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3423 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3424
11018
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3425 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3426 {
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3427 if GAIM_BLIST_NODE_IS_BUDDY(node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3428 node = node->parent;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3429
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3430 g_return_val_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node), FALSE);
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3431
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3432 return ((struct _gaim_gtk_blist_node *)node->ui_data)->contact_expanded;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3433 }
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3434
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3435 void gaim_gtk_blist_update_columns()
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 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3438 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3439
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3440 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3441 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3442 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3443 gtk_tree_view_column_set_visible(gtkblist->warning_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3444 } else {
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3445 gtk_tree_view_column_set_visible(gtkblist->idle_column, TRUE);
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3446 gtk_tree_view_column_set_visible(gtkblist->warning_column, TRUE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3447 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3448 }
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
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3451 enum {
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3452 DRAG_BUDDY,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3453 DRAG_ROW,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3454 DRAG_VCARD,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3455 DRAG_TEXT,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3456 DRAG_URI,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3457 NUM_TARGETS
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3458 };
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3459
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3460 static char *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3461 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3462 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3463 return _((char *)path);
5228
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
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3466 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3467 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3468 gaim_gtk_blist_sort_method_reg("none", _("None"), sort_method_none);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3469 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3470 gaim_gtk_blist_sort_method_reg("alphabetical", _("Alphabetical"), sort_method_alphabetical);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3471 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
3472 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
3473 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3474 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
3475 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3476
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3477 static void _prefs_change_redo_list()
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3478 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3479 redo_buddy_list(gaim_get_blist(), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3480 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3481
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3482 static void _prefs_change_sort_method(const char *pref_name, GaimPrefType type,
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3483 gpointer val, gpointer data)
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3484 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3485 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3486 gaim_gtk_blist_sort_method_set(val);
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
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3489 /*
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3490 * "This is so dead sexy."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3491 * "Two thumbs up."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3492 * "Best movie of the year."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3493 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3494 * This is the function that handles CTRL+F searching in the buddy list.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3495 * It finds the top-most buddy/group/chat/whatever containing the
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3496 * entered string.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3497 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3498 * It's somewhat ineffecient, because we strip all the HTML from the
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3499 * "name" column of the buddy list (because the GtkTreeModel does not
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3500 * contain the screen name in a non-markedup format). But the alternative
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3501 * is to add an extra column to the GtkTreeModel. And this function is
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3502 * used rarely, so it shouldn't matter TOO much.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3503 */
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3504 static gboolean
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3505 _search_func(GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer search_data)
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3506 {
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3507 gboolean result;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3508 gchar *enteredstring;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3509 gchar *withmarkup;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3510 gchar *nomarkup;
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3511 const gchar *normalized;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3512
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3513 gtk_tree_model_get(model, iter, column, &withmarkup, -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3514
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3515 enteredstring = g_strdup(gaim_normalize(NULL, key));
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3516 nomarkup = gaim_markup_strip_html(withmarkup);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3517 normalized = gaim_normalize(NULL, nomarkup);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3518
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3519 result = (g_strstr_len(normalized, strlen(normalized), enteredstring) == NULL);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3520
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3521 g_free(withmarkup);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3522 g_free(enteredstring);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3523 g_free(nomarkup);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3524
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3525 return result;
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3526 }
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3527
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3528 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3529 {
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3530 void *handle;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3531 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3532 GtkTreeViewColumn *column;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3533 GtkWidget *menu;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3534 GtkWidget *sw;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3535 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3536 GtkTreeSelection *selection;
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3537 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
3538 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3539 {"text/x-vcard", 0, DRAG_VCARD },
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3540 {"text/uri-list", 0, DRAG_URI},
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3541 {"text/plain", 0, DRAG_TEXT}};
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3542 GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3543 {"application/x-im-contact", 0, DRAG_BUDDY},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3544 {"text/x-vcard", 0, DRAG_VCARD }};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3545 if (gtkblist && gtkblist->window) {
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3546 if (gaim_prefs_get_bool("/gaim/gtk/blist/list_visible") || docklet_count == 0)
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3547 gtk_widget_show(gtkblist->window);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3548 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3549 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3550
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3551 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3552
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3553 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3554 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
9746
3a71d70e3945 [gaim-migrate @ 10611]
Luke Schierer <lschiere@pidgin.im>
parents: 9737
diff changeset
3555 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3556
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3557 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3558 gtk_widget_show(gtkblist->vbox);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3559 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3560
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3561 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
3562 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
3563 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
3564 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3565
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3566 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3567 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3568 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3569 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3570 gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<GaimMain>", accel_group);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3571 gtk_item_factory_set_translate_func(gtkblist->ift,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3572 item_factory_translate_func,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3573 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3574 gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3575 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3576 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3577 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3578 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3579 menu = gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>");
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3580 gtk_widget_show(menu);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3581 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), menu, FALSE, FALSE, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3582
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3583 gtkblist->bpmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounce"));
8844
76013c5ef153 [gaim-migrate @ 9611]
Luke Schierer <lschiere@pidgin.im>
parents: 8824
diff changeset
3584 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Account Actions"));
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3585 pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Plugin Actions"));
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3586
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3587 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3588 sw = gtk_scrolled_window_new(NULL,NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3589 gtk_widget_show(sw);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3590 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
3591 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
3592
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3593 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3594 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN, G_TYPE_STRING,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3595 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
3596
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3597 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3598 gtk_widget_show(gtkblist->treeview);
9176
7dc10a14c568 [gaim-migrate @ 9971]
Luke Schierer <lschiere@pidgin.im>
parents: 9113
diff changeset
3599 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3600
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3601 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3602 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3603 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
3604
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3605 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3606 gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3607 GDK_BUTTON1_MASK, ste, 3,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3608 GDK_ACTION_COPY);
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3609 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3610 dte, 5,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3611 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3612
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
3613 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
3614 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(gaim_gtk_blist_drag_data_get_cb), NULL);
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3615 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3616 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-begin", G_CALLBACK(gaim_gtk_blist_drag_begin), NULL);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3617 #endif
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3618
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3619 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-motion", G_CALLBACK(gaim_gtk_blist_drag_motion_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3620
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3621 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3622 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
3623 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
3624
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3625 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3626
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3627 gtkblist->text_column = column = gtk_tree_view_column_new ();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3628
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3629 rend = gtk_cell_renderer_pixbuf_new();
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3630 gtk_tree_view_column_pack_start(column, rend, FALSE);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3631 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3632 "pixbuf", STATUS_ICON_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3633 "visible", STATUS_ICON_VISIBLE_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3634 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3635 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3636
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3637 gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3638 gtk_tree_view_column_pack_start (column, rend, TRUE);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3639 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3640 "markup", NAME_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3641 NULL);
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3642 g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3643 g_signal_connect(G_OBJECT(rend), "editing-started", G_CALLBACK(gtk_blist_edit_starting), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3644 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3645 #if GTK_CHECK_VERSION(2,6,0)
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3646 gtk_tree_view_column_set_expand (column, TRUE);
10501
4806967e093e [gaim-migrate @ 11793]
Sean Egan <seanegan@gmail.com>
parents: 10499
diff changeset
3647 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3648 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3649 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3650
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3651 rend = gtk_cell_renderer_text_new();
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3652 gtkblist->idle_column = gtk_tree_view_column_new_with_attributes("Idle", rend, "markup", IDLE_COLUMN, NULL);
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3653 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->idle_column);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3654 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3655
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3656 rend = gtk_cell_renderer_text_new();
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3657 gtkblist->warning_column = gtk_tree_view_column_new_with_attributes("Warning", rend, "markup", WARNING_COLUMN, NULL);
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3658 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->warning_column);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3659 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3660
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3661 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3662 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
3663 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3664 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
3665
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3666 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
3667 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
3668 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
3669 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
3670 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
3671 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
3672
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3673 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3674 gtk_tree_view_set_search_column(GTK_TREE_VIEW(gtkblist->treeview), NAME_COLUMN);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3675 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview), _search_func, NULL, NULL);
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3676
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3677 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3678 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3679 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3680
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
3681 gtkblist->statusbox = gtk_gaim_status_box_new();
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
3682
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
3683 gtk_widget_show(gtkblist->statusbox);
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
3684 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3685
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3686 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3687 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3688 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3689 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
3690 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3691 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
3692 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3693 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))),
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3694 gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3695 if(!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3696 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3697
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3698 /* Update some dynamic things */
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3699 update_menu_bar(gtkblist);
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3700 gaim_gtk_blist_update_plugin_actions();
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3701
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3702 /* OK... let's show this bad boy. */
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3703 if (gaim_prefs_get_bool("/gaim/gtk/blist/list_visible") || docklet_count == 0) {
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3704 gaim_gtk_blist_refresh(list);
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3705 gaim_gtk_blist_restore_position();
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3706 gtk_widget_show(gtkblist->window);
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3707 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3708
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3709 /* start the refresh timer */
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3710 gtkblist->refresh_timer = g_timeout_add(30000, (GSourceFunc)gaim_gtk_blist_refresh_timer, list);
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3711
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3712 handle = gaim_gtk_blist_get_handle();
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3713
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3714 /* things that affect how buddies are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3715 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3716 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3717 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_empty_groups",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3718 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3719 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_offline_buddies",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3720 _prefs_change_redo_list, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3721
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3722 /* sorting */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3723 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/sort_type",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3724 _prefs_change_sort_method, NULL);
7620
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 /* things that affect what columns are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3727 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3728 gaim_gtk_blist_update_columns, NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3729
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3730 /* menus */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3731 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/mute",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3732 gaim_gtk_blist_mute_pref_cb, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3733 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/method",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3734 gaim_gtk_blist_sound_method_pref_cb, NULL);
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3735
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3736 /* Setup some gaim signal handlers. */
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3737 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3738 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3739 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3740 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3741
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3742 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3743 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3744 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3745 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3746
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3747 /* emit our created signal */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3748 gaim_signal_emit(handle, "gtkblist-created", list);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3749 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3750
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3751 /* XXX: does this need fixing? */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3752 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3753 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3754 GaimBlistNode *gnode, *cnode, *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3755
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3756 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3757 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3758 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3759 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3760 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3761 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3762 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3763
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3764 for(bnode = cnode->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3765 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3766 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3767 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3768 gaim_gtk_blist_hide_node(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3769 gaim_gtk_blist_update(list, bnode);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3772 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3773 } else if(GAIM_BLIST_NODE_IS_CHAT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3774 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3775 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3776
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3777 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3778 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3779 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3780 gaim_gtk_blist_update(list, gnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3781 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3782 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3783
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3784 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3785 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3786 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3787 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3788
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3789 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3790 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3791 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3792 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3793 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3794
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3795 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3796 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3797
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3798 gtkblist->refresh_timer = g_timeout_add(30000,(GSourceFunc)gaim_gtk_blist_refresh_timer, blist);
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3799 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3800
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3801 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3802 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
3803 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3804
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3805 if (!gtknode) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3806 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3807 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3808
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3809 if (!gtkblist) {
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3810 gaim_debug_error("gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3811 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3812 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3813
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3814 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3815 return FALSE;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3816
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3817
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3818 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3819 return FALSE;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3820
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3821 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
3822 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3823 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3824 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3825 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3826 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3827 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3828
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3829 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3830 {
10222
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3831 gaim_request_close_with_handle(node);
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3832
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3833 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3834
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3835 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3836 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3837
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3838 /* There's something I don't understand here - Ethan */
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3839 /* Ethan said that back in 2003, but this g_free has been left commented
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3840 * out ever since. I can't find any reason at all why this is bad and
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3841 * valgrind found several reasons why it's good. If this causes problems
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3842 * comment it out again. Stu */
10510
1044c0930e03 [gaim-migrate @ 11808]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
3843 /* Of course it still causes problems - this breaks dragging buddies into
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3844 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3845 /* I think it's fixed now. Stu. */
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3846 g_free(node->ui_data);
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3847 node->ui_data = NULL;
5228
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 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3851 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3852 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3853
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3854 /* 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
3855 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3856 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3857 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3858 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3859 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3860 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3861 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3862 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3863
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3864 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3865 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3866
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3867 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3868 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3869 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3870 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3871
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3872 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3873 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3874 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3875 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3876
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3877 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3878 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3879 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3880
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3881 static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
7620
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 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3884 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3885 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3886
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3887 if(!iter)
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3888 return FALSE;
7620
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 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
3891 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3892
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3893 if(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3894 curptr = &cur;
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 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
3897 *iter = current_sort_method->func(node, list, parent_iter, curptr);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3898 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3899 *iter = sort_method_none(node, list, parent_iter, curptr);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3900 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3901
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3902 if(gtknode != NULL) {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3903 gtk_tree_row_reference_free(gtknode->row);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3904 } else {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3905 gaim_gtk_blist_new_node(node);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3906 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3907 }
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3908
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3909 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3910 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3911 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3912 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3913 newpath);
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3914
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3915 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3916
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3917 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3918 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3919 -1);
7620
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 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3922 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3923 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3924
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3925 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3926 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3927 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
3928 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3929 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3930 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
3931 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3932 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3933 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
3934 gtk_tree_path_free(expand);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3935 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3936 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3937
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3938 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3939 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3940
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3941 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
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 GaimGroup *group;
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3944 int count;
7620
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 g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3947
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3948 group = (GaimGroup*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3949
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3950 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3951 count = gaim_blist_get_group_size(group, FALSE);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3952 else
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3953 count = gaim_blist_get_group_online_count(group);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3954 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
3955 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3956 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3957
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3958 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3959 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3960
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3961 esc = g_markup_escape_text(group->name, -1);
8945
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3962 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3963 esc, gaim_blist_get_group_online_count(group),
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3964 gaim_blist_get_group_size(group, FALSE));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3965 g_free(esc);
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 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3968 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3969 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3970 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3971 NODE_COLUMN, node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3972 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3973 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3974 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3975 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3976 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3977 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3978
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3979 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3980 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3981 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3982 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3983 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3984 char *warning = NULL, *idle = NULL;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3985 unsigned int warning_level;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3986 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3987
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3988 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3989
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3990 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3991 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3992 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3993
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
3994 avatar = gaim_gtk_blist_get_buddy_icon((GaimBlistNode *)buddy, TRUE, TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3995 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3996
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3997 if (gaim_presence_is_idle(presence))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3998 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3999 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4000
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4001 if (idle_secs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4002 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4003 time_t t;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4004 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4005 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4006 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4007 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4008
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4009 if (ihrs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4010 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4011 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4012 idle = g_strdup_printf("(%d)", imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4013 }
7620
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
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4016 warning_level = gaim_presence_get_warning_level(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4017
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4018 if (warning_level > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4019 warning = g_strdup_printf("%d%%", warning_level);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4020
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4021 if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4022 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4023 if (warning && !selected) {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4024 char *w2 = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4025 dim_grey(), warning);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4026 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4027 warning = w2;
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
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4030 if (idle && !selected) {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4031 char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4032 dim_grey(), idle);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4033 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4034 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4035 }
7620
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4038 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4039 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4040 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4041 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4042 WARNING_COLUMN, warning,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4043 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4044 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4045 -1);
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 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048 if(idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4050 if(warning)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4051 g_free(warning);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4053 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4054 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4055 g_object_unref(avatar);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4058 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
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 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4061 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4062 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4063
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4065
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4066 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4067 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4068
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4069 contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4070 buddy = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4071
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4072 if (buddy && (gaim_presence_is_online(buddy->presence) ||
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4073 (gaim_account_is_connected(buddy->account) &&
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4074 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4075 gaim_blist_node_get_bool(node, "show_offline")))
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4076 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4077 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4078
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4079 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4080 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4081
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4082 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4083
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4084 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4085 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4086 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4087
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4088 status = gaim_gtk_blist_get_status_icon(node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4089 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4090 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4091
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4092 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4094 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4095 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4097 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4098 WARNING_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4099 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4100 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4101 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4102 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4103 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4104 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4105 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4106 buddy_node(buddy, &iter, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4107 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4108 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4109 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4110 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4111 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4112
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4113 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
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 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4116 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4117 struct _gaim_gtk_blist_node *gtkparentnode;
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 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4120
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4121 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4122 contact = (GaimContact*)node->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4123
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4124 /* First things first, update the contact */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4125 gaim_gtk_blist_update_contact(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4126
10918
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4127 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4128
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4129 if (gtkparentnode->contact_expanded &&
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4130 (gaim_presence_is_online(buddy->presence) ||
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4131 (gaim_account_is_connected(buddy->account) &&
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4132 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4133 gaim_blist_node_get_bool(node->parent, "show_offline")))
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4134 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4135 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4136
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4137 if (!insert_node(list, node, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4138 return;
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4139
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4140 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4141
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4142 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4143 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4144 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4145
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4146 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4147
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4148 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4149 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4150 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4151
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4152 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4153
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4154 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4155 gaim_gtk_blist_update_group(list, node->parent);
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 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4161 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4162 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4163
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4164 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4165 return;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4166
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4167 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4168 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4169 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
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 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
4172
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4173 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4174 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4176 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4177 -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4178
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4179 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4180 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4181 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4182 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
4183 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4184 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4185 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4186
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4187 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4188 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4189 if(!gtkblist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4190 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4191
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4192 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4193 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4194 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4195 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4196 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4197 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4198 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4199 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4200 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4201 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4202 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4203 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4204 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4205 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4206 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4207 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4208
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4209 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4210 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4211
7620
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 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4214 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4215 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4216 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4217
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4218 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4219 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4220 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4221 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
4222
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4223 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4224
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
4225 gaim_gtk_blist_tooltip_destroy();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4226
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4227 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4228 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4229 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4230 g_source_remove(gtkblist->timeout);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4231 if (gtkblist->drag_timeout)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4232 g_source_remove(gtkblist->drag_timeout);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4233
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4234 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4235 gtkblist->timeout = 0;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4236 gtkblist->drag_timeout = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4237 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4238 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4239 gtkblist->idle_column = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4240 gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
4241 g_object_unref(G_OBJECT(gtkblist->ift));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4242 protomenu = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4243 pluginmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4244 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4245
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
4246 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle());
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4247 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4248
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4249 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4250 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4251 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4252 return;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
4253
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
4254 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", show);
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
4255
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4256 if (show) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4257 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4258 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4259 } else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4260 if (!gaim_connections_get_all() || docklet_count) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4261 #ifdef _WIN32
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4262 wgaim_systray_minimize(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4263 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4264 gtk_widget_hide(gtkblist->window);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4265 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4266 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4267 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4268 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4269 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4270
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4272 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4273 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4274 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4275 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4276 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4277 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4279 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4280 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4281 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4282 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4283 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4284 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4285 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4286 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4287 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4288 gnode = gnode->next)
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 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
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 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4293 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4294 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4295 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4296 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4297 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4298
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4299 return tmp;
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4302 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4303 add_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4304 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4305 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4306 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4307 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4308 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4309
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4310 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4311 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4312 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4313 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4314 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4315
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4316 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4317 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4318 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4319 const char *grp, *who, *whoalias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4320 GaimConversation *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4321 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4322 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4323
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4324 if (resp == GTK_RESPONSE_OK)
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 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4327 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
4328 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
4329 if (*whoalias == '\0')
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
4330 whoalias = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4331
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4332 if ((g = gaim_find_group(grp)) == NULL)
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 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4335 gaim_blist_add_group(g, NULL);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4338 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4339 gaim_blist_add_buddy(b, NULL, g, NULL);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4340 serv_add_buddy(gaim_account_get_connection(data->account), b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4341
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4342 /*
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4343 * XXX
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
4344 * 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
4345 * 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
4346 * gaim_blist_add_buddy() function. Maybe serv_add_buddy() should be
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
4347 * 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
4348 * gaim_blist_add_buddy() after it creates it. --Mark
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4349 *
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4350 * 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
4351 * 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
4352 * and gaim_blist_add_buddy(). Or something. --Mark
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4353 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4354
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4355 c = gaim_find_conversation_with_account(GAIM_CONV_IM, who, data->account);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4356 if (c != NULL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4357 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
4358 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4359 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4360 }
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 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4363 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4364
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4365 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4366 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4367 const char *group, const char *alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4368 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4369 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4370 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4371 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4372 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4373 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4374 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4375 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4376
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4377 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4378 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4379 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4380 : gaim_connection_get_account(gaim_connections_get_all()->data));
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 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4383 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4384
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4385 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
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 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4388 NULL, GTK_DIALOG_NO_SEPARATOR,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4389 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4390 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4391 NULL);
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 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
4394 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4395 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4396 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
4397 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
4398 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4399 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4400 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
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 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4403 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4404 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4405 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4406
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4407 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4408 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4409
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4410 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4411 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4412 "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
4413 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4414 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4415
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4416 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4417 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4418 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4419 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4420
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4421 hbox = gtk_hbox_new(FALSE, 6);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4422 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4423
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4424 g_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4425 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4426
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4427 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4428 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4429 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4430 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4431 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4432
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4433 label = gtk_label_new(_("Screen Name:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4434 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4435 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
4436
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4437 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4438 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
4439 gtk_widget_grab_focus(data->entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4440
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4441 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4442 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4443
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4444 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4445 gaim_set_accessible_label (data->entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4446
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4447 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4448 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4449 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
4450
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4451 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4452 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4453 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4454
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4455 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4456 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4457
10734
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4458 if (username != NULL)
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4459 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4460
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4461 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
4462 gaim_set_accessible_label (data->entry_for_alias, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4463
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4464 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4465 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4466 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
4467
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4468 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4469 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4470 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
4471 gaim_set_accessible_label (data->combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4472
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4473 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4474 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4475 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4476 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
4477
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4478 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4479 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4480
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4481 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
4482 gaim_set_accessible_label (data->account_box, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4483 /* End of account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4484
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4485 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4486 G_CALLBACK(add_buddy_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4487
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4488 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4489
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4490 if (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4491 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
4492 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4493
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4494 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4495 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4496 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4497 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4498 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4499 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4500 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4501 const char *group_name;
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4502 char *chat_name = NULL;
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4503 GaimConversation *conv = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4504 const char *value;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4505
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4506 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
4507 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4508
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4509 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4510 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4511 if (g_object_get_data(tmp->data, "is_spin"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4512 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4513 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4514 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4515 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4516 gtk_spin_button_get_value_as_int(tmp->data)));
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 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4519 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4520 value = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4521 if (*value != '\0')
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4522 g_hash_table_replace(components,
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4523 g_strdup(g_object_get_data(tmp->data, "identifier")),
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4524 g_strdup(value));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4525 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4526 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4527
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4528 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4529 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4530 components);
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 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
4533
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4534 if ((group = gaim_find_group(group_name)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4535 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4536 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4537 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4538 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4539
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4540 if (chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4541 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4542 gaim_blist_add_chat(chat, group, NULL);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4543
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4544 if (GAIM_PLUGIN_PROTOCOL_INFO(data->account->gc->prpl)->get_chat_name != NULL)
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4545 chat_name = GAIM_PLUGIN_PROTOCOL_INFO(
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4546 data->account->gc->prpl)->get_chat_name(chat->components);
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4547
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4548 if (chat_name != NULL) {
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4549 conv = gaim_find_conversation_with_account(GAIM_CONV_CHAT,
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4550 chat_name,
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4551 data->account);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4552 g_free(chat_name);
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4553 }
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4554
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4555 if (conv != NULL)
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4556 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ADD);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4557 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4558
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4559 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4560 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4561 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4562 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4563 }
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 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4566 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4567 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4568 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4569 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4570 add_chat_cb(NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4571 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4572 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4573 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4574 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4575 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4576 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4577 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4578 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4579 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4580
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4581 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4582 * Check the values of all the text entry boxes. If any required input
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4583 * strings are empty then don't allow the user to click on "OK."
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4584 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4585 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4586 addchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4587 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4588 GaimGtkAddChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4589 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4590 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4591 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4592 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4593
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4594 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4595
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4596 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4597 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4598 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4599 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4600 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4601 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4602 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4603 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4604 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4605 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4606
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4607 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window), GTK_RESPONSE_OK, sensitive);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4608 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4609
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4610 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4611 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4612 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4613 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4614 GList *list = NULL, *tmp = NULL;
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4615 GHashTable *defaults = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4616 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4617 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4618
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4619 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4620
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4621 gc = gaim_account_get_connection(data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4622
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4623 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4624 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4625 gtk_container_remove(GTK_CONTAINER(data->entries_box),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4626 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
7620
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4629 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4630 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4631
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4632 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4633
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4634 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4635 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4636
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4637 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4638 defaults = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, data->default_chat_name);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4639
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4640 for (tmp = list; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4641 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4642 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4643 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4644 GtkWidget *input;
7620
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 pce = tmp->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4647
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4648 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4649 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
4650
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
4651 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4652 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4653 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4654 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4655
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4656 if (pce->is_int)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4657 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4658 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4659 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4660 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4661 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4662 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4663 gtk_box_pack_end(GTK_BOX(rowbox), input, FALSE, FALSE, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4664 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4665 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4666 {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4667 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4668 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4669 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4670 value = g_hash_table_lookup(defaults, pce->identifier);
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4671 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4672 gtk_entry_set_text(GTK_ENTRY(input), value);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4673 if (pce->secret)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4674 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4675 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4676 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4677 G_CALLBACK(addchat_set_sensitive_if_input_cb), data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4678 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4679
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4680 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4681 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4682 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4683 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4684 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4685 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4686 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4687 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4688 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4689 g_object_set_data(G_OBJECT(input), "is_spin", GINT_TO_POINTER(pce->is_int));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4690 g_object_set_data(G_OBJECT(input), "required", GINT_TO_POINTER(pce->required));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4691 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4692
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4693 g_free(pce);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4694 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4695
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4696 g_list_free(list);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4697 g_hash_table_destroy(defaults);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4698
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4699 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4700 addchat_set_sensitive_if_input_cb(NULL, data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4701
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4702 gtk_widget_show_all(data->entries_box);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4703 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4704
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4705 static void
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4706 addchat_select_account_cb(GObject *w, GaimAccount *account,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4707 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4708 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4709 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4710 gaim_account_get_protocol_id(account)) == 0)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4711 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4712 data->account = account;
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 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4715 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4716 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4717 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4718 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4719 }
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 void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4722 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4723 const char *alias, const char *name)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4724 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4725 GaimGtkAddChatData *data;
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4726 GaimGtkBuddyList *gtkblist;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4727 GList *l;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4728 GaimConnection *gc;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4729 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4730 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4731 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4732 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4733 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4734
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4735 if (account != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4736 gc = gaim_account_get_connection(account);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4737
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4738 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4739 gaim_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4740 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4741 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4742 } else {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4743 /* Find an account with chat capabilities */
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4744 for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4745 gc = (GaimConnection *)l->data;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4746
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4747 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4748 account = gaim_connection_get_account(gc);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4749 break;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4750 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4751 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4752
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4753 if (account == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4754 gaim_notify_error(NULL, NULL,
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4755 _("You are not currently signed on with any "
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4756 "protocols that have the ability to chat."), NULL);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4757 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4758 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4759 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4760
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4761 data = g_new0(GaimGtkAddChatData, 1);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4762 data->account = account;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4763 data->default_chat_name = g_strdup(name);
7620
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 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4766 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4767
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4768 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4769
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4770 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4771
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4772 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4773 NULL, GTK_DIALOG_NO_SEPARATOR,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4774 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4775 GTK_STOCK_ADD, GTK_RESPONSE_OK,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4776 NULL);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4777
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4778 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
4779 gtk_container_set_border_width(GTK_CONTAINER(data->window), 6);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4780 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4781 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
4782 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
4783 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4784 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4785 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4786
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4787 hbox = gtk_hbox_new(FALSE, 12);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4788 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4789 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4790 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4791
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4792 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4793 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4794
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4795 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4796 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4797 "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
4798 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4799 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4800 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4801 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4802
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4803 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4804 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4805
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4806 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4807 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4808 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4809 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4810
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4811 data->account_menu = gaim_gtk_account_option_menu_new(account, FALSE,
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4812 G_CALLBACK(addchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
4813 chat_account_filter_func, data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4814 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
4815 gaim_set_accessible_label (data->account_menu, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4816
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4817 data->entries_box = gtk_vbox_new(FALSE, 5);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4818 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4819 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
4820
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4821 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4822
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4823 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4824 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4825
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4826 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4827 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4828 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4829 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4830
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4831 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4832 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4833 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4834 gtk_box_pack_end(GTK_BOX(rowbox), data->alias_entry, TRUE, TRUE, 0);
10311
b7566fc34c6c [gaim-migrate @ 11505]
Mark Doliner <mark@kingant.net>
parents: 10297
diff changeset
4835 gtk_entry_set_activates_default(GTK_ENTRY(data->alias_entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4836 gaim_set_accessible_label (data->alias_entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4837
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4838 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4839 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4840
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4841 label = gtk_label_new(_("Group:"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4842 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4843 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4844 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4845
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4846 data->group_combo = gtk_combo_new();
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4847 gtk_combo_set_popdown_strings(GTK_COMBO(data->group_combo), groups_tree());
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4848 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
4849
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4850 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4851 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4852 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
4853 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4854 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4855 gaim_set_accessible_label (data->group_combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4856
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4857 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4858 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4859
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4860 gtk_widget_show_all(data->window);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4863 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4864 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4865 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4866 GaimGroup *group;
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4867
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4868 group = gaim_group_new(group_name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4869 gaim_blist_add_group(group, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4870 }
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 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4873 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4874 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
4875 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4876 _("Please enter the name of the group to be added."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
4877 NULL, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4878 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4879 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4880 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4881
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4882 void gaim_gtk_blist_docklet_toggle() {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4883 /* 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
4884 /* 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
4885 buddy list/login window--depending on which is active */
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4886 if (gtkblist && gtkblist->window) {
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4887 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4888 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gaim_gtk_blist_obscured);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4889 } else {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4890 #if _WIN32
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4891 wgaim_systray_maximize(gtkblist->window);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4892 #endif
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4893 gaim_blist_set_visible(TRUE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4894 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4895 } else {
10315
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4896 /* we're logging in or something... do nothing */
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4897 /* or should I make the blist? */
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4898 gaim_debug_warning("gtkblist",
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4899 "docklet_toggle called with gaim_connections_get_all() "
deec4b58d516 [gaim-migrate @ 11515]
Sean Egan <seanegan@gmail.com>
parents: 10311
diff changeset
4900 "but no blist!\n");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4901 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4902 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4903
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4904 void gaim_gtk_blist_docklet_add()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4905 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4906 docklet_count++;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4907 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4908
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4909 void gaim_gtk_blist_docklet_remove()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4910 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4911 docklet_count--;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4912 if (!docklet_count) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4913 gaim_blist_set_visible(TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4914 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4915 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4916
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4917 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4918 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4919 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4920 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4921 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4922 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4923 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4924 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4925 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4926 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4927 gaim_gtk_blist_request_add_chat,
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
4928 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4929 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4930
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4931
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4932 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4933 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4934 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4935 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4936 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4937
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4938 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist()
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4939 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4940 return gtkblist;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4941 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4942
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4943 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4944 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4945 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4946 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4947 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4948 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4949 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4950 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4951 for(cnode = gnode->child; cnode; cnode = cnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4952 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4953 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4954
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4955 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4956 continue;
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 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4959
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4960 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4961 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4962
8197
7c45eb829340 [gaim-migrate @ 8919]
Nathan Walp <nwalp@pidgin.im>
parents: 8143
diff changeset
4963 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
8198
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4964 (gaim_blist_node_get_string((GaimBlistNode*)chat,
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4965 "gtk-autojoin") != NULL))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4966 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4967 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4968 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4969 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4970
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4971 void *
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4972 gaim_gtk_blist_get_handle() {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4973 static int handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4974
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4975 return &handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4976 }
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4977
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4978 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4979 {
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4980 void *gtk_blist_handle = gaim_gtk_blist_get_handle();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4981
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11031
diff changeset
4982 gaim_debug_register_category("gtkblist");
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11031
diff changeset
4983
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4984 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4985 gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4986 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4987
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4988 /* Initialize prefs */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4989 gaim_prefs_add_none("/gaim/gtk/blist");
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4990 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4991 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4992 gaim_prefs_add_bool("/gaim/gtk/blist/show_offline_buddies", FALSE);
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
4993 gaim_prefs_add_bool("/gaim/gtk/blist/list_visible", TRUE);
9711
b0ddfeccb9e6 [gaim-migrate @ 10572]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
4994 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "alphabetical");
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4995 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4996 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
9778
3d40125495e3 [gaim-migrate @ 10646]
Mark Doliner <mark@kingant.net>
parents: 9775
diff changeset
4997 gaim_prefs_add_int("/gaim/gtk/blist/width", 309); /* Golden ratio, baby */
3d40125495e3 [gaim-migrate @ 10646]
Mark Doliner <mark@kingant.net>
parents: 9775
diff changeset
4998 gaim_prefs_add_int("/gaim/gtk/blist/height", 500); /* Golden ratio, baby */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4999 gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
5000
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5001 /* Register our signals */
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5002 gaim_signal_register(gtk_blist_handle, "gtkblist-created",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5003 gaim_marshal_VOID__POINTER, NULL, 1,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5004 gaim_value_new(GAIM_TYPE_SUBTYPE,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5005 GAIM_SUBTYPE_BLIST));
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5006
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5007 gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5008 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5009 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_NODE),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
5010 gaim_value_new_outgoing(GAIM_TYPE_BOXED, "GString *"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5011 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5012
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5013 void
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5014 gaim_gtk_blist_uninit(void) {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5015 gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11031
diff changeset
5016
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11031
diff changeset
5017 gaim_debug_unregister_category("gtkblist");
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5018 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5019
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5020 /*********************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5021 * Public utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5022 *********************************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5023
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5024 GdkPixbuf *
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10860
diff changeset
5025 gaim_gtk_create_prpl_icon(GaimAccount *account)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5026 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5027 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5028 GaimPluginProtocolInfo *prpl_info = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5029 GdkPixbuf *status = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5030 char *filename = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5031 const char *protoname = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5032 char buf[256];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5033
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
5034 g_return_val_if_fail(account != NULL, NULL);
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
5035
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
5036 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5037
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5038 if (prpl != NULL) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5039 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5040
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5041 if (prpl_info->list_icon != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5042 protoname = prpl_info->list_icon(account, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5043 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5044
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5045 if (protoname == NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5046 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5047
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5048 /*
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5049 * Status icons will be themeable too, and then it will look up
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5050 * protoname from the theme
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5051 */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5052 g_snprintf(buf, sizeof(buf), "%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5053
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5054 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5055 "default", buf, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5056 status = gdk_pixbuf_new_from_file(filename, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5057 g_free(filename);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5058
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5059 return status;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5060 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5061
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5062
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5063 /*********************************************************************
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5064 * Buddy List sorting functions *
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5065 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5066
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5067 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
5068 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5069 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
5070 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5071 method->name = g_strdup(name);
9775
4c1a1be8ce33 [gaim-migrate @ 10643]
Mark Doliner <mark@kingant.net>
parents: 9774
diff changeset
5072 method->func = func;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5073 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
5074 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5075
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5076 void gaim_gtk_blist_sort_method_unreg(const char *id){
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5077 GSList *l = gaim_gtk_blist_sort_methods;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5078
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5079 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5080 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5081 if(!strcmp(method->id, id)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5082 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
5083 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5084 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5085 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5086 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5087 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5088 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5089 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5090
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5091 void gaim_gtk_blist_sort_method_set(const char *id){
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5092 GSList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5093
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5094 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5095 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5096
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5097 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
5098 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5099
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5100 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5101 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5102 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5103 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5104 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5105 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5106 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5107
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5108 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5109
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5110 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5111 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5112 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5113
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5114 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
5115 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5116 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5117 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5118 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5119
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5120 if(cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5121 return *cur;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5122
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5123 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5124 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5125 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5126
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5127 gtk_tree_store_insert_after(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5128 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5129 sibling ? &sibling_iter : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5130
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5131 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5132 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5133
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5134 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5135
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5136 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
5137 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5138 GtkTreeIter more_z, iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5139 GaimBlistNode *n;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5140 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5141
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5142 const char *my_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5143
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5144 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5145 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5146 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5147 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5148 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5149 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5150 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5151
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5152
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5153 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
5154 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5155 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5156 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5157
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5158 do {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5159 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5160 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5161
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5162 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
5163 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5164
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5165 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5166 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5167 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5168 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5169 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5170 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5171 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5172
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5173 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5174
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5175 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5176 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5177 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5178 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5179 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5180 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5181 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5182 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5183 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5184 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5185 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5186 } 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
5187
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5188 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5189 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5190 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5191 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5192 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5193 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5194 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5195 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5196
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5197 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
5198 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5199 GtkTreeIter more_z, iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5200 GaimBlistNode *n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5201 GValue val = {0,};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5202
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5203 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5204
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5205 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5206 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5207 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5208 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5209 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5210
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5211 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5212 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5213 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5214 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5215 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5216
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5217
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5218 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
5219 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5220 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5221 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5222
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5223 do {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5224 gint name_cmp;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5225 gint presence_cmp;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5226
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5227 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
5228 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5229
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5230 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5231 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5232 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5233 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5234 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5235
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5236 name_cmp = gaim_utf8_strcasecmp(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5237 (my_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5238 ? gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5239 : NULL),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5240 (this_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5241 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5242 : NULL));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5243
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5244 presence_cmp = gaim_presence_compare(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5245 gaim_buddy_get_presence(my_buddy),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5246 gaim_buddy_get_presence(this_buddy));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5247
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5248 if (this_buddy == NULL ||
10860
d01d81de94d8 [gaim-migrate @ 12543]
Mark Doliner <mark@kingant.net>
parents: 10850
diff changeset
5249 (presence_cmp < 0 ||
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5250 (presence_cmp == 0 &&
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5251 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5252 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5253 if (cur != NULL)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5254 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5255 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5256 return *cur;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5257 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5258 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5259 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5260 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5261 &groupiter, &more_z);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5262 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5263 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5264 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5265
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5266 g_value_unset(&val);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5267 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5268 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5269 &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5270
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5271 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5272 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5273 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5274 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5275 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5276 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5277 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5278 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5279
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5280 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
5281 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5282 GtkTreeIter more_z, iter;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5283 GaimBlistNode *n = NULL, *n2;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5284 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5285
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5286 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5287 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5288
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5289 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
5290 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5291
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5292 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5293 for (n = node->child; n; n = n->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5294 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
5295 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5296 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5297 /* 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
5298 * from the chat info in the blist, yet */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5299 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5300 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5301
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5302 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5303 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5304 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5305 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5306 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5307
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5308
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5309 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
5310 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5311 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5312 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5313
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5314 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5315 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5316
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5317 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
5318 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5319 this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5320
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5321 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5322 for (n2 = n->child; n2; n2 = n2->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5323 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
5324 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5325 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5326 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5327 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5328
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5329 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5330
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5331 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
5332 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5333 (cmp < 0 || (cmp == 0 && node < n)))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5334 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5335 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5336 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5337 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5338 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5339 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5340 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5341 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5342 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5343 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5344 } 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
5345
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5346 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5347 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5348 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5349 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5350 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5351 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5352 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5353 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5354
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5355 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5356
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5357 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5358 plugin_act(GtkObject *obk, GaimPluginAction *pam)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5359 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
5360 if (pam->callback)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
5361 pam->callback(pam);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5362 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5363
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5364 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5365 build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin, gpointer context)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5366 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5367 GtkWidget *menuitem = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5368 GaimPluginAction *action = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5369 GList *l, *ll;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5370
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5371 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
5372 if (l->data) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5373 action = (GaimPluginAction *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5374 action->plugin = plugin;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5375 action->context = context;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5376
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5377 menuitem = gtk_menu_item_new_with_label(action->label);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5378 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5379 g_signal_connect(G_OBJECT(menuitem), "activate",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5380 G_CALLBACK(plugin_act), action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5381 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5382 gtk_widget_show(menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5383 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5384 else
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5385 gaim_separator(menu);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5386 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5387
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5388 g_list_free(ll);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5389 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5390
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5391
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5392 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5393 gaim_gtk_blist_update_protocol_actions(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5394 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5395 GtkWidget *menuitem, *submenu;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5396 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5397 GaimConnection *gc = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5398 GaimPlugin *plugin = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5399 int count = 0;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5400
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5401 if (protomenu == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5402 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5403
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5404 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5405 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
5406 GaimPluginAction *action;
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
5407
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5408 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5409 action = (GaimPluginAction *) g_object_get_data(G_OBJECT(menuitem),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5410 "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5411 g_free(action);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5412
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5413 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5414 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5415
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5416 /* Count the number of accounts with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5417 for (l = gaim_connections_get_all(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5418 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5419 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5420
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5421 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5422 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5423
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5424 /* no need to count past 2, so don't */
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5425 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5426 break;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5427 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5428
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5429 if (count == 0) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5430 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5431 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5432 gtk_widget_set_sensitive(menuitem, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5433 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5434 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5435
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5436 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5437 /* Find the one account that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5438 for (l = gaim_connections_get_all(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5439 gc = l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5440 plugin = gc->prpl;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5441
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5442 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5443 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5444 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5445
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5446 build_plugin_actions(protomenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5447 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5448
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5449 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5450 for (l = gaim_connections_get_all(); l; l = l->next) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5451 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5452 GdkPixbuf *pixbuf, *scale;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5453 GtkWidget *image;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5454 char *buf;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5455
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5456 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5457 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5458
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5459 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
5460 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5461
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5462 account = gaim_connection_get_account(gc);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5463 buf = g_strconcat(gaim_account_get_username(account), " (",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5464 plugin->info->name, ")", NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5465 menuitem = gtk_image_menu_item_new_with_label(buf);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5466 g_free(buf);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5467
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10860
diff changeset
5468 pixbuf = gaim_gtk_create_prpl_icon(account);
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5469 if (pixbuf) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5470 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5471 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5472 image = gtk_image_new_from_pixbuf(scale);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5473 g_object_unref(G_OBJECT(pixbuf));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5474 g_object_unref(G_OBJECT(scale));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5475 gtk_widget_show(image);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5476 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
5477 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5478
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5479 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5480 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5481
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5482 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5483 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5484 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5485
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5486 build_plugin_actions(submenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5487 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5488 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5489 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5490
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5491 void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5492 gaim_gtk_blist_update_plugin_actions(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5493 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5494 GtkWidget *menuitem, *submenu;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5495 GaimPlugin *plugin = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5496 GList *l;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5497 int count = 0;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5498
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5499 if (pluginmenu == NULL)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5500 return;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5501
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5502 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5503 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
5504 GaimPluginAction *action;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5505
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5506 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5507 action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5508 g_free(action);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5509
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5510 gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(menuitem));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5511 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5512
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5513 /* Count the number of plugins with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5514 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5515 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5516
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5517 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5518 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5519
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5520 /* no need to count past 2, so don't */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5521 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5522 break;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5523 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5524
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5525 if (count == 0) {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5526 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5527 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5528 gtk_widget_set_sensitive(menuitem, FALSE);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5529 gtk_widget_show(menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5530 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5531
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5532 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5533 /* Find the one plugin that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5534 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5535 plugin = (GaimPlugin *) l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5536
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5537 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5538 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5539 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5540
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5541 build_plugin_actions(pluginmenu, plugin, NULL);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5542 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5543
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5544 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5545 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5546 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5547
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5548 if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5549 continue;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5550
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5551 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5552 continue;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5553
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5554 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
5555 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5556 gtk_widget_show(menuitem);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5557
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5558 submenu = gtk_menu_new();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5559 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5560 gtk_widget_show(submenu);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5561
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5562 build_plugin_actions(submenu, plugin, NULL);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5563 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5564 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5565 }