annotate src/gtkblist.c @ 12264:2be62353f708

[gaim-migrate @ 14566] this was TRUE in oldstatus committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 29 Nov 2005 23:50:39 +0000
parents b7a51e68d0b8
children 234c25bc5d49
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"
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
39 #include "gtkstock.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
40 #include "util.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
41
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
42 #include "gtkaccount.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
43 #include "gtkblist.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
44 #include "gtkconv.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
45 #include "gtkdebug.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9686
diff changeset
46 #include "gtkdialogs.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
47 #include "gtkft.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
48 #include "gtklog.h"
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
49 #include "gtkmenutray.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
50 #include "gtkpounce.h"
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 11732
diff changeset
51 #include "gtkplugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
52 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
53 #include "gtkprivacy.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
54 #include "gtkroomlist.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
55 #include "gtkstatusbox.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
56 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
57
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
60 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
61
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
62 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
63 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
64 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
65
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
66 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
67 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
68 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
69 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
70 GtkWidget *account_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
72 } GaimGtkAddBuddyData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
73
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
74 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
75 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
76 GaimAccount *account;
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
77 gchar *default_chat_name;
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
78
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
79 GtkWidget *window;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84 GtkSizeGroup *sg;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
85
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
86 GList *entries;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
87
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
88 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
89
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
90 typedef struct
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
91 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
92 GaimAccount *account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
93
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
94 GtkWidget *window;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
95 GtkWidget *account_menu;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
96 GtkWidget *entries_box;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
97 GtkSizeGroup *sg;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
98
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
99 GList *entries;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
100 } GaimGtkJoinChatData;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
101
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
102
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
103 static GtkWidget *protomenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
105 static guint visibility_manager_count = 0;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
106 static gboolean gtk_blist_obscured = FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
107
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
108 static GList *gaim_gtk_blist_sort_methods = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
109 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
110 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
111
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
112 /* 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
113 * 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
114 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
115 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
116 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
117 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
118 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
119 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
121 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 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
123 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
124 static char *gaim_get_tooltip_text(GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 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
126 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
127 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
128 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
129
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
130 static void gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
131
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
132 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
133 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
134 gboolean contact_expanded;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
135 gboolean recent_signonoff;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
136 gint recent_signonoff_timer;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
137 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
138
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
139
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
140 static char dim_grey_string[8] = "";
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
141 static char *dim_grey()
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
142 {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
143 if (!gtkblist)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
144 return "dim grey";
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
145 if (!dim_grey_string[0]) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
146 GtkStyle *style = gtk_widget_get_style(gtkblist->treeview);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
147 snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
148 style->text_aa[GTK_STATE_NORMAL].red >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
149 style->text_aa[GTK_STATE_NORMAL].green >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
150 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
151 }
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
152 return dim_grey_string;
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
153 }
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
154
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 * Callbacks *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 ***************************************************/
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
158 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
159 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
160 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
161 gtk_blist_obscured = TRUE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
162 else
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
163 gtk_blist_obscured = FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
164
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
165 /* continue to handle event normally */
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
166 return FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
167 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
168
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
169 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
170 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
171 if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
172 if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
173 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", FALSE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
174 else
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
175 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", TRUE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
176 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
177
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
178 return FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
179 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
183 if(visibility_manager_count)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
184 gaim_blist_set_visible(FALSE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
185 else
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
186 gaim_core_quit();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 * 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
196 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
197 * 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
198 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 gint x, y;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
203 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
205 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
206 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
207
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
208 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
209 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
210 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
211 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
212 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
213
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
214 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
217 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
218 if (x + event->width < 0 ||
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
219 y + event->height < 0 ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
220 x > gdk_screen_width() ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
221 y > gdk_screen_height()) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
222
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
223 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
224 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
225
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
226 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
227 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
228 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
229 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
230 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
231
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
236 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
241 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 {
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
243 gaim_gtkdialogs_im_with_user(b->account, b->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
246 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
247 {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
248 serv_send_file(b->account->gc, b->name, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
249 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
250
12024
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
251 static void gtk_blist_menu_voice_chat_cb(GtkWidget *w, GaimBuddy *b)
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
252 {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
253 serv_voice_chat(b->account->gc, b->name);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
254 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
255
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
256 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
257 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
258 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
259 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
260 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
261
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
262 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
264 serv_join_chat(chat->account->gc, chat->components);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
265 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
266
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
267 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
268 char *arg2, gpointer nada)
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
269 {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
270 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
271 GtkTreePath *path;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
272 GValue val = {0,};
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
273 GaimBlistNode *node;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
274
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
275 path = gtk_tree_path_new_from_string (arg1);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
276 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
277 gtk_tree_path_free (path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
278 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
279 node = g_value_get_pointer(&val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
280 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
281 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
282 switch (node->type){
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
283 case GAIM_BLIST_CONTACT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
284 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
285 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
286 case GAIM_BLIST_BUDDY_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
287 gaim_blist_alias_buddy((GaimBuddy*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
288 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
289 case GAIM_BLIST_GROUP_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
290 gaim_blist_rename_group((GaimGroup*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
291 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
292 case GAIM_BLIST_CHAT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
293 gaim_blist_alias_chat((GaimChat*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
294 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
295 default:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
296 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
297 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
298 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
299
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
300 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
301 {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
302 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
303 GtkTreePath *path;
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
304 const char *text = NULL;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
305
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
306 if (!(get_iter_from_node(node, &iter))) {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
307 /* 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
308 node = node->parent;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
309 if (!get_iter_from_node(node, &iter))
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
310 /* Now it's definitely a bug */
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
311 return;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
312 }
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
313
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
314 switch (node->type) {
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
315 case GAIM_BLIST_BUDDY_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
316 text = gaim_buddy_get_alias((GaimBuddy *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
317 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
318 case GAIM_BLIST_CONTACT_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
319 text = gaim_buddy_get_alias(gaim_contact_get_priority_buddy((GaimContact *)node));
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
320 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
321 case GAIM_BLIST_GROUP_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
322 text = ((GaimGroup *)node)->name;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
323 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
324 case GAIM_BLIST_CHAT_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
325 text = gaim_chat_get_name((GaimChat *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
326 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
327 default:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
328 g_return_if_reached();
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
329 }
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
330
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
331 gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, text, -1);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
332
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
333 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
334 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
335 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
336 gtk_widget_grab_focus(gtkblist->treeview);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
337 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
338 gtk_tree_path_free(path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
341 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 {
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
343 gaim_gtk_pounce_editor_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
346 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 {
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
348 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
349 GaimLogType type;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
350 GaimAccount *account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
351 char *name = NULL;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
352
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
353 gdk_window_set_cursor(gtkblist->window->window, cursor);
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
354 gdk_cursor_unref(cursor);
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
355 while (gtk_events_pending())
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
356 gtk_main_iteration();
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
357
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
358 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
359 GaimBuddy *b = (GaimBuddy*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
360 type = GAIM_LOG_IM;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
361 name = g_strdup(b->name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
362 account = b->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
363 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
364 GaimChat *c = (GaimChat*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
365 GaimPluginProtocolInfo *prpl_info = NULL;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
366 type = GAIM_LOG_CHAT;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
367 account = c->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
368 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
369 if (prpl_info && prpl_info->get_chat_name) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
370 name = prpl_info->get_chat_name(c->components);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
371 }
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
372 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
373 gaim_gtk_log_show_contact((GaimContact *)node);
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
374 gdk_window_set_cursor(gtkblist->window->window, NULL);
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
375 return;
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
376 } else {
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
377 gdk_window_set_cursor(gtkblist->window->window, NULL);
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
378
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
379 /* This callback should not have been registered for a node
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
380 * that doesn't match the type of one of the blocks above. */
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
381 g_return_if_reached();
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
382 }
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
383
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
384 if (name && account) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
385 gaim_gtk_log_show(type, name, account);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
386 g_free(name);
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
387
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
388 gdk_window_set_cursor(gtkblist->window->window, NULL);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
389 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
390 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
391
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
392 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
393 {
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8470
diff changeset
394 gaim_gtk_syslog_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
395 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
396
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
397 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
398 {
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10229
diff changeset
399 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
402 static void
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
403 do_join_chat(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
404 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
405 if (data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
406 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
407 GHashTable *components =
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
408 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
409 GList *tmp;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
410
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
411 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
412 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
413 if (g_object_get_data(tmp->data, "is_spin"))
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
414 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
415 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
416 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
417 g_strdup_printf("%d",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
418 gtk_spin_button_get_value_as_int(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
419 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
420 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
421 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
422 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
423 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
424 g_strdup(gtk_entry_get_text(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
425 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
426 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
427
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
428 serv_join_chat(gaim_account_get_connection(data->account), components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
429
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
430 g_hash_table_destroy(components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
431 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
432 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
433
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
434 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
435 do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
436 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
437 switch(id)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
438 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
439 case GTK_RESPONSE_OK:
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
440 do_join_chat(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
441
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
442 break;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
443 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
444
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
445 gtk_widget_destroy(GTK_WIDGET(dialog));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
446 g_list_free(info->entries);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
447 g_free(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
448 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
449
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
450 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
451 * 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
452 * 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
453 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
454 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
455 joinchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
456 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
457 GaimGtkJoinChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
458 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
459 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
460 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
461 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
462
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
463 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
464
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
465 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
466 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
467 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
468 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
469 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
470 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
471 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
472 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
473 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
474 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
476 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
477 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
478
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
479 static void
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
480 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
481 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
482 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
483 GList *list = NULL, *tmp = NULL;
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
484 GHashTable *defaults = NULL;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
485 struct proto_chat_entry *pce;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
486 gboolean focus = TRUE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
487
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
488 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
489
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
490 gc = gaim_account_get_connection(data->account);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
491
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
492 while (GTK_BOX(data->entries_box)->children)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
493 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
494 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
495 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
496 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
497
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
498 if (data->entries != NULL)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
499 g_list_free(data->entries);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
500
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
501 data->entries = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
502
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
503 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
504 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
505
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
506 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
507 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
508
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
509 for (tmp = list; tmp; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
510 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
511 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
512 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
513 GtkWidget *input;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
514
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
515 pce = tmp->data;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
516
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
517 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
518 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
519
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
520 label = gtk_label_new_with_mnemonic(pce->label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
521 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
522 gtk_size_group_add_widget(data->sg, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
523 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
524
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
525 if (pce->is_int)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
526 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
527 GtkObject *adjust;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
528 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
529 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
530 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
531 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
532 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
533 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
534 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
535 {
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
536 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
537 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
538 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
539 value = g_hash_table_lookup(defaults, pce->identifier);
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
540 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
541 gtk_entry_set_text(GTK_ENTRY(input), value);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
542 if (pce->secret)
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
543 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
544 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
545 gtk_entry_set_invisible_char(GTK_ENTRY(input), GAIM_INVISIBLE_CHAR);
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
546 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
547 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
548 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
549 G_CALLBACK(joinchat_set_sensitive_if_input_cb), data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
550 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
551
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
552 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
553 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
554 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
555 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
556 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
557 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
558 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
559 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
560 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
561 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
562 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
563 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
564
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
565 g_free(pce);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
566 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
567
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
568 g_list_free(list);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
569 g_hash_table_destroy(defaults);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
570
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
571 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
572 joinchat_set_sensitive_if_input_cb(NULL, data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
573
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
574 gtk_widget_show_all(data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
575 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
576
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
577 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
578 joinchat_select_account_cb(GObject *w, GaimAccount *account,
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
579 GaimGtkJoinChatData *data)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
580 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
581 if (strcmp(gaim_account_get_protocol_id(data->account),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
582 gaim_account_get_protocol_id(account)) == 0)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
583 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
584 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
585 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
586 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
587 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
588 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
589 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
590 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
591 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
592
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
593 static gboolean
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
594 chat_account_filter_func(GaimAccount *account)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
595 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
596 GaimConnection *gc = gaim_account_get_connection(account);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
597 GaimPluginProtocolInfo *prpl_info = NULL;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
598
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
599 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
600
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
601 return (prpl_info->chat_info != NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
602 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
603
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
604 gboolean
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
605 gaim_gtk_blist_joinchat_is_showable()
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
606 {
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
607 GList *c;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
608 GaimConnection *gc;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
609
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
610 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
611 gc = c->data;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
612
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
613 if (chat_account_filter_func(gaim_connection_get_account(gc)))
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
614 return TRUE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
615 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
616
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
617 return FALSE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
618 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
619
8305
57bdd25752c1 [gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents: 8303
diff changeset
620 void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
621 gaim_gtk_blist_joinchat_show(void)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
622 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
623 GtkWidget *hbox, *vbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
624 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
625 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
626 GaimGtkBuddyList *gtkblist;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
627 GtkWidget *img = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
628 GaimGtkJoinChatData *data = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
629
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
630 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
631 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
632 GTK_ICON_SIZE_DIALOG);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
633 data = g_new0(GaimGtkJoinChatData, 1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
634
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
635 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
636 NULL, GTK_DIALOG_NO_SEPARATOR,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
637 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8305
diff changeset
638 GAIM_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
639 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
640 gtk_container_set_border_width(GTK_CONTAINER(data->window), GAIM_HIG_BOX_SPACE);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
641 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
642 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
643 gtk_container_set_border_width(
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
644 GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BOX_SPACE);
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
645 gtk_window_set_role(GTK_WINDOW(data->window), "join_chat");
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
646
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
647 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
648 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
649 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
650 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
651
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
652 vbox = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
653 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
654 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
655
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
656 label = gtk_label_new(_("Please enter the appropriate information "
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
657 "about the chat you would like to join.\n"));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
658 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
659 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
660 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
661
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
662 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
663 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
664
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
665 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
666
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
667 label = gtk_label_new_with_mnemonic(_("_Account:"));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
668 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
669 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
670 gtk_size_group_add_widget(data->sg, label);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
671
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
672 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE,
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
673 G_CALLBACK(joinchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
674 chat_account_filter_func, data);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
675 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
676 gtk_label_set_mnemonic_widget(GTK_LABEL(label),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
677 GTK_WIDGET(data->account_menu));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
678 gaim_set_accessible_label (data->account_menu, label);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
679
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
680 data->entries_box = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
681 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
682 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
683
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
684 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
685
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
686 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
687
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
688 g_signal_connect(G_OBJECT(data->window), "response",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
689 G_CALLBACK(do_joinchat), data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
690
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
691 g_object_unref(data->sg);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
692
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
693 gtk_widget_show_all(data->window);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
694 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
695
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
696 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
697 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
698 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
699
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
700 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
701
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
702 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
703
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
704 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
705 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 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
710 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
712
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
713 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
714
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
715 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
716
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
717 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
718 gaim_blist_node_set_bool(node, "collapsed", TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
719 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
720 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
721 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
722 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
723
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
724 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
725 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
726 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
727 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
728
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
729 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
730
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
731 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
732 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
734 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
735 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
736
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
737 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
738 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
739 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
740 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
741
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
742 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
743 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
744 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
745 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
746 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
747 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
748 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
749 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
750 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
751 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
752
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
753 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
754 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
755 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
756 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
757 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
758
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
759 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
760 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
761 if (GAIM_BLIST_NODE_IS_BUDDY(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
762 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
763 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
764 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
765 else if (GAIM_BLIST_NODE_IS_GROUP(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
766 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
767 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
768 else {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
769 gaim_blist_request_add_chat(NULL, NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
770 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
771 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
772
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
773 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
776 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
777 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
779 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780 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
781 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
782 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
783 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
784 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
785 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
786 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
787 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
788 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
789 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
790 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
791 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
792 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
793 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
794 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
795
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
796 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
797 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
798 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
799 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
800 gaim_gtkdialogs_remove_buddy((GaimBuddy*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
801 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
802 gaim_gtkdialogs_remove_chat((GaimChat*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
803 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
804 gaim_gtkdialogs_remove_group((GaimGroup*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
805 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
806 gaim_gtkdialogs_remove_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
807 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
808 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
809
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
810 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
811 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
812 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
813 struct _gaim_gtk_blist_node *gtknode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
814 GtkTreeIter iter, parent;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
815 GaimBlistNode *bnode;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
816 GtkTreePath *path;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
817
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
818 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
819 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
820
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
821 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
822
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
823 gtknode->contact_expanded = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
824
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
825 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
826 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
827 }
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
828
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
829 /* 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
830 get_iter_from_node(node, &parent);
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
831 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
832 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
833 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
834 /* Let the treeview draw so it knows where to scroll */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
835 while (gtk_events_pending())
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
836 gtk_main_iteration();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
837 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
838
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
839
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
840 gaim_gtk_blist_update(NULL, node);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
841 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
842 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
843
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
844 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
845 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
846 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
847 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
848 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
849
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
850 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
851 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
852
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
853 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
854
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
855 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
856
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
857 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
858 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
859 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
860 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
861
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
862
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
863 static void
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
864 blist_node_menu_cb(GtkMenuItem *item, GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
865 {
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
866 void (*callback)(GaimBlistNode *, gpointer);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
867 gpointer data;
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
868 callback = g_object_get_data(G_OBJECT(item), "gaimcallback");
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
869 data = g_object_get_data(G_OBJECT(item), "gaimcallbackdata");
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
870 if (callback)
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
871 callback(node, data);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
872 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
873
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
874
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
875 static void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
876 append_blist_node_action(GtkWidget *menu, GaimBlistNodeAction *act,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
877 GaimBlistNode *node, gboolean *dup_separator)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
878 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
879 if(act == NULL) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
880 if(! *dup_separator) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
881 gaim_separator(menu);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
882 *dup_separator = TRUE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
883 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
884 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
885 GtkWidget *menuitem;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
886
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
887 if (act->children == NULL) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
888 *dup_separator = FALSE;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
889
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
890 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
11038
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
891 if (act->callback != NULL) {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
892 g_object_set_data(G_OBJECT(menuitem), "gaimcallback",
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
893 act->callback);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
894 g_object_set_data(G_OBJECT(menuitem), "gaimcallbackdata",
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
895 act->data);
11038
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
896 g_signal_connect(G_OBJECT(menuitem), "activate",
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
897 G_CALLBACK(blist_node_menu_cb), node);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
898 } else {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
899 gtk_widget_set_sensitive(menuitem, FALSE);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
900 }
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
901 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
902 } else {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
903 GtkWidget *submenu = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
904 GList *l = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
905
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
906 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
907 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
908
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
909 submenu = gtk_menu_new();
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
910 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
911
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
912 for (l = act->children; l; l = l->next) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
913 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
914
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
915 append_blist_node_action(submenu, act, node, dup_separator);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
916 }
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
917 g_list_free(act->children);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
918 act->children = NULL;
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
919 }
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
920 g_free(act);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
921 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
922 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
923
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
924
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
925 void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
926 gaim_gtk_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc,
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
927 GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
928 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
929 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
930 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
931 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
932
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
933 if(!prpl_info || !prpl_info->blist_node_menu)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
934 return;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
935
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
936 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
937 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
938 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
939 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
940 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
941 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
942
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
943
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
944 void
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
945 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
946 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
947 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
948 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
949
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
950 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
951 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
952 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
953 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
954 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
955 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
956
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
957
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
958 void
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
959 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
960 GaimPluginProtocolInfo *prpl_info;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
961 GaimContact *contact;
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
962 gboolean contact_expanded = FALSE;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
963
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
964 g_return_if_fail(menu);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
965 g_return_if_fail(buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
966
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
967 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
968
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
969 contact = gaim_buddy_get_contact(buddy);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
970 if (contact) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
971 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
972 }
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
973
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
974 if (prpl_info && prpl_info->get_info) {
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
975 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
976 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
977 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
978 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
979 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
980 if (prpl_info && prpl_info->send_file) {
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
981 if (!prpl_info->can_receive_file ||
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
982 prpl_info->can_receive_file(buddy->account->gc, buddy->name))
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
983 {
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
984 gaim_new_item_from_stock(menu, _("_Send File"),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
985 GAIM_STOCK_FILE_TRANSFER,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
986 G_CALLBACK(gtk_blist_menu_send_file_cb),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
987 buddy, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
988 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
989 }
12024
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
990
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
991 if (prpl_info && prpl_info->media_prpl_ops && prpl_info->media_prpl_ops->call) {
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
992 gaim_new_item_from_stock(menu, _("Start _Voice Chat"),
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
993 GAIM_STOCK_VOICE_CHAT,
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
994 G_CALLBACK(gtk_blist_menu_voice_chat_cb),
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
995 buddy, 0, 0, NULL);
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
996 }
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
997
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
998 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), GAIM_STOCK_POUNCE,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
999 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
1000
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1001 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1002 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1003 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1004 contact, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1005 } else if (!sub) {
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1006 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1007 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1008 }
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1009
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1010 gaim_gtk_append_blist_node_proto_menu(menu, buddy->account->gc,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1011 (GaimBlistNode *)buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1012 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1013
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1014 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1015
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1016 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1017 gaim_new_item_from_stock(menu, _("_Alias Buddy..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1018 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1019 gaim_new_item_from_stock(menu, _("_Remove Buddy"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1020 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1021 gaim_new_item_from_stock(menu, _("Alias Contact..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1022 G_CALLBACK(gtk_blist_menu_alias_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1023 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1024 gaim_new_item_from_stock(menu, _("Remove Contact"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1025 G_CALLBACK(gaim_gtk_blist_remove_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1026 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1027 } else {
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1028 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1029 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1030 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1031 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1032 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1033 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1034 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1035
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1036 static gboolean
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1037 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
1038 GaimBlistNode *node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1039 GValue val = { 0, };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1040 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1041 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1042
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1043 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1044 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1045 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1046
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1047 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1048 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1049 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1050
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1051 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1052 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1053 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1054
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1055 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1056 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1057 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1058 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1059 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1060 return FALSE;
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 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1063 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1064 }
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 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1067 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1068
9013
d494fd1bd90b [gaim-migrate @ 9789]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
1069
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1070 static GtkWidget *
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1071 create_group_menu (GaimBlistNode *node, GaimGroup *g)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1072 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1073 GtkWidget *menu;
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1074 GtkWidget *item;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1075
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1076 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1077 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
1078 G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1079 item = gaim_new_item_from_stock(menu, _("Add a C_hat"), GTK_STOCK_ADD,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1080 G_CALLBACK(gaim_gtk_blist_add_chat_cb), node, 0, 0, NULL);
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1081 gtk_widget_set_sensitive(item, gaim_gtk_blist_joinchat_is_showable());
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1082 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1083 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1084 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
1085 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
1086
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1087 gaim_gtk_append_blist_node_extended_menu(menu, node);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1088
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1089 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1090 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1091
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1092
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1093 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1094 create_chat_menu(GaimBlistNode *node, GaimChat *c) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1095 GtkWidget *menu;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1096 gboolean autojoin;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1097
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1098 menu = gtk_menu_new();
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1099 autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1100 (gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1101
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1102 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1103 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
1104 gaim_new_check_item(menu, _("Auto-Join"),
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1105 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1106 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1107 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
1108
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1109 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
1110 gaim_gtk_append_blist_node_extended_menu(menu, node);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1111
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1112 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1113
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1114 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1115 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1116 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1117 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
1118
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1119 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1120 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1121
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1122 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1123 create_contact_menu (GaimBlistNode *node)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1124 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1125 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1126
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1127 menu = gtk_menu_new();
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1128
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1129 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1130 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1131 node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1132
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1133 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1134
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1135 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1136 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
1137 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1138 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1139
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1140 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1141
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1142 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1143 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1144 node, 0, 0, NULL);
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1145
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1146 gaim_gtk_append_blist_node_extended_menu(menu, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1147
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1148 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1149 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1150
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1151 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1152 create_buddy_menu(GaimBlistNode *node, GaimBuddy *b) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1153 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
1154 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1155 GtkWidget *menuitem;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1156 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
1157
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1158 menu = gtk_menu_new();
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1159 gaim_gtk_blist_make_buddy_menu(menu, b, FALSE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1160
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1161 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1162 gaim_separator(menu);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1163
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1164 if(gtknode->contact_expanded) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1165 gaim_new_item_from_stock(menu, _("_Collapse"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1166 GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1167 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1168 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1169 } else {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1170 gaim_new_item_from_stock(menu, _("_Expand"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1171 GTK_STOCK_ZOOM_IN,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1172 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1173 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1174 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1175 if(node->child->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1176 GaimBlistNode *bnode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1177
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1178 for(bnode = node->child; bnode; bnode = bnode->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1179 GaimBuddy *buddy = (GaimBuddy*)bnode;
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1180 GdkPixbuf *buf;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1181 GtkWidget *submenu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1182 GtkWidget *image;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1183
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1184 if(buddy == b)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1185 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1186 if(!buddy->account->gc)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1187 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1188 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1189 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1190
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1191 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1192 buf = gaim_gtk_blist_get_status_icon(bnode,
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1193 GAIM_STATUS_ICON_SMALL);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1194 image = gtk_image_new_from_pixbuf(buf);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1195 g_object_unref(G_OBJECT(buf));
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1196 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
1197 image);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1198 gtk_widget_show(image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1199 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1200 gtk_widget_show(menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1201
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1202 submenu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1203 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1204 gtk_widget_show(submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1205
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1206 gaim_gtk_blist_make_buddy_menu(submenu, buddy, TRUE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1207 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1208 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1209 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1210 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1211 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1212
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1213 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1214 gaim_gtk_blist_show_context_menu(GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1215 GtkMenuPositionFunc func,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1216 GtkWidget *tv,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1217 guint button,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1218 guint32 time)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1219 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1220 struct _gaim_gtk_blist_node *gtknode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1221 GtkWidget *menu = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1222 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1223
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1224 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1225
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1226 /* Create a menu based on the thing we right-clicked on */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1227 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1228 GaimGroup *g = (GaimGroup *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1229
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1230 menu = create_group_menu(node, g);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1231 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1232 GaimChat *c = (GaimChat *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1233
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1234 menu = create_chat_menu(node, c);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1235 } else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1236 menu = create_contact_menu(node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1237 } 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
1238 GaimBuddy *b;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1239
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1240 if (GAIM_BLIST_NODE_IS_CONTACT(node))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1241 b = gaim_contact_get_priority_buddy((GaimContact*)node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1242 else
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1243 b = (GaimBuddy *)node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1244
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1245 menu = create_buddy_menu(node, b);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1246 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1247
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1248 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1249 /* 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
1250 * 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
1251 This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1252 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1253 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1254 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1255 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1256 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1257
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1258 /* Now display the menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1259 if (menu != NULL) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1260 gtk_widget_show_all(menu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1261 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
1262 handled = TRUE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1263 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1264
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1265 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1266 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1267
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1268 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
1269 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1270 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1271 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1272 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1273 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1274 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1275 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1276 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1277 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1278 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1279
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1280 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1281 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
1282 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1283 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
1284 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
1285 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1286 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1287
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1288 /* Right click draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1289 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1290 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
1291
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1292 /* CTRL+middle click expands or collapse a contact */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1293 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1294 (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1295 if (gtknode->contact_expanded)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1296 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1297 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1298 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1299 handled = TRUE;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1300
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1301 /* Double middle click gets info */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1302 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1303 ((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
1304 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1305 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1306 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1307 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1308 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1309
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1310 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1311 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1312 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1313
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1314 if (prpl && prpl_info->get_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1315 serv_get_info(b->account->gc, b->name);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1316 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1317 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1318
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1319 #if (1)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1320 /*
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
1321 * 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
1322 * FALSE here, as would be normal the event propoagates down and
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1323 * somehow gets interpreted as the start of a drag event.
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1324 *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1325 * 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
1326 * was handled? --Mark
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1327 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1328 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1329 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1330 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1331 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1332 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1333 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1334 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1335 gtk_tree_path_free(path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1336
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1337 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1338 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1339
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1340 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1341 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1342 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1343 GaimBlistNode *node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1344 GValue val = { 0, };
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1345 GtkTreeIter iter;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1346 GtkTreeSelection *sel;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1347 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1348
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1349 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1350 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1351 return FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1352
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1353 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1354 &iter, NODE_COLUMN, &val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1355 node = g_value_get_pointer(&val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1356
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1357 /* Shift+F10 draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1358 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
1359
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1360 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1361 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1362
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1363 static void gaim_gtk_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1364 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1365 gaim_prefs_set_bool("/gaim/gtk/blist/show_buddy_icons",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1366 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1367 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1368
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1369 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
1370 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1371 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1372 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1373 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1374
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1375 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
1376 GtkWidget *checkitem) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1377 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1378 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1379 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1380 while (gtk_events_pending())
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1381 gtk_main_iteration();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1382 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1383 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1384
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1385 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1386 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1387
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1388 if(gtkblist->window->window) {
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
1389 gdk_window_set_cursor(gtkblist->window->window, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1390 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1391 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1392
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1393 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
1394 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1395 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
1396 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1397
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1398 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
1399 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1400 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
1401 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1402 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1403
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1404 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
1405 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1406 gboolean sensitive = TRUE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1407
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1408 if(!strcmp(value, "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1409 sensitive = FALSE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1410
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1411 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
1412 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1413
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1414 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1415 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
1416 const char *alias)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1417 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1418 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1419 GaimAccount *account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1420 GaimConnection *gc;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1421
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1422 if (list == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1423 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1424
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1425 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1426 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1427 gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1428 account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1429
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1430 if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1431 break;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1432
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1433 account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1434 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1435
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1436 if (account != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1437 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1438 for (l = list; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1439 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1440 gaim_blist_request_add_buddy(account, l->data,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1441 (group ? group->name : NULL),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1442 alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1443 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1444 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1445
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1446 g_list_foreach(list, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1447 g_list_free(list);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1448 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1449
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1450 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1451 parse_vcard(const char *vcard, GaimGroup *group)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1452 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1453 char *temp_vcard;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1454 char *s, *c;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1455 char *alias = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1456 GList *aims = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1457 GList *icqs = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1458 GList *yahoos = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1459 GList *msns = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1460 GList *jabbers = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1461
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1462 s = temp_vcard = g_strdup(vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1463
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1464 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1465 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1466 char *field, *value;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1467
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1468 field = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1469
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1470 /* Grab the field */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1471 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1472 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1473
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1474 if (*s == '\r') s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1475 if (*s == '\n')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1476 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1477 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1478 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1479 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1480
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1481 if (*s != '\0') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1482
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1483 if ((c = strchr(field, ';')) != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1484 *c = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1485
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1486 /* Proceed to the end of the line */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1487 value = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1488
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1489 while (*s != '\r' && *s != '\n' && *s != '\0')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1490 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1491
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1492 if (*s == '\r') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1493 if (*s == '\n') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1494
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1495 /* We only want to worry about a few fields here. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1496 if (!strcmp(field, "FN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1497 alias = g_strdup(value);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1498 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1499 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1500 !strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1501 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1502 char **values = g_strsplit(value, ":", 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1503 char **im;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1504
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1505 for (im = values; *im != NULL; im++)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1506 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1507 if (!strcmp(field, "X-AIM"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1508 aims = g_list_append(aims, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1509 else if (!strcmp(field, "X-ICQ"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1510 icqs = g_list_append(icqs, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1511 else if (!strcmp(field, "X-YAHOO"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1512 yahoos = g_list_append(yahoos, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1513 else if (!strcmp(field, "X-MSN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1514 msns = g_list_append(msns, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1515 else if (!strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1516 jabbers = g_list_append(jabbers, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1517 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1518
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1519 g_strfreev(values);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1520 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1521 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1522
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1523 g_free(temp_vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1524
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1525 if (aims == NULL && icqs == NULL && yahoos == NULL &&
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1526 msns == NULL && jabbers == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1527 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1528 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1529 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1530
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1531 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1532 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1533
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1534 add_buddies_from_vcard("prpl-oscar", group, aims, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1535 add_buddies_from_vcard("prpl-oscar", group, icqs, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1536 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1537 add_buddies_from_vcard("prpl-msn", group, msns, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1538 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1539
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1540 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1541 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1542
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1543 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1544 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1545
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1546 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1547 static void gaim_gtk_blist_drag_begin(GtkWidget *widget,
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1548 GdkDragContext *drag_context, gpointer user_data)
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1549 {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1550 gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1551
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1552
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1553 /* 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
1554 * to appear and obscure the dragging operation.
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1555 * This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1556 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1557 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1558 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1559 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1560 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1561 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1562
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1563 static void gaim_gtk_blist_drag_data_get_cb(GtkWidget *widget,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1564 GdkDragContext *dc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1565 GtkSelectionData *data,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1566 guint info,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1567 guint time,
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1568 gpointer null)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1569 {
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1570
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1571 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1572 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1573 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
1574 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1575 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1576 GaimBlistNode *node = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1577 GValue val = {0};
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1578 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1579 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1580 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1581 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
1582 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1583 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1584 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1585 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1586 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1587 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1588
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1589 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1590 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1591 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
1592 {
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1593 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1594 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1595 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1596 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1597 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1598 GaimConnection *gc;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1599 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1600 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1601 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1602 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1603
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1604 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
1605 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1606
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1607 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1608 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1609
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1610 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1611 sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1612 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1613 NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1614
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1615 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1616
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1617 if (GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1618 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1619 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1620 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1621 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1622 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1623 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1624 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1625 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1626 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1627 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1628 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1629 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1630
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1631 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1632
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1633 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1634 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1635 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1636 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1637 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1638
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1639 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1640 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1641 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1642
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1643 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1644 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1645 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1646 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1647 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1648 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1649 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1650 buddy->name);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1651
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1652 if (buddy->alias != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1653 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1654 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1655 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1656 buddy->alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1657 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1658
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1659 str = g_string_append(str, "\r\n");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1660
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1661 mime_str = g_string_free(str, FALSE);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1662
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1663 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1664 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1665 8, /* bits */
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1666 (const guchar *)mime_str,
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1667 strlen(mime_str) + 1);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1668
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1669 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1670 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1671 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1672 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1673
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1674 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
1675 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1676 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1677 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1678 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1679 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1680 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1681 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1682 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
1683 /* 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
1684 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1685 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1686 GValue val = {0};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1687 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1688
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1689 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1690 &iter, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1691 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1692 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1693 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1694 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1695
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1696 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1697 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1698 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1699 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1700 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1701 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1702 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1703 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1704 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1705 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1706 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1707 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1708 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1709 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1710 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1711 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1712 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1713 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1714 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1715 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1716 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1717 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1718 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1719 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1720 GaimBuddy *b = (GaimBuddy*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1721 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1722 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1723 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1724 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1725 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1726 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1727 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1728 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1729 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1730 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1731 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1732 node->prev);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1733 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1734 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1735 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1736 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1737 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1738 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1739 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1740 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1741 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1742 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1743 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1744 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1745 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1746 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1747 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1748 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1749 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1750 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1751 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1752 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1753 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1754 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1755 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1756 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1757 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1758 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1759 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1760 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1761 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1762 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1763 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1764 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1765 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1766 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1767 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1768 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1769 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1770 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1771 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1772 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1773 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1774 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1775 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1776 (GaimGroup*)node->parent->parent, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1777 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1778 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1779 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1780 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1781 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1782 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1783 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1784 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1785 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1786 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1787 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1788 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1789 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1790 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1791 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1792 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1793 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1794 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1795 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1796 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1797 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1798 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1799 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1800 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1801 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1802 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1803 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1804 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1805 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1806 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1807 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1808 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1809 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1810 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1811 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1812 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1813 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1814 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1815 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1816 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1817 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1818 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1819 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1820
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1821 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1822 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1823 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1824 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1825 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1826 FALSE) && sd->data)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1827 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1828 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1829 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1830 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1831 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1832 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1833 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1834 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1835
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1836 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
1837 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1838 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1839 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1840 GaimBlistNode *node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1841 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1842
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1843 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1844 &iter, path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1845 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1846 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1847 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1848
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1849 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1850 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1851 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1852 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1853 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1854 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1855 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1856 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1857 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1858 else if (GAIM_BLIST_NODE_IS_GROUP(node))
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 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1861 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1862 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1863
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1864 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
1865 &protocol, &username, &alias))
7706
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 (account == NULL)
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 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1870 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1871 "can add that buddy."), NULL);
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 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1874 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1875 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1876 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1877 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1878 }
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 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1882 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1883 if (alias != NULL) g_free(alias);
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 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1886 gtk_tree_path_free(path);
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 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1889 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1890 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
1891 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1892 gboolean result;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1893 GaimGroup *group = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1894 GtkTreePath *path = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1895 GtkTreeViewDropPosition position;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1896
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1897 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
1898 x, y, &path, &position))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1899 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1900 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1901 GaimBlistNode *node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1902 GValue val = {0};
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1903
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1904 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1905 &iter, path);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1906 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1907 &iter, NODE_COLUMN, &val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1908 node = g_value_get_pointer(&val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1909
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1910 if (GAIM_BLIST_NODE_IS_BUDDY(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1911 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1912 group = (GaimGroup *)node->parent->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1913 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1914 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1915 GAIM_BLIST_NODE_IS_CONTACT(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1916 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1917 group = (GaimGroup *)node->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1918 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1919 else if (GAIM_BLIST_NODE_IS_GROUP(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1920 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1921 group = (GaimGroup *)node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1922 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1923 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1924
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1925 result = parse_vcard((const gchar *)sd->data, group);
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1926
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1927 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
1928 } 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
1929 GtkTreePath *path = NULL;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1930 GtkTreeViewDropPosition position;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1931
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1932 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
1933 x, y, &path, &position))
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1934 {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1935 GtkTreeIter iter;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1936 GaimBlistNode *node;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1937 GValue val = {0};
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1938
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1939 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1940 &iter, path);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1941 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1942 &iter, NODE_COLUMN, &val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1943 node = g_value_get_pointer(&val);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1944
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1945 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
1946 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
1947 gaim_dnd_file_manage(sd, b->account, b->name);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1948 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1949 } else {
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1950 gtk_drag_finish(dc, FALSE, FALSE, t);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1951 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1952 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1953 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1954 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1955
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1956 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBlistNode *node,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1957 gboolean scaled, gboolean greyed)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1958 {
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
1959 GdkPixbuf *buf, *ret = NULL;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1960 GdkPixbufLoader *loader;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1961 GaimBuddyIcon *icon;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1962 const guchar *data;
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1963 gsize len;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1964 GaimBuddy *buddy = (GaimBuddy *)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1965
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1966 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1967 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1968 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1969 buddy = (GaimBuddy*)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1970 } else {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1971 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1972 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1973
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1974 #if 0
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1975 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1976 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1977 #endif
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1978
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1979 if (!(icon = gaim_buddy_get_icon(buddy)))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1980 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
1981 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1982
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1983 loader = gdk_pixbuf_loader_new();
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1984 data = gaim_buddy_icon_get_data(icon, &len);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1985 gdk_pixbuf_loader_write(loader, data, len, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1986 buf = gdk_pixbuf_loader_get_pixbuf(loader);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1987 if (buf)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1988 g_object_ref(G_OBJECT(buf));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1989 gdk_pixbuf_loader_close(loader, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1990 g_object_unref(G_OBJECT(loader));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1991
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1992 if (buf) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1993 GaimAccount *account = gaim_buddy_get_account(buddy);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1994 GaimPluginProtocolInfo *prpl_info = NULL;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1995 int orig_width, orig_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1996 int scale_width, scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1997
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1998 if(account && account->gc)
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1999 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2000
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2001 if (greyed) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2002 GaimPresence *presence = gaim_buddy_get_presence(buddy);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2003 if (!GAIM_BUDDY_IS_ONLINE(buddy))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2004 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2005 if (gaim_presence_is_idle(presence))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2006 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2007 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2008
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2009 /* 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
2010 * 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
2011 * purposes */
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2012 scale_width = orig_width = gdk_pixbuf_get_width(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2013 scale_height = orig_height = gdk_pixbuf_get_height(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2014
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2015 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
2016
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2017 if (scaled) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2018 if(scale_height > scale_width) {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2019 scale_width = 30.0 * (double)scale_width / (double)scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2020 scale_height = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2021 } else {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2022 scale_height = 30.0 * (double)scale_height / (double)scale_width;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2023 scale_width = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2024 }
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2025
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2026 ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 30, 30);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2027 gdk_pixbuf_fill(ret, 0x00000000);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2028 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
2029 } else {
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2030 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
2031 }
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2032 g_object_unref(G_OBJECT(buf));
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2033 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2034
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2035 return ret;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2036 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2037
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2038 struct tooltip_data {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2039 PangoLayout *layout;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2040 GdkPixbuf *status_icon;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2041 GdkPixbuf *avatar;
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2042 int avatar_width;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2043 int width;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2044 int height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2045 };
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2046
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2047 static struct tooltip_data * create_tip_for_node(GaimBlistNode *node)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2048 {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2049 struct tooltip_data *td = g_new0(struct tooltip_data, 1);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2050 char *tooltip_text = gaim_get_tooltip_text(node);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2051
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2052 td->status_icon = gaim_gtk_blist_get_status_icon(node, GAIM_STATUS_ICON_LARGE);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2053 td->avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2054
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2055 td->layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2056 pango_layout_set_markup(td->layout, tooltip_text, strlen(tooltip_text));
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2057 pango_layout_set_wrap(td->layout, PANGO_WRAP_WORD);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2058 pango_layout_set_width(td->layout, 300000);
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
2059
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2060 pango_layout_get_size (td->layout, &td->width, &td->height);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2061 td->width = PANGO_PIXELS(td->width) + 38 + 8;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2062 td->height = MAX(PANGO_PIXELS(td->height) + 8, 38);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2063
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2064 if(td->avatar) {
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2065 td->avatar_width = gdk_pixbuf_get_width(td->avatar);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2066 td->width += td->avatar_width + 8;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2067 td->height = MAX(td->height, gdk_pixbuf_get_height(td->avatar) + 8);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2068 }
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2069
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2070 return td;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2071 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2072
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2073 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
2074 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2075 GtkStyle *style;
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2076 int current_height, max_width;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2077 GList *l;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2078
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2079 if(gtkblist->tooltipdata == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2080 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2081
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2082 style = gtkblist->tipwindow->style;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2083 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2084 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2085
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2086 max_width = 0;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2087 for(l = gtkblist->tooltipdata; l; l = l->next)
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2088 {
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2089 struct tooltip_data *td = l->data;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2090 max_width = MAX(max_width, td->width);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2091 }
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2092
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2093 current_height = 0;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2094 for(l = gtkblist->tooltipdata; l; l = l->next)
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2095 {
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2096 struct tooltip_data *td = l->data;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2097
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2098 #if GTK_CHECK_VERSION(2,2,0)
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2099 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2100 0, 0, 4, current_height + 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2101 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2102 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2103 td->avatar, 0, 0, max_width - (td->avatar_width + 4), current_height + 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2104 #else
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2105 gdk_pixbuf_render_to_drawable(td->status_icon, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, current_height + 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2106 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2107 gdk_pixbuf_render_to_drawable(td->avatar,
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
2108 GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0,
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2109 max_width - (td->avatar_width + 4),
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2110 current_height + 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2111 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2112
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2113 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2114 NULL, gtkblist->tipwindow, "tooltip", 38 + 4, current_height + 4, td->layout);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2115
11895
589f290eb8cd [gaim-migrate @ 14186]
Nathan Walp <nwalp@pidgin.im>
parents: 11894
diff changeset
2116 current_height += td->height;
589f290eb8cd [gaim-migrate @ 14186]
Nathan Walp <nwalp@pidgin.im>
parents: 11894
diff changeset
2117
11894
4bdb7f142020 [gaim-migrate @ 14185]
Nathan Walp <nwalp@pidgin.im>
parents: 11892
diff changeset
2118 if(l->next)
11895
589f290eb8cd [gaim-migrate @ 14186]
Nathan Walp <nwalp@pidgin.im>
parents: 11894
diff changeset
2119 gtk_paint_hline(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, NULL, NULL, NULL, 4, max_width - 4, current_height-2);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2120 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2121 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2122
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2123 static void gaim_gtk_blist_tooltip_destroy()
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2124 {
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2125 while(gtkblist->tooltipdata) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2126 struct tooltip_data *td = gtkblist->tooltipdata->data;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2127
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2128 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2129 g_object_unref(td->avatar);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2130 if(td->status_icon)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2131 g_object_unref(td->status_icon);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2132 g_object_unref(td->layout);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2133 g_free(td);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2134 gtkblist->tooltipdata = g_list_delete_link(gtkblist->tooltipdata, gtkblist->tooltipdata);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2135 }
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2136
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2137 if (gtkblist->tipwindow == NULL)
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2138 return;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2139
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2140 gtk_widget_destroy(gtkblist->tipwindow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2141 gtkblist->tipwindow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2142 }
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2143
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2144 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2145 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2146 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2147 GtkTreeIter iter;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2148 GaimBlistNode *node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2149 GValue val = {0};
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2150 struct _gaim_gtk_blist_node *gtknode;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2151
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2152 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
2153 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2154 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
2155 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
2156 node = g_value_get_pointer(&val);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2157
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2158 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2159 gtk_tree_path_free(path);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2160 return FALSE;
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2161 }
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2162
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2163 gtknode = node->ui_data;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2164
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2165 if (!gtknode->contact_expanded) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2166 GtkTreeIter i;
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2167
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2168 gaim_gtk_blist_expand_contact_cb(NULL, node);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2169
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2170 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
2171 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
2172 gtkblist->mouseover_contact = node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2173 gtk_tree_path_down (path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2174 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
2175 GdkRectangle rect;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2176 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
2177 gtkblist->contact_rect.height += rect.height;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2178 gtk_tree_path_next(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2179 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2180 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2181 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2182 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2183 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2184
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2185 static gboolean buddy_is_displayable(GaimBuddy *buddy)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2186 {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2187 struct _gaim_gtk_blist_node *gtknode;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2188
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2189 if(!buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2190 return FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2191
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2192 gtknode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2193
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2194 return (gaim_account_is_connected(buddy->account) &&
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2195 (gaim_presence_is_online(buddy->presence) ||
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2196 (gtknode && gtknode->recent_signonoff) ||
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2197 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") ||
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2198 gaim_blist_node_get_bool((GaimBlistNode*)buddy, "show_offline")));
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2199 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2200
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2201 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2202 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2203 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2204 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2205 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2206 GValue val = {0};
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2207 int scr_w, scr_h, w, h, x, y;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2208 #if GTK_CHECK_VERSION(2,2,0)
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2209 int mon_num;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2210 GdkScreen *screen = NULL;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2211 #endif
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2212 gboolean tooltip_top = FALSE;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2213 struct _gaim_gtk_blist_node *gtknode;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2214 GdkRectangle mon_size;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2215
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2216 /*
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2217 * Attempt to free the previous tooltip. I have a feeling
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2218 * this is never needed... but just in case.
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2219 */
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2220 gaim_gtk_blist_tooltip_destroy();
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2221
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2222 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
2223 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2224 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2225 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
2226 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2227
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2228 gtk_tree_path_free(path);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2229
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2230 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2231
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2232 if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2233 struct tooltip_data *td = create_tip_for_node(node);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2234 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2235 w = td->width;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2236 h = td->height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2237 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2238 GaimBlistNode *child;
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2239 GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2240 w = h = 0;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2241 for(child = node->child; child; child = child->next)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2242 {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2243 if(GAIM_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((GaimBuddy*)child)) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2244 struct tooltip_data *td = create_tip_for_node(child);
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2245 if (b == (GaimBuddy *)child) {
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2246 gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td);
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2247 } else {
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2248 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2249 }
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2250 w = MAX(w, td->width);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2251 h += td->height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2252 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2253 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2254 } else {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2255 gtk_widget_destroy(gtkblist->tipwindow);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2256 gtkblist->tipwindow = NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2257 return FALSE;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2258 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2259
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2260 if (gtkblist->tooltipdata == NULL) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2261 gtk_widget_destroy(gtkblist->tipwindow);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2262 gtkblist->tipwindow = NULL;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2263 return FALSE;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2264 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2265
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2266 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2267
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2268 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2269 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2270 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2271 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2272 G_CALLBACK(gaim_gtk_blist_paint_tip), NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2273 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2274
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2275
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2276 #if GTK_CHECK_VERSION(2,2,0)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2277 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
2278 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2279 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2280
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2281 scr_w = mon_size.width + mon_size.x;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2282 scr_h = mon_size.height + mon_size.y;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2283 #else
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2284 scr_w = gdk_screen_width();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2285 scr_h = gdk_screen_height();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2286 gdk_window_get_pointer(NULL, &x, &y, NULL);
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2287 mon_size.x = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2288 mon_size.y = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2289 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2290
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2291 #if GTK_CHECK_VERSION(2,2,0)
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2292 if (w > mon_size.width)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2293 w = mon_size.width - 10;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2294
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2295 if (h > mon_size.height)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2296 h = mon_size.height - 10;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2297 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2298
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2299 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2300 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2301
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2302 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2303
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2304 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2305 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2306 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2307 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2308
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2309 if (y < mon_size.y)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2310 y = mon_size.y;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2311
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2312 if (y != mon_size.y) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2313 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2314 x -= (x + w + 5) - scr_w;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2315 else if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2316 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2317 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2318 x -= (w / 2 + 10);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2319 if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2320 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2321 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2322
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2323 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2324 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2325 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2326
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2327 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2328 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2329
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2330 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
2331 gint x, gint y, guint time, gpointer user_data)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2332 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2333 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2334 int delay;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2335
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2336 delay = 500;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2337
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2338 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2339 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
2340 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2341 /* 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
2342 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2343 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2344
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2345 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
2346 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
2347
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2348 if (path)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2349 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2350 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
2351
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2352 if (gtkblist->mouseover_contact) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2353 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
2354 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2355 gtkblist->mouseover_contact = NULL;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2356 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2357 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2358
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2359 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2360 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2361
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2362 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
2363 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2364 GtkTreePath *path;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2365 int delay;
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2366
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2367 delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2368
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2369 if (delay == 0)
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2370 return FALSE;
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2371
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2372 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2373 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
2374 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2375 /* 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
2376 gaim_gtk_blist_tooltip_destroy();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2377 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2378 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2379
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2380 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
2381 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
2382
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2383 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2384 gtk_tree_path_free(path);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2385 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
2386
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2387 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2388 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
2389 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2390 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2391 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2392 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2393
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2394 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2395 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2396
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2397 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
2398 {
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2399
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2400 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2401 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2402 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2403 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2404
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2405 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2406 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2407 gtkblist->drag_timeout = 0;
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
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2410 gaim_gtk_blist_tooltip_destroy();
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2411
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2412 if (gtkblist->mouseover_contact &&
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2413 !((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
2414 (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
2415 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2416 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2417 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2418 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2419
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2420 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2421 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2422 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2423 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2424 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2425 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2426
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2427
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2428 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2429 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2430 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2431 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2432 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2433 /* Buddies menu */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2434 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
9714
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2435 { 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
2436 { 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
2437 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2438 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, "<StockItem>", GAIM_STOCK_LOG },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2439 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
11025
8d2007d738d5 [gaim-migrate @ 12899]
Mark Doliner <mark@kingant.net>
parents: 11023
diff changeset
2440 { 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
2441 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>"},
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
2442 { N_("/Buddies/Show Buddy _Details"), NULL, gaim_gtk_blist_buddy_details_cb, 1, "<CheckItem>"},
12240
1c0fd404e07e [gaim-migrate @ 14542]
Mark Doliner <mark@kingant.net>
parents: 12239
diff changeset
2443 { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>" },
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
2444 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
2445 { 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
2446 { 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
2447 { N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
2448 { "/Buddies/sep3", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2449 { 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
2450
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2451 /* Tools */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2452 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2453 { N_("/Tools/Account Ac_tions"), NULL, NULL, 0, "<StockItem>", GAIM_STOCK_ACTION },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2454 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2455 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2456 { N_("/Tools/Buddy _Pounces"), NULL, gaim_gtk_pounces_manager_show, 0, "<StockItem>", GAIM_STOCK_POUNCE },
12163
f6f08fd1841a [gaim-migrate @ 14464]
Richard Laager <rlaager@wiktel.com>
parents: 12136
diff changeset
2457 { N_("/Tools/Plu_gins"), "<CTL>U", gaim_gtk_plugin_dialog_show, 0, "<StockItem>", GAIM_STOCK_PLUGIN },
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
2458 { 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
2459 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR },
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
2460 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
10019
8cc6f0bfa215 [gaim-migrate @ 10943]
Luke Schierer <lschiere@pidgin.im>
parents: 10018
diff changeset
2461 { 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
2462 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2463 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<StockItem>", GAIM_STOCK_LOG },
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
2464 { "/Tools/sep3", NULL, NULL, 0, "<Separator>" },
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
2465 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>"},
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2466
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2467 /* Help */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2468 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2469 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2470 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<StockItem>", GAIM_STOCK_DEBUG },
9753
60705fd4f411 [gaim-migrate @ 10620]
Mark Doliner <mark@kingant.net>
parents: 9749
diff changeset
2471 { 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
2472 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2473
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2474 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2475 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2476 *********************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2477
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2478 static char *gaim_get_tooltip_text(GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2479 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2480 GString *str = g_string_new("");
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2481 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2482 GaimPluginProtocolInfo *prpl_info = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2483 char *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2484
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2485 if (GAIM_BLIST_NODE_IS_CHAT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2486 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2487 GaimChat *chat;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2488 GList *cur;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2489 struct proto_chat_entry *pce;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2490 char *name, *value;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2491
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2492 chat = (GaimChat *)node;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2493 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
2494 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2495
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2496 tmp = g_markup_escape_text(gaim_chat_get_name(chat), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2497 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
2498 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2499
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2500 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2501 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2502 tmp = g_markup_escape_text(chat->account->username, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2503 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2504 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2505 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2506
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
2507 if (prpl_info->chat_info != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2508 cur = prpl_info->chat_info(chat->account->gc);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2509 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2510 cur = NULL;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2511
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2512 while (cur != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2513 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2514 pce = cur->data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2515
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2516 if (!pce->secret && (!pce->required &&
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2517 g_hash_table_lookup(chat->components, pce->identifier) == NULL))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2518 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2519 tmp = gaim_text_strip_mnemonic(pce->label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2520 name = g_markup_escape_text(tmp, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2521 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2522 value = g_markup_escape_text(g_hash_table_lookup(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2523 chat->components, pce->identifier), -1);
10924
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2524 g_string_append_printf(str, "\n<b>%s</b> %s",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2525 name ? name : "",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2526 value ? value : "");
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2527 g_free(name);
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2528 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2529 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2530
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2531 g_free(pce);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2532 cur = g_list_remove(cur, pce);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2533 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2534 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2535 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
2536 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2537 GaimContact *c;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2538 GaimBuddy *b;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2539 GaimPresence *presence;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2540 char *tmp;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2541 gboolean idle;
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2542 time_t idle_secs, signon;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2543
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2544 if (GAIM_BLIST_NODE_IS_CONTACT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2545 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2546 c = (GaimContact *)node;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2547 b = gaim_contact_get_priority_buddy(c);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2548 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2549 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2550 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2551 b = (GaimBuddy *)node;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2552 c = gaim_buddy_get_contact(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2553 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2554
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2555 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
2556 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2557
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2558 presence = gaim_buddy_get_presence(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2559
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2560 /* Buddy Name */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2561 tmp = g_markup_escape_text(gaim_buddy_get_name(b), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2562 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
2563 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2564
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2565 /* Account */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2566 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2567 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2568 tmp = g_markup_escape_text(gaim_account_get_username(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2569 gaim_buddy_get_account(b)), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2570 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2571 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2572 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2573
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2574 /* Contact Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2575 if (GAIM_BLIST_NODE_IS_CONTACT(node) &&
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2576 (c->alias != NULL))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2577 {
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2578 tmp = g_markup_escape_text(c->alias, -1);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2579 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
2580 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2581 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2582
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2583 /* Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2584 if ((b->alias != NULL) && (b->alias[0] != '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2585 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2586 tmp = g_markup_escape_text(b->alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2587 g_string_append_printf(str, _("\n<b>Alias:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2588 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2589 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2590
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2591 /* Nickname/Server Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2592 if (b->server_alias != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2593 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2594 tmp = g_markup_escape_text(b->server_alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2595 g_string_append_printf(str, _("\n<b>Nickname:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2596 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2597 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2598
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2599 /* Logged In */
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2600 signon = gaim_presence_get_login_time(presence);
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2601 if (GAIM_BUDDY_IS_ONLINE(b) && signon > 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2602 {
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2603 tmp = gaim_str_seconds_to_string(time(NULL) - signon);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2604 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
2605 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2606 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2607
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2608 /* Idle */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2609 idle = gaim_presence_is_idle(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2610 if (idle)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2611 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2612 idle_secs = gaim_presence_get_idle_time(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2613 if (idle_secs > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2614 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2615 tmp = gaim_str_seconds_to_string(time(NULL) - idle_secs);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2616 g_string_append_printf(str, _("\n<b>Idle:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2617 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2618 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2619 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2620
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2621 /* Last Seen */
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2622 if (!GAIM_BUDDY_IS_ONLINE(b))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2623 {
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2624 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2625 GaimBlistNode *bnode;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2626 int lastseen = 0;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2627
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2628 if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2629 {
11437
1c20849fc716 [gaim-migrate @ 13674]
Richard Laager <rlaager@wiktel.com>
parents: 11436
diff changeset
2630 /* We're either looking at a buddy for a collapsed contact or
11438
5451fe2d89c0 [gaim-migrate @ 13675]
Richard Laager <rlaager@wiktel.com>
parents: 11437
diff changeset
2631 * an expanded contact itself so we show the most recent
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2632 * (largest) last_seen time for any of the buddies under
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2633 * the contact. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2634 for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2635 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2636 int value = gaim_blist_node_get_int(bnode, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2637 if (value > lastseen)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2638 lastseen = value;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2639 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2640 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2641 else
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2642 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2643 /* We're dealing with a buddy under an expanded contact,
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2644 * so we show the last_seen time for the buddy. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2645 lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2646 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2647
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2648 if (lastseen > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2649 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2650 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2651 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
2652 g_free(tmp);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2653 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2654 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2655
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2656
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2657 /* Offline? */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2658 if (!GAIM_BUDDY_IS_ONLINE(b)) {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2659 g_string_append_printf(str, _("\n<b>Status:</b> Offline"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2660 }
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2661
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2662 if (prpl_info && prpl_info->tooltip_text)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2663 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2664 /* Additional text from the PRPL */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2665 const char *end;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2666 tmp = prpl_info->tooltip_text(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2667
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2668 if (tmp && !g_utf8_validate(tmp, -1, &end))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2669 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2670 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
2671 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2672 tmp = new;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2673 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2674
11634
c7305c2d650b [gaim-migrate @ 13910]
Mark Doliner <mark@kingant.net>
parents: 11624
diff changeset
2675 if (tmp != NULL)
c7305c2d650b [gaim-migrate @ 13910]
Mark Doliner <mark@kingant.net>
parents: 11624
diff changeset
2676 g_string_append(str, tmp);
10476
d02e70b5d197 [gaim-migrate @ 11763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10475
diff changeset
2677 g_free(tmp);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2678 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2679
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2680 /* These are Easter Eggs. Patches to remove them will be rejected. */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2681 if (!g_ascii_strcasecmp(b->name, "robflynn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2682 g_string_append(str, _("\n<b>Description:</b> Spooky"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2683 if (!g_ascii_strcasecmp(b->name, "seanegn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2684 g_string_append(str, _("\n<b>Status:</b> Awesome"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2685 if (!g_ascii_strcasecmp(b->name, "chipx86"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2686 g_string_append(str, _("\n<b>Status:</b> Rockin'"));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2687 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2688
8824
f08245ed03aa [gaim-migrate @ 9587]
Sean Egan <seanegan@gmail.com>
parents: 8823
diff changeset
2689 gaim_signal_emit(gaim_gtk_blist_get_handle(),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
2690 "drawing-tooltip", node, str);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2691
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2692 return g_string_free(str, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2693 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2694
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2695 struct _emblem_data {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9949
diff changeset
2696 const char *filename;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2697 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2698 int y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2699 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2700
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2701 GdkPixbuf *
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2702 gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2703 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2704 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2705 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2706 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2707 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2708 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2709 struct _gaim_gtk_blist_node *gtkbuddynode = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2710 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2711 {NULL, 0, 0}, {NULL, 15, 0}};
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2712 GaimPresence *presence = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2713 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2714 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2715
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2716 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2717 if(!gtknode->contact_expanded) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2718 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2719 gtkbuddynode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2720 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2721 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2722 buddy = (GaimBuddy*)node;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2723 gtkbuddynode = node->ui_data;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2724 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2725 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2726 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2727 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2728 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2729
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2730 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2731 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2732 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2733 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2734
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2735 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2736 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2737 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2738 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2739
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2740 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2741 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2742 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2743
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2744 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2745
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2746 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2747 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2748 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2749 if(prpl_info && prpl_info->list_emblems && buddy) {
11924
ced9410eeb73 [gaim-migrate @ 14215]
Mark Doliner <mark@kingant.net>
parents: 11923
diff changeset
2750 if(gtknode && !gtknode->recent_signonoff)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2751 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2752 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2753 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2754 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2755 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2756
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2757 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2758 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2759 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2760 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2761 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2762
11917
5d9172e67615 [gaim-migrate @ 14208]
Nathan Walp <nwalp@pidgin.im>
parents: 11915
diff changeset
2763 if(buddy && GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2764 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL);
11917
5d9172e67615 [gaim-migrate @ 14208]
Nathan Walp <nwalp@pidgin.im>
parents: 11915
diff changeset
2765 } else if(buddy && !GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2766 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
2767 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2768 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2769 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2770 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2771 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2772 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2773 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2774 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2775
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2776 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2777 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2778
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2779 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2780 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2781
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2782 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2783 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2784 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2785
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2786 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2787 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2788 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2789 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2790 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2791 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2792 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2793 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2794 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2795 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2796 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2797 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2798 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2799 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2800 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2801 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2802 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2803 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2805 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2806 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2807 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2808 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2809 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2810 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2811 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2812 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2813 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2814 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2815 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2816
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2817 if(buddy) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2818 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2819
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2820 if (!GAIM_BUDDY_IS_ONLINE(buddy))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2821 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2822 else if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2823 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2824 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2825 }
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2826
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2827 if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy)))
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2828 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2829 GdkPixbuf *emblem;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2830 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
2831
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2832 emblem = gdk_pixbuf_new_from_file(filename, NULL);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2833 g_free(filename);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2834
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2835 if (emblem)
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2836 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2837 gdk_pixbuf_composite(emblem, scale,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2838 0, 0, scalesize, scalesize,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2839 0, 0,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2840 (double)scalesize / gdk_pixbuf_get_width(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2841 (double)scalesize / gdk_pixbuf_get_height(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2842 GDK_INTERP_BILINEAR,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2843 224);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2844 g_object_unref(emblem);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2845 }
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2846 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2847 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2848
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2849 return scale;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2850 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2851
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2852 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
2853 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2854 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2855 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2856 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2857 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2858 GaimContact *contact;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2859 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2860 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2861 char *idletime = NULL, *statustext = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2862 time_t t;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2863 /* XXX Clean up this crap */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2864
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2865 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2866 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2867 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2868
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2869 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2870 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2871 else
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
2872 name = gaim_buddy_get_alias(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2873 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2874
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2875 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2876
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2877 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2878 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2879
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2880 presence = gaim_buddy_get_presence(b);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2881
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2882 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
2883
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2884 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
2885 {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2886 text = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2887 dim_grey(), esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2888 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2889 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2890 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2891 else
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2892 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2893 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2894
8122
36674144c510 [gaim-migrate @ 8826]
Christian Hammond <chipx86@chipx86.com>
parents: 8113
diff changeset
2895 if (prpl_info && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2896 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2897 const char *end;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2898
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2899 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2900 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2901 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2902 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2903 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2904 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2905
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2906 #if !GTK_CHECK_VERSION(2,6,0)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2907 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2908 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2909 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2910 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2911 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2912 g_strdelimit(tmp, "\n", ' ');
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11917
diff changeset
2913 gaim_str_strip_char(tmp, '\r');
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2914
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2915 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2916 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2917 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2918 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2919 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2920 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2921 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2922 c = g_utf8_next_char(c); /* this is fun */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2923 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2924
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2925 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2926
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2927 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2928 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2929 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2930 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2931
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2932 statustext = g_strdup_printf(buf, tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2933
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2934 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2935 }
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2936 #else
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2937 statustext = tmp;
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2938 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2939 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2940
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
2941 if (gaim_presence_is_idle(presence)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2942 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2943
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
2944 if (idle_secs > 0) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2945 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2946
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2947 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2948 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2949 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2950
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2951 if (ihrs)
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2952 idletime = g_strdup_printf(_("Idle (%dh %02dm) "), ihrs, imin);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2953 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2954 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2955 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2956 else
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2957 idletime = g_strdup(_("Idle "));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2958 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2959
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2960 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2961 statustext = g_strdup(_("Offline "));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2962
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2963 if (gaim_presence_is_idle(presence) && !selected) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2964 text = g_strdup_printf("<span color='%s'>%s</span>\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2965 "<span color='%s' size='smaller'>%s%s%s</span>",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2966 dim_grey(), esc, dim_grey(),
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2967 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2968 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2969 idletime != NULL ? idletime : "");
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2970 } else if (statustext == NULL && idletime == NULL && GAIM_BUDDY_IS_ONLINE(b)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2971 text = g_strdup(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2972 } else {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2973 if (selected)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2974 text = g_strdup_printf("%s\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2975 "<span size='smaller'>%s%s%s</span>", esc,
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2976 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2977 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2978 idletime != NULL ? idletime : "");
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2979 else
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2980 text = g_strdup_printf("%s\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2981 "<span color='%s' size='smaller'>%s%s%s</span>", esc,
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
2982 dim_grey(),
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2983 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2984 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2985 idletime != NULL ? idletime : "");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2986 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2987 if (idletime)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2988 g_free(idletime);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2989 if (statustext)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2990 g_free(statustext);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2991 if (esc)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2992 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2993
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2994 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2995 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2996
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2997 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2998 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2999 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3000
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3001 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3003 /* 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
3004 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3005 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3006 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3007
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3008 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3009 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3010 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3011
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3012 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3013 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3014 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3015 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3016 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3017
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3018 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3019 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3020 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3021 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3022
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3023 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3024 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3025 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3026 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3027 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3028
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3029 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
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 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3032
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3033 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3034 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3035 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3036 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3037 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3038 GaimBuddy *buddy;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3039
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3040 buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3041
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3042 if (buddy &&
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3043 gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3044 gaim_gtk_blist_update(list, cnode);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3045 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3046 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3047 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3048
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3049 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3050 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3051 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3052
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3053 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
3054 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3055 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
3056 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3057
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3058 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3059 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3060
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3061 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3062 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3063
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3064 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3065 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3066 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
3067 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3068 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3069 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3070 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3071 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3072 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3073 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3074
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3075 static const char *require_connection[] =
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3076 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3077 N_("/Buddies/New Instant Message..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3078 N_("/Buddies/Join a Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3079 N_("/Buddies/Get User Info..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3080 N_("/Buddies/Add Buddy..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3081 N_("/Buddies/Add Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3082 N_("/Buddies/Add Group..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3083 };
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3084
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3085 static const int require_connection_size = sizeof(require_connection)
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3086 / sizeof(*require_connection);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3087
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3088 /**
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3089 * Rebuild dynamic menus and make menu items sensitive/insensitive
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3090 * where appropriate.
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3091 */
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3092 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3093 update_menu_bar(GaimGtkBuddyList *gtkblist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3094 {
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3095 GtkWidget *widget;
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3096 gboolean sensitive;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3097 int i;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3098
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3099 g_return_if_fail(gtkblist != NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3100
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3101 gaim_gtk_blist_update_protocol_actions();
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3102
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3103 sensitive = (gaim_connections_get_all() != NULL);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3104
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3105 for (i = 0; i < require_connection_size; i++)
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3106 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3107 widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3108 gtk_widget_set_sensitive(widget, sensitive);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3109 }
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3110
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3111 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
3112 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3113
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3114 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Add Chat..."));
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3115 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3116
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3117 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounces"));
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3118 gtk_widget_set_sensitive(widget, (gaim_connections_get_all() != NULL));
8938
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3119
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3120 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3121 gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable());
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3122
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3123 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3124 gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
7620
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
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3127 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3128 sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3129 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3130 GaimGtkBuddyList *gtkblist = GAIM_GTK_BLIST(blist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3131
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3132 update_menu_bar(gtkblist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3133 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3134
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3135 static void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3136 plugin_changed_cb(GaimPlugin *p, gpointer *data)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3137 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3138 gaim_gtk_blist_update_plugin_actions();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3139 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3140
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3141 static void
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3142 unseen_conv_menu()
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3143 {
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3144 static GtkWidget *menu = NULL;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3145
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3146 if (menu)
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3147 gtk_widget_destroy(menu);
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3148
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3149 menu = gtk_menu_new();
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3150 if (!gaim_gtk_conversations_fill_unseen_menu(menu, GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)) {
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3151 /* no conversations added, don't show the menu */
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3152 gtk_widget_destroy(menu);
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3153 return;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3154 }
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3155 gtk_widget_show_all(menu);
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3156 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3,
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3157 gtk_get_current_event_time());
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3158 }
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3159
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3160 static gboolean
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3161 menutray_press_cb(GtkWidget *widget, GdkEventButton *event)
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3162 {
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3163 GaimConversation *conv;
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3164
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3165 switch (event->button) {
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3166 case 1:
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3167 conv = gaim_gtk_conversations_get_first_unseen(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT);
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3168 if (conv != NULL)
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3169 gaim_gtkconv_present_conversation(conv);
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3170 break;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3171 case 3:
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3172 unseen_conv_menu();
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3173 break;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3174 }
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3175 return TRUE;
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3176 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3177
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3178 static void
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3179 conversation_updated_cb(GaimConversation *conv, GaimConvUpdateType type,
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3180 GaimGtkBuddyList *gtkblist)
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3181 {
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3182 GtkWidget *img = NULL;
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3183 GString *tooltip_text = NULL;
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3184
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3185 if (type != GAIM_CONV_UPDATE_UNSEEN)
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3186 return;
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3187
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3188 if (gtkblist->menutrayicon) {
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3189 gtk_widget_destroy(gtkblist->menutrayicon);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3190 gtkblist->menutrayicon = NULL;
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3191 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3192
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3193 if (gaim_gtk_conversations_get_first_unseen(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT)) {
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3194 GList *convs = gaim_get_ims();
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3195 tooltip_text = g_string_new("");
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3196 while (convs) {
12239
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3197 if(GAIM_IS_GTK_CONVERSATION(convs->data)) {
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3198 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)convs->data);
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3199
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3200 if (gtkconv->unseen_state >= GAIM_UNSEEN_TEXT && gaim_gtkconv_is_hidden(gtkconv)) {
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3201 g_string_append_printf(tooltip_text,
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3202 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3203 gtkconv->unseen_count,
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3204 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3205 }
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3206 }
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3207 convs = convs->next;
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3208 }
12239
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3209 if(tooltip_text->len > 0) {
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3210 /* get rid of the last newline */
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3211 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len -1);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3212 img = gtk_image_new_from_stock(GAIM_STOCK_PENDING, GTK_ICON_SIZE_MENU);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3213
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3214 gtkblist->menutrayicon = gtk_event_box_new();
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3215 gtk_container_add(GTK_CONTAINER(gtkblist->menutrayicon), img);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3216 gtk_widget_show(img);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3217 gtk_widget_show(gtkblist->menutrayicon);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3218 g_signal_connect(G_OBJECT(gtkblist->menutrayicon), "button-press-event", G_CALLBACK(menutray_press_cb), NULL);
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3219
12239
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3220 gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, tooltip_text->str);
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3221 }
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3222 g_string_free(tooltip_text, FALSE);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3223 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3224 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3225
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3226 static void
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3227 conversation_deleting_cb(GaimConversation *conv, GaimGtkBuddyList *gtkblist)
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3228 {
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3229 conversation_updated_cb(conv, GAIM_CONV_UPDATE_UNSEEN, gtkblist);
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3230 }
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3231
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3232 /**********************************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3233 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3234 **********************************************************************************/
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
3235
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3236 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3237 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3238 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3239
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3240 gtkblist = g_new0(GaimGtkBuddyList, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3241 blist->ui_data = gtkblist;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3242 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3243
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3244 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3245 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3246 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3247 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3248
11018
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3249 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3250 {
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3251 if GAIM_BLIST_NODE_IS_BUDDY(node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3252 node = node->parent;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3253
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3254 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
3255
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3256 return ((struct _gaim_gtk_blist_node *)node->ui_data)->contact_expanded;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3257 }
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3258
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3259 void gaim_gtk_blist_update_columns()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3260 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3261 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3262 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3263
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3264 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3265 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3266 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3267 } else {
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3268 gtk_tree_view_column_set_visible(gtkblist->idle_column, TRUE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3269 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3270 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3271 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3272
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3273 enum {
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3274 DRAG_BUDDY,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3275 DRAG_ROW,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3276 DRAG_VCARD,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3277 DRAG_TEXT,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3278 DRAG_URI,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3279 NUM_TARGETS
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3280 };
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3281
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3282 static char *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3283 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3284 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3285 return _((char *)path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3286 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3287
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3288 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3289 {
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3290 gaim_gtk_blist_sort_method_reg("none", _("Manually"), sort_method_none);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3291 #if GTK_CHECK_VERSION(2,2,1)
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3292 gaim_gtk_blist_sort_method_reg("alphabetical", _("Alphabetically"), sort_method_alphabetical);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3293 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
3294 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
3295 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3296 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
3297 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3298
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3299 static void _prefs_change_redo_list()
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3300 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3301 redo_buddy_list(gaim_get_blist(), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3302 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3303
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3304 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
3305 gpointer val, gpointer data)
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3306 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3307 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3308 gaim_gtk_blist_sort_method_set(val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3309 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3310
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3311 /*
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3312 * "This is so dead sexy."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3313 * "Two thumbs up."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3314 * "Best movie of the year."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3315 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3316 * 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
3317 * It finds the top-most buddy/group/chat/whatever containing the
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3318 * entered string.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3319 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3320 * 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
3321 * "name" column of the buddy list (because the GtkTreeModel does not
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3322 * 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
3323 * 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
3324 * used rarely, so it shouldn't matter TOO much.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3325 */
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3326 static gboolean
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3327 _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
3328 {
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3329 gboolean result;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3330 gchar *enteredstring;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3331 gchar *withmarkup;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3332 gchar *nomarkup;
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3333 gchar *normalized;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3334
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3335 gtk_tree_model_get(model, iter, column, &withmarkup, -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3336
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3337 enteredstring = g_utf8_casefold(gaim_normalize(NULL, key), -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3338 nomarkup = gaim_markup_strip_html(withmarkup);
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3339 normalized = g_utf8_casefold(gaim_normalize(NULL, nomarkup), -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3340
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3341 result = (g_strstr_len(normalized, strlen(normalized), enteredstring) == NULL);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3342
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3343 g_free(withmarkup);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3344 g_free(enteredstring);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3345 g_free(nomarkup);
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3346 g_free(normalized);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3347
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3348 return result;
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3349 }
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3350
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3351 static void account_enabled(GaimAccount *account, GaimGtkBuddyList *gtkblist)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3352 {
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3353 GtkWidget *box;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3354
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3355 if (!gtkblist)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3356 return;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3357
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3358 box = gtk_gaim_status_box_new_with_account(account);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3359 gtkblist->statusboxes = g_list_append(gtkblist->statusboxes, box);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3360 gtk_box_pack_start(GTK_BOX(gtkblist->statusboxbox), box, FALSE, TRUE, 0);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3361 gtk_widget_show(box);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3362 }
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3363
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3364 static void account_disabled(GaimAccount *account, GaimGtkBuddyList *gtkblist)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3365 {
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3366 GList *iter;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3367
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3368 if (!gtkblist)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3369 return;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3370
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3371 for (iter = gtkblist->statusboxes; iter; iter = iter->next)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3372 {
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3373 GtkWidget *box = iter->data;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3374 GaimAccount *ac = NULL;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3375
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3376 g_object_get(G_OBJECT(box), "account", &ac, NULL);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3377 if (ac == account)
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3378 {
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3379 gtkblist->statusboxes = g_list_remove_link(gtkblist->statusboxes, iter);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3380 gtk_widget_destroy(box);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3381 break;
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3382 }
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3383 }
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3384 }
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3385
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3386 static gboolean
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3387 pane_position_cb(GtkPaned *paned, GParamSpec *param_spec, gpointer data)
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3388 {
12179
92ba143044e6 [gaim-migrate @ 14481]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12175
diff changeset
3389 gaim_prefs_set_int("/gaim/gtk/blist/pane",
92ba143044e6 [gaim-migrate @ 14481]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12175
diff changeset
3390 gtk_paned_get_position(paned));
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3391
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3392 return FALSE;
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3393 }
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3394
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3395 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3396 {
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3397 void *handle;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3398 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3399 GtkTreeViewColumn *column;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3400 GtkWidget *menu;
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
3401 GtkWidget *account_actions_menu;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3402 GtkWidget *sw;
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3403 GtkWidget *vpane;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3404 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3405 GtkTreeSelection *selection;
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3406 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
3407 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3408 {"text/x-vcard", 0, DRAG_VCARD },
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3409 {"text/uri-list", 0, DRAG_URI},
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3410 {"text/plain", 0, DRAG_TEXT}};
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3411 GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3412 {"application/x-im-contact", 0, DRAG_BUDDY},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3413 {"text/x-vcard", 0, DRAG_VCARD }};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3414 if (gtkblist && gtkblist->window) {
12119
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3415 gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3416 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3417 }
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 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3420
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3421 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3422 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
9746
3a71d70e3945 [gaim-migrate @ 10611]
Luke Schierer <lschiere@pidgin.im>
parents: 9737
diff changeset
3423 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3424
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3425 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3426 gtk_widget_show(gtkblist->vbox);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3427 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3428
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3429 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3430 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3431 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3432 g_signal_connect(G_OBJECT(gtkblist->window), "window_state_event", G_CALLBACK(gtk_blist_window_state_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3433 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3434
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3435 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3436 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3437 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3438 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3439 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
3440 gtk_item_factory_set_translate_func(gtkblist->ift,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3441 item_factory_translate_func,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3442 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3443 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
3444 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3445 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3446 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3447 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3448 menu = gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>");
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3449 gtkblist->menutray = gaim_gtk_menu_tray_new();
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3450 gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3451 gtk_widget_show(gtkblist->menutray);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3452 gtk_widget_show(menu);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3453 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
3454
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
3455 protomenu = gtk_menu_new();
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
3456 account_actions_menu = gtk_item_factory_get_item(gtkblist->ift, N_("/Tools/Account Actions"));
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
3457 gtk_menu_item_set_submenu(GTK_MENU_ITEM(account_actions_menu), protomenu);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3458
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3459 /****************************** GtkVPaned ************************************/
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3460 vpane = gtk_vpaned_new();
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3461 gtk_widget_show(vpane);
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3462 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), vpane, TRUE, TRUE, 0);
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3463 gtk_paned_set_position(GTK_PANED(vpane),
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3464 gaim_prefs_get_int("/gaim/gtk/blist/pane"));
12179
92ba143044e6 [gaim-migrate @ 14481]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12175
diff changeset
3465 g_signal_connect(G_OBJECT(vpane), "notify::position",
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3466 G_CALLBACK(pane_position_cb), NULL);
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3467
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3468 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3469 sw = gtk_scrolled_window_new(NULL,NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3470 gtk_widget_show(sw);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3471 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
3472 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
3473
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3474 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3475 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN,
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3476 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
3477
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3478 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
3479 gtk_widget_show(gtkblist->treeview);
9176
7dc10a14c568 [gaim-migrate @ 9971]
Luke Schierer <lschiere@pidgin.im>
parents: 9113
diff changeset
3480 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3481
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3482 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3483 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3484 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
3485
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3486 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3487 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
3488 GDK_BUTTON1_MASK, ste, 3,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3489 GDK_ACTION_COPY);
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3490 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
3491 dte, 5,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3492 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3493
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
3494 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
3495 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
3496 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3497 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
3498 #endif
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3499
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3500 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
3501
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3502 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3503 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
3504 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
3505
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3506 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3507
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3508 gtkblist->text_column = column = gtk_tree_view_column_new ();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3509
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3510 rend = gtk_cell_renderer_pixbuf_new();
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3511 gtk_tree_view_column_pack_start(column, rend, FALSE);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3512 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3513 "pixbuf", STATUS_ICON_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3514 "visible", STATUS_ICON_VISIBLE_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3515 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3516 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3517
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3518 gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3519 gtk_tree_view_column_pack_start (column, rend, TRUE);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3520 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3521 "markup", NAME_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3522 NULL);
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3523 g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3524 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3525 #if GTK_CHECK_VERSION(2,6,0)
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3526 gtk_tree_view_column_set_expand (column, TRUE);
10501
4806967e093e [gaim-migrate @ 11793]
Sean Egan <seanegan@gmail.com>
parents: 10499
diff changeset
3527 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3528 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3529 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3530
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3531 rend = gtk_cell_renderer_text_new();
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3532 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
3533 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
3534 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3535
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3536 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3537 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
3538 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3539 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
3540
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3541 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
3542 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
3543 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
3544 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
3545 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
3546 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
3547
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3548 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3549 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
3550 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
3551
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3552 gtk_paned_pack1(GTK_PANED(vpane), sw, TRUE, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3553 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3554 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3555
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3556 /* TODO: functionize this */
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3557 {
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3558 GList *accounts, *l;
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3559 GtkWidget *sw2 = gtk_scrolled_window_new(NULL, NULL);
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3560
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3561 /* Set up some per account status boxes */
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3562 gtkblist->statusboxbox = gtk_vbox_new(FALSE, 0);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3563 gtkblist->statusboxes = NULL;
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3564
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3565 for (l = accounts = gaim_accounts_get_all_active(); l; l = l->next) {
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3566 GtkWidget *statusbox = gtk_gaim_status_box_new_with_account(l->data);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3567 gtkblist->statusboxes = g_list_append(gtkblist->statusboxes, statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3568 gtk_box_pack_start(GTK_BOX(gtkblist->statusboxbox), statusbox, FALSE, TRUE, 0);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3569 gtk_widget_show(statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3570 }
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3571 g_list_free(accounts);
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3572
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3573 gtk_widget_show(gtkblist->statusboxbox);
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3574 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), gtkblist->statusboxbox);
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3575 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3576 gtk_widget_show(sw2);
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
3577 gtk_paned_pack2(GTK_PANED(vpane), sw2, FALSE, TRUE);
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3578
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3579 gtkblist->statusbox = gtk_gaim_status_box_new();
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3580
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3581 gtk_widget_show(gtkblist->statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3582 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3583
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3584 }
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3585
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3586 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3587 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3588 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3589 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
3590 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3591 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
3592 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3593 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
3594 gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3595 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))),
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11917
diff changeset
3596 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3597 if(!strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none"))
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3598 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
3599
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3600 /* Update some dynamic things */
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3601 update_menu_bar(gtkblist);
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3602 gaim_gtk_blist_update_plugin_actions();
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3603 gaim_gtk_blist_update_sort_methods();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3604
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3605 /* OK... let's show this bad boy. */
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3606 gaim_gtk_blist_refresh(list);
12119
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3607 gaim_gtk_blist_restore_position();
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3608 gtk_widget_show_all(GTK_WIDGET(gtkblist->window));
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3609 gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3610
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3611 /* start the refresh timer */
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3612 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
3613
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3614 handle = gaim_gtk_blist_get_handle();
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3615
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3616 /* things that affect how buddies are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3617 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3618 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3619 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_empty_groups",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3620 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3621 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_offline_buddies",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3622 _prefs_change_redo_list, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3623
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3624 /* sorting */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3625 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/sort_type",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3626 _prefs_change_sort_method, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3627
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3628 /* things that affect what columns are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3629 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3630 gaim_gtk_blist_update_columns, NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3631
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3632 /* menus */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3633 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/mute",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3634 gaim_gtk_blist_mute_pref_cb, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3635 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/method",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3636 gaim_gtk_blist_sound_method_pref_cb, NULL);
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3637
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3638 /* Setup some gaim signal handlers. */
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3639 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled",
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3640 gtkblist, GAIM_CALLBACK(account_disabled), gtkblist);
12226
df0e16ecfb2a [gaim-migrate @ 14528]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12208
diff changeset
3641 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
df0e16ecfb2a [gaim-migrate @ 14528]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12208
diff changeset
3642 gtkblist, GAIM_CALLBACK(account_disabled), gtkblist);
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3643 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled",
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3644 gtkblist, GAIM_CALLBACK(account_enabled), gtkblist);
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3645
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3646 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3647 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3648 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3649 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3650
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3651 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3652 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3653 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3654 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3655
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3656 gaim_signal_connect(gaim_conversations_get_handle(), "conversation-updated",
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3657 gtkblist, GAIM_CALLBACK(conversation_updated_cb),
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3658 gtkblist);
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3659 gaim_signal_connect(gaim_conversations_get_handle(), "deleting-conversation",
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3660 gtkblist, GAIM_CALLBACK(conversation_deleting_cb),
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3661 gtkblist);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3662
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3663 /* emit our created signal */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3664 gaim_signal_emit(handle, "gtkblist-created", list);
5228
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
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3667 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3668 {
12112
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3669 GaimBlistNode *node = list->root;
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3670
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3671 while (node)
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3672 {
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3673 if (!GAIM_BLIST_NODE_IS_GROUP(node) && remove)
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3674 gaim_gtk_blist_hide_node(list, node);
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3675
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3676 gaim_gtk_blist_update(list, node);
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3677 node = gaim_blist_node_next(node, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3678 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3679 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3680
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3681 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3682 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3683 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3684 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3685
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3686 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3687 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3688 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3689 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3690 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3691
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3692 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3693 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3694
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3695 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
3696 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3697
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3698 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3699 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
3700 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3701
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3702 if (!gtknode) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3703 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3704 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3705
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3706 if (!gtkblist) {
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3707 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
3708 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3709 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3710
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3711 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3712 return FALSE;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3713
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3714
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3715 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3716 return FALSE;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3717
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3718 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
3719 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3720 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3721 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3722 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3723 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3724 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3725
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3726 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3727 {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3728 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3729
10222
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3730 gaim_request_close_with_handle(node);
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3731
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3732 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3733
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3734 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3735 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3736
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3737 /* There's something I don't understand here - Ethan */
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3738 /* 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
3739 * 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
3740 * 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
3741 * comment it out again. Stu */
10510
1044c0930e03 [gaim-migrate @ 11808]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
3742 /* 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
3743 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3744 /* I think it's fixed now. Stu. */
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3745
11915
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3746 if(gtknode) {
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3747 if(gtknode->recent_signonoff_timer > 0)
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3748 gaim_timeout_remove(gtknode->recent_signonoff_timer);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3749
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3750 g_free(node->ui_data);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3751 node->ui_data = NULL;
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
3752 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3753 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3754
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3755 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3756 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3757 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3758
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3759 /* 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
3760 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3761 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3762 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3763 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3764 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3765 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3766 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3767 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3768
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3769 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3770 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3771
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3772 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3773 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3774 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3775 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3776
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3777 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3778 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3779 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3780 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3781
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3782 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3783 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3784 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3785
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3786 static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3787 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3788 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3789 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3790 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3791
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3792 if(!iter)
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3793 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3794
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3795 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
3796 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3797
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3798 if(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3799 curptr = &cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3800
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3801 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
3802 *iter = current_sort_method->func(node, list, parent_iter, curptr);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3803 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3804 *iter = sort_method_none(node, list, parent_iter, curptr);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3805 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3806
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3807 if(gtknode != NULL) {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3808 gtk_tree_row_reference_free(gtknode->row);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3809 } else {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3810 gaim_gtk_blist_new_node(node);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3811 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3812 }
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3813
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3814 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3815 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3816 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3817 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3818 newpath);
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3819
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3820 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3821
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3822 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3823 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3824 -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3825
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3826 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3827 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3828 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3829
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3830 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3831 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3832 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
3833 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3834 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3835 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
3836 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3837 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3838 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
3839 gtk_tree_path_free(expand);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3840 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3841 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3842
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3843 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3844 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3845
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3846 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3847 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3848 GaimGroup *group;
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3849 int count;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3850
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3851 g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3852
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3853 group = (GaimGroup*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3854
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3855 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3856 count = gaim_blist_get_group_size(group, FALSE);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3857 else
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3858 count = gaim_blist_get_group_online_count(group);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3859 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
3860 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3861 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3862
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3863 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3864 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3865
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3866 esc = g_markup_escape_text(group->name, -1);
8945
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3867 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3868 esc, gaim_blist_get_group_online_count(group),
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3869 gaim_blist_get_group_size(group, FALSE));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3870 g_free(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3871
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3872 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3873 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3874 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3875 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3876 NODE_COLUMN, node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3877 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3878 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3879 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3880 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3881 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3882 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3883
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3884 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3885 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3886 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3887 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3888 char *mark;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3889 char *idle = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3890 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3891
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3892 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3893
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3894 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3895 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3896 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3897
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
3898 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
3899 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3900
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3901 if (gaim_presence_is_idle(presence))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3902 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3903 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3904
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3905 if (idle_secs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3906 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3907 time_t t;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3908 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3909 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3910 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3911 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3912
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3913 if (ihrs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3914 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3915 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3916 idle = g_strdup_printf("(%d)", imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3917 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3918 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3919
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3920 if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3921 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3922 if (idle && !selected) {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3923 char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3924 dim_grey(), idle);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3925 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3926 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3927 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3928 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3929
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3930 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3931 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3932 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3933 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3934 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3935 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3936 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3937
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3938 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3939 if(idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3940 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3941 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3942 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3943 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3944 g_object_unref(avatar);
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
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3947
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3948 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3949 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3950 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3951 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3952 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3953
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3954 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3955
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3956 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3957 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3958
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3959 contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3960 buddy = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3961
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3962 if (buddy_is_displayable(buddy))
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3963 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3964 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3965
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3966 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3967 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3968
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3969 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3970
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3971 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3972 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3973 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3974
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3975 status = gaim_gtk_blist_get_status_icon(node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3976 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3977 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
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 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3980
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3981 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3982 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3983 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3984 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3985 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3986 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3987 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3988 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3989 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3990 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3991 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3992 buddy_node(buddy, &iter, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3993 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3994 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3995 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3996 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3997 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3998
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3999 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4000 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4001 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4002 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4003 struct _gaim_gtk_blist_node *gtkparentnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4004
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4005 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4006
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4007 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4008 contact = (GaimContact*)node->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4009
11624
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
4010 if (contact == NULL)
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
4011 return;
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
4012
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4013 /* First things first, update the contact */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4014 gaim_gtk_blist_update_contact(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4015
10918
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4016 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4017
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4018 if (gtkparentnode->contact_expanded &&
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4019 (gaim_presence_is_online(buddy->presence) ||
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4020 (0 /* XXX: if we just signed off, need to show logout.png */) ||
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4021 (gaim_account_is_connected(buddy->account) &&
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4022 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4023 gaim_blist_node_get_bool(node->parent, "show_offline")))
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4024 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4025 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4026
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4027 if (!insert_node(list, node, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4028 return;
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4029
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4030 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4031
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4032 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4033 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4034 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4035
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 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4039 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4040 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4041
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4042 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4043
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4044 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4045 gaim_gtk_blist_update_group(list, node->parent);
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 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4050 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4051 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4053
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4054 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4055 return;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4056
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4057 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4058 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4059 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4060
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4061 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
4062
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4063 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4065 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4066 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4067 -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4068
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4069 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4070 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4071 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4072 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
4073 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4074 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4075 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4076
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4077 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4078 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4079 if(!gtkblist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4080 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4081
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4082 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4083 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4084 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4085 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4086 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4087 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4088 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4089 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4090 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4091 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4092 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4094 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4095 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4097 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4098
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4099 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4100 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4101
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4102
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4103 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4104 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4105 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4106 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4107
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4108 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4109 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4110 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4111 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
4112
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4113 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4114
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
4115 gaim_gtk_blist_tooltip_destroy();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4116
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4117 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4118 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4119 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4120 g_source_remove(gtkblist->timeout);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4121 if (gtkblist->drag_timeout)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4122 g_source_remove(gtkblist->drag_timeout);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4123
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4124 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4125 gtkblist->timeout = 0;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4126 gtkblist->drag_timeout = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4127 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4128 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4129 gtkblist->idle_column = NULL;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
4130 gtkblist->buddy_icon_column = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
4131 g_object_unref(G_OBJECT(gtkblist->ift));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4132 protomenu = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4133 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4134
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
4135 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle());
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4136 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4137
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4138 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4139 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4140 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4141 return;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
4142
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4143 if (show) {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4144 if(!GAIM_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window))
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4145 gaim_signal_emit(gaim_gtk_blist_get_handle(), "gtkblist-unhiding", gtkblist);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4146 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4147 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4148 } else {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4149 if(visibility_manager_count) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4150 gaim_signal_emit(gaim_gtk_blist_get_handle(), "gtkblist-hiding", gtkblist);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4151 gtk_widget_hide(gtkblist->window);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4152 } else {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4153 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4154 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4155 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4156 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4157
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4161 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4162 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4163 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4164 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4165
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4166 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4167 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4168 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4169 tmp = g_list_append(tmp, tmp2);
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 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4172 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4173 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4174 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4176 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4177 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4178 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4179 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4180 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4181 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4182 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4183 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4184 }
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 return tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4187 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4188
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4189 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4190 add_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4191 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4192 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4193 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4194 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4195 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4196
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4197 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4198 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4199 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4200 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4201 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4202
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4203 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4204 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4205 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4206 const char *grp, *who, *whoalias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4207 GaimConversation *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4208 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4209 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4210
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4211 if (resp == GTK_RESPONSE_OK)
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 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4214 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
4215 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
4216 if (*whoalias == '\0')
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
4217 whoalias = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4218
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4219 if ((g = gaim_find_group(grp)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4220 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4221 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4222 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4223 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4224
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4225 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4226 gaim_blist_add_buddy(b, NULL, g, NULL);
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4227 gaim_account_add_buddy(data->account, b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4228
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4229 /*
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4230 * XXX
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4231 * It really seems like it would be better if the call to
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4232 * gaim_account_add_buddy() and gaim_conversation_update() were done in
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4233 * blist.c, possibly in the gaim_blist_add_buddy() function. Maybe
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4234 * gaim_account_add_buddy() should be renamed to
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4235 * 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
4236 * gaim_blist_add_buddy() after it creates it. --Mark
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4237 *
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4238 * No that's not good. blist.c should only deal with adding nodes to the
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4239 * local list. We need a new, non-gtk file that calls both
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4240 * gaim_account_add_buddy and gaim_blist_add_buddy().
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4241 * Or something. --Mark
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4242 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4243
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11258
diff changeset
4244 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, data->account);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4245 if (c != NULL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4246 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
4247 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4248 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4249 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4250
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4251 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4252 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4253
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4254 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4255 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4256 const char *group, const char *alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4257 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4258 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4259 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4260 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4261 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4262 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4263 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4264 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4265
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4266 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4267 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4268 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4269 : gaim_connection_get_account(gaim_connections_get_all()->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4270
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4272 GTK_ICON_SIZE_DIALOG);
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 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4275
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4276 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4277 NULL, GTK_DIALOG_NO_SEPARATOR,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4279 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4280 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4281
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4282 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4283 gtk_container_set_border_width(GTK_CONTAINER(data->window), GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4284 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4285 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BORDER);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4286 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4287 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4288 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4289 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4290
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4291 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4292 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4293 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4294 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
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 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4297 gtk_container_add(GTK_CONTAINER(hbox), vbox);
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 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4300 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4301 "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
4302 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4303 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4304
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4305 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4306 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4307 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4308 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4309
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4310 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4311 gtk_container_add(GTK_CONTAINER(vbox), hbox);
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_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4314 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
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 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4317 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4318 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4319 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4320 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4321
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4322 label = gtk_label_new(_("Screen Name:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4323 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4324 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
4325
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4326 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4327 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
4328 gtk_widget_grab_focus(data->entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4329
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4330 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4331 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4332
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4333 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4334 gaim_set_accessible_label (data->entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4335
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4336 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4337 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4338 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
4339
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4340 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4341 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4342 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4343
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4344 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4345 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4346
10734
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4347 if (username != NULL)
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4348 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4349
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4350 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
4351 gaim_set_accessible_label (data->entry_for_alias, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4352
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4353 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4354 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4355 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
4356
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4357 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4358 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4359 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
4360 gaim_set_accessible_label (data->combo, label);
7620
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 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4363 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4364 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4365 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
4366
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4367 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4368 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4369
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4370 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
4371 gaim_set_accessible_label (data->account_box, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4372 /* End of account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4373
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4374 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4375 G_CALLBACK(add_buddy_cb), data);
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 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4378
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4379 if (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4380 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
4381 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4382
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4383 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4384 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4385 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4386 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4387 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4388 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4389 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4390 const char *group_name;
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4391 char *chat_name = NULL;
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4392 GaimConversation *conv = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4393 const char *value;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4394
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4395 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
4396 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4397
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4398 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4399 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4400 if (g_object_get_data(tmp->data, "is_spin"))
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 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4403 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4404 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4405 gtk_spin_button_get_value_as_int(tmp->data)));
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 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4408 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4409 value = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4410 if (*value != '\0')
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4411 g_hash_table_replace(components,
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4412 g_strdup(g_object_get_data(tmp->data, "identifier")),
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4413 g_strdup(value));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4414 }
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4417 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4418 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4419 components);
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 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
4422
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4423 if ((group = gaim_find_group(group_name)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4424 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4425 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4426 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4427 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4428
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4429 if (chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4430 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4431 gaim_blist_add_chat(chat, group, NULL);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4432
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4433 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
4434 chat_name = GAIM_PLUGIN_PROTOCOL_INFO(
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4435 data->account->gc->prpl)->get_chat_name(chat->components);
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4436
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4437 if (chat_name != NULL) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11258
diff changeset
4438 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4439 chat_name,
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4440 data->account);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4441 g_free(chat_name);
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4442 }
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4443
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4444 if (conv != NULL)
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4445 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ADD);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4448 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4449 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4450 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4451 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4452 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4453
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4454 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4455 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4456 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4457 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4458 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4459 add_chat_cb(NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4460 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4461 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4462 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4463 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4464 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4465 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4466 g_free(data);
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 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4469
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4470 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4471 * 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
4472 * 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
4473 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4474 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4475 addchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4476 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4477 GaimGtkAddChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4478 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4479 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4480 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4481 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4482
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4483 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4484
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4485 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4486 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4487 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4488 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4489 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4490 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4491 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4492 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4493 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4494 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4495
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4496 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
4497 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4498
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4499 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4500 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4501 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4502 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4503 GList *list = NULL, *tmp = NULL;
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4504 GHashTable *defaults = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4505 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4506 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4507
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4508 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4509
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4510 gc = gaim_account_get_connection(data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4511
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4512 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4513 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4514 gtk_container_remove(GTK_CONTAINER(data->entries_box),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4515 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4516 }
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 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4519 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4520
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4521 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4522
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4523 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4524 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4525
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4526 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
4527 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
4528
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4529 for (tmp = list; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4530 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4531 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4532 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4533 GtkWidget *input;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4534
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4535 pce = tmp->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4536
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4537 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4538 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
4539
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
4540 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4541 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4542 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4543 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4544
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4545 if (pce->is_int)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4546 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4547 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4548 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4549 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4550 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4551 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4552 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
4553 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4554 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4555 {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4556 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4557 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4558 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4559 value = g_hash_table_lookup(defaults, pce->identifier);
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4560 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4561 gtk_entry_set_text(GTK_ENTRY(input), value);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4562 if (pce->secret)
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4563 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4564 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4565 gtk_entry_set_invisible_char(GTK_ENTRY(input), GAIM_INVISIBLE_CHAR);
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4566 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4567 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4568 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4569 G_CALLBACK(addchat_set_sensitive_if_input_cb), data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4570 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4571
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4572 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4573 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4574 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4575 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4576 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4577 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4578 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4579 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4580 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4581 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
4582 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
4583 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4584
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4585 g_free(pce);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4586 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4587
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4588 g_list_free(list);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4589 g_hash_table_destroy(defaults);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4590
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4591 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4592 addchat_set_sensitive_if_input_cb(NULL, data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4593
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4594 gtk_widget_show_all(data->entries_box);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4595 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4596
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4597 static void
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4598 addchat_select_account_cb(GObject *w, GaimAccount *account,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4599 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4600 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4601 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4602 gaim_account_get_protocol_id(account)) == 0)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4603 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4604 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4605 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4606 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4607 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4608 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4609 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4610 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4611 }
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 void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4614 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4615 const char *alias, const char *name)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4616 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4617 GaimGtkAddChatData *data;
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4618 GaimGtkBuddyList *gtkblist;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4619 GList *l;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4620 GaimConnection *gc;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4621 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4622 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4623 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4624 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4625 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4626
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4627 if (account != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4628 gc = gaim_account_get_connection(account);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4629
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4630 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4631 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
4632 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4633 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4634 } else {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4635 /* Find an account with chat capabilities */
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4636 for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4637 gc = (GaimConnection *)l->data;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4638
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4639 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4640 account = gaim_connection_get_account(gc);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4641 break;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4642 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4643 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4644
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4645 if (account == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4646 gaim_notify_error(NULL, NULL,
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4647 _("You are not currently signed on with any "
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4648 "protocols that have the ability to chat."), NULL);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4649 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4650 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4651 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4652
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4653 data = g_new0(GaimGtkAddChatData, 1);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4654 data->account = account;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4655 data->default_chat_name = g_strdup(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4656
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4657 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4658 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4659
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4660 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4661
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4662 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4663
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4664 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4665 NULL, GTK_DIALOG_NO_SEPARATOR,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4666 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4667 GTK_STOCK_ADD, GTK_RESPONSE_OK,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4668 NULL);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4669
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4670 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4671 gtk_container_set_border_width(GTK_CONTAINER(data->window), GAIM_HIG_BOX_SPACE);
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4672 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4673 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BORDER);
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4674 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4675 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4676 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4677 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4678
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4679 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4680 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4681 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4682 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4683
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4684 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4685 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4686
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4687 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4688 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4689 "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
4690 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4691 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4692 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4693 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
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 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4696 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4697
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4698 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4699 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4700 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4701 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4702
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4703 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
4704 G_CALLBACK(addchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
4705 chat_account_filter_func, data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4706 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
4707 gaim_set_accessible_label (data->account_menu, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4708
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4709 data->entries_box = gtk_vbox_new(FALSE, 5);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4710 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
4711 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
4712
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4713 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4714
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4715 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4716 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4717
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4718 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4719 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4720 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4721 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4722
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4723 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4724 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4725 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4726 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
4727 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
4728 gaim_set_accessible_label (data->alias_entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4729
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4730 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4731 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4732
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4733 label = gtk_label_new(_("Group:"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4734 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4735 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4736 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4737
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4738 data->group_combo = gtk_combo_new();
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4739 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
4740 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
4741
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4742 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4743 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4744 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
4745 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4746 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4747 gaim_set_accessible_label (data->group_combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4748
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4749 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4750 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4751
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4752 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4753 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4754
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4755 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4756 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4757 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4758 GaimGroup *group;
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4759
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4760 group = gaim_group_new(group_name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4761 gaim_blist_add_group(group, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4762 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4763
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4764 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4765 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4766 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
4767 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4768 _("Please enter the name of the group to be added."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
4769 NULL, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4770 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4771 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4772 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4773
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4774 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4775 gaim_gtk_blist_toggle_visibility()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4776 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4777 if (gtkblist && gtkblist->window) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4778 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4779 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gtk_blist_obscured);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4780 } else {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4781 gaim_blist_set_visible(TRUE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4782 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4783 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4784 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4785
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4786 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4787 gaim_gtk_blist_visibility_manager_add()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4788 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4789 visibility_manager_count++;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4790 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4791
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4792 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4793 gaim_gtk_blist_visibility_manager_remove()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4794 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4795 if (visibility_manager_count)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4796 visibility_manager_count--;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4797 if (!visibility_manager_count)
12115
e9790eb93216 [gaim-migrate @ 14415]
Luke Schierer <lschiere@pidgin.im>
parents: 12113
diff changeset
4798 gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4799 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4800
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4801
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4802 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4803 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4804 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4805 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4806 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4807 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4808 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4809 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4810 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4811 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4812 gaim_gtk_blist_request_add_chat,
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
4813 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4814 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4815
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4816
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4817 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4818 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4819 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4820 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4821 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4822
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4823 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist()
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4824 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4825 return gtkblist;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4826 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4827
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4828 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4829 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4830 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4831 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4832 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4833 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4834 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4835 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4836 for(cnode = gnode->child; cnode; cnode = cnode->next)
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 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4839
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4840 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4841 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4842
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4843 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4844
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4845 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4846 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4847
8197
7c45eb829340 [gaim-migrate @ 8919]
Nathan Walp <nwalp@pidgin.im>
parents: 8143
diff changeset
4848 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
8198
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4849 (gaim_blist_node_get_string((GaimBlistNode*)chat,
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4850 "gtk-autojoin") != NULL))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4851 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4852 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4853 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4854 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4855
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4856 void *
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4857 gaim_gtk_blist_get_handle() {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4858 static int handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4859
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4860 return &handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4861 }
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4862
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4863 static gboolean buddy_signonoff_timeout_cb(GaimBuddy *buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4864 {
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4865 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4866 GaimConversation *conv;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4867
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4868 gtknode->recent_signonoff = FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4869 gtknode->recent_signonoff_timer = 0;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4870
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4871 gaim_gtk_blist_update(NULL, (GaimBlistNode*)buddy);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4872
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4873 if((conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account))) {
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4874 if(GAIM_BUDDY_IS_ONLINE(buddy)) {
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4875 gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_ONLINE);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4876 } else {
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4877 gaim_conversation_update(conv, GAIM_CONV_ACCOUNT_OFFLINE);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4878 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4879 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4880
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4881 return FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4882 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4883
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4884 static void buddy_signonoff_cb(GaimBuddy *buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4885 {
11915
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4886 struct _gaim_gtk_blist_node *gtknode;
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4887
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4888 if(!((GaimBlistNode*)buddy)->ui_data) {
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4889 gaim_gtk_blist_new_node((GaimBlistNode*)buddy);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4890 }
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4891
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4892 gtknode = ((GaimBlistNode*)buddy)->ui_data;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4893
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4894 gtknode->recent_signonoff = TRUE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4895
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4896 if(gtknode->recent_signonoff_timer > 0)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4897 gaim_timeout_remove(gtknode->recent_signonoff_timer);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4898 gtknode->recent_signonoff_timer = gaim_timeout_add(10000,
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4899 (GSourceFunc)buddy_signonoff_timeout_cb, buddy);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4900 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4901
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4902 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4903 {
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4904 void *gtk_blist_handle = gaim_gtk_blist_get_handle();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4905
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4906 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4907 gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4908 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4909
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4910 /* Initialize prefs */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4911 gaim_prefs_add_none("/gaim/gtk/blist");
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4912 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4913 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4914 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
4915 gaim_prefs_add_bool("/gaim/gtk/blist/list_visible", TRUE);
9711
b0ddfeccb9e6 [gaim-migrate @ 10572]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
4916 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "alphabetical");
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4917 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4918 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
9778
3d40125495e3 [gaim-migrate @ 10646]
Mark Doliner <mark@kingant.net>
parents: 9775
diff changeset
4919 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
4920 gaim_prefs_add_int("/gaim/gtk/blist/height", 500); /* Golden ratio, baby */
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
4921 gaim_prefs_add_int("/gaim/gtk/blist/pane", 300);
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4922 gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4923
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4924 /* Register our signals */
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4925 gaim_signal_register(gtk_blist_handle, "gtkblist-hiding",
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4926 gaim_marshal_VOID__POINTER, NULL, 1,
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4927 gaim_value_new(GAIM_TYPE_POINTER));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4928
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4929 gaim_signal_register(gtk_blist_handle, "gtkblist-unhiding",
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4930 gaim_marshal_VOID__POINTER, NULL, 1,
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4931 gaim_value_new(GAIM_TYPE_SUBTYPE));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4932
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4933 gaim_signal_register(gtk_blist_handle, "gtkblist-created",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4934 gaim_marshal_VOID__POINTER, NULL, 1,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4935 gaim_value_new(GAIM_TYPE_SUBTYPE,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4936 GAIM_SUBTYPE_BLIST));
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4937
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4938 gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4939 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4940 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_NODE),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
4941 gaim_value_new_outgoing(GAIM_TYPE_BOXED, "GString *"));
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4942
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4943
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4944 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4945 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4946 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4947
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4948 void
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4949 gaim_gtk_blist_uninit(void) {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4950 gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4951 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4952
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4953 /*********************************************************************
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4954 * Buddy List sorting functions *
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4955 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4956
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4957 GList *gaim_gtk_blist_get_sort_methods()
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4958 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4959 return gaim_gtk_blist_sort_methods;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4960 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4961
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4962 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
4963 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4964 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
4965 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4966 method->name = g_strdup(name);
9775
4c1a1be8ce33 [gaim-migrate @ 10643]
Mark Doliner <mark@kingant.net>
parents: 9774
diff changeset
4967 method->func = func;
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4968 gaim_gtk_blist_sort_methods = g_list_append(gaim_gtk_blist_sort_methods, method);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4969 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4970 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4971
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4972 void gaim_gtk_blist_sort_method_unreg(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4973 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4974
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4975 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4976 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4977 if(!strcmp(method->id, id)) {
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4978 gaim_gtk_blist_sort_methods = g_list_delete_link(gaim_gtk_blist_sort_methods, l);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4979 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4980 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4981 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4982 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4983 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4984 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4985 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4986 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4987
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4988 void gaim_gtk_blist_sort_method_set(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4989 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4990
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4991 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4992 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4993
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4994 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
4995 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4996
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4997 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4998 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4999 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5000 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5001 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5002 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5003 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5004
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5005 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5006
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5007 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5008 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5009 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5010
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5011 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
5012 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5013 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5014 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5015 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5016
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5017 if(cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5018 return *cur;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5019
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5020 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5021 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5022 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5023
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5024 gtk_tree_store_insert_after(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5025 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5026 sibling ? &sibling_iter : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5027
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5028 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5029 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5030
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5031 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5032
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5033 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
5034 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5035 GtkTreeIter more_z, iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5036 GaimBlistNode *n;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5037 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5038
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5039 const char *my_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5040
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5041 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5042 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5043 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5044 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5045 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5046 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5047 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5048
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5049
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5050 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
5051 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5052 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5053 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5054
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5055 do {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5056 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5057 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5058
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5059 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
5060 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5061
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5062 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5063 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5064 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5065 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5066 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5067 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5068 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5069
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5070 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5071
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5072 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5073 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5074 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5075 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5076 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5077 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5078 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5079 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5080 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5081 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5082 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5083 } 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
5084
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5085 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5086 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5087 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5088 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5089 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5090 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5091 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5092 }
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 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
5095 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5096 GtkTreeIter more_z, iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5097 GaimBlistNode *n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5098 GValue val = {0,};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5099
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5100 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5101
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5102 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5103 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5104 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5105 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5106 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5107
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5108 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5109 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5110 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5111 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5112 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5113
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5114
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5115 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
5116 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5117 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5118 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5119
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5120 do {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5121 gint name_cmp;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5122 gint presence_cmp;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5123
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5124 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
5125 n = g_value_get_pointer(&val);
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 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5128 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5129 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5130 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5131 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5132
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5133 name_cmp = gaim_utf8_strcasecmp(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5134 (my_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5135 ? gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5136 : NULL),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5137 (this_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5138 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5139 : NULL));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5140
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5141 presence_cmp = gaim_presence_compare(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5142 gaim_buddy_get_presence(my_buddy),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5143 gaim_buddy_get_presence(this_buddy));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5144
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5145 if (this_buddy == NULL ||
10860
d01d81de94d8 [gaim-migrate @ 12543]
Mark Doliner <mark@kingant.net>
parents: 10850
diff changeset
5146 (presence_cmp < 0 ||
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5147 (presence_cmp == 0 &&
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5148 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5149 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5150 if (cur != NULL)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5151 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5152 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5153 return *cur;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5154 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5155 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5156 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5157 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5158 &groupiter, &more_z);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5159 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5160 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5161 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5162
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5163 g_value_unset(&val);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5164 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5165 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5166 &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5167
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5168 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5169 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5170 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5171 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5172 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5173 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5174 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5175 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5176
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5177 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
5178 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5179 GtkTreeIter more_z, iter;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5180 GaimBlistNode *n = NULL, *n2;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5181 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5182
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5183 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5184 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5185
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5186 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
5187 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5188
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5189 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5190 for (n = node->child; n; n = n->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5191 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
5192 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5193 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5194 /* 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
5195 * from the chat info in the blist, yet */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5196 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5197 return *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 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5200 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5201 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5202 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5203 }
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
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5206 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
5207 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5208 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5209 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5210
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5211 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5212 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5213
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5214 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
5215 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5216 this_log_size = 0;
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(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5219 for (n2 = n->child; n2; n2 = n2->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5220 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
5221 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5222 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5223 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5224 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5225
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5226 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5227
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5228 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
5229 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5230 (cmp < 0 || (cmp == 0 && node < n)))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5231 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5232 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5233 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5234 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5235 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5236 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5237 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5238 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5239 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5240 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5241 } 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
5242
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5243 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5244 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5245 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5246 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5247 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5248 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5249 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5250 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5251
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5252 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5253
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5254 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5255 plugin_act(GtkObject *obk, GaimPluginAction *pam)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5256 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
5257 if (pam->callback)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
5258 pam->callback(pam);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5259 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5260
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5261 static GList *plugin_menu_items = NULL;
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
5262 static int plugin_menu_index = 10;
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5263
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5264 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5265 build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin, gpointer context)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5266 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5267 GtkWidget *menuitem = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5268 GaimPluginAction *action = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5269 GList *l, *ll;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5270
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5271 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
5272 if (l->data) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5273 action = (GaimPluginAction *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5274 action->plugin = plugin;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5275 action->context = context;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5276
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5277 menuitem = gtk_menu_item_new_with_label(action->label);
11745
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5278 if (context) {
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5279 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5280 } else {
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5281 plugin_menu_items = g_list_append(plugin_menu_items, menuitem);
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5282 plugin_menu_index++;
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5283 gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuitem, plugin_menu_index);
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
5284 }
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5285 g_signal_connect(G_OBJECT(menuitem), "activate",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5286 G_CALLBACK(plugin_act), action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5287 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5288 gtk_widget_show(menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5289 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5290 else
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5291 gaim_separator(menu);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5292 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5293
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5294 g_list_free(ll);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5295 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5296
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5297
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5298 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5299 gaim_gtk_blist_update_protocol_actions(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5300 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5301 GtkWidget *menuitem, *submenu;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5302 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5303 GaimConnection *gc = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5304 GaimPlugin *plugin = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5305 int count = 0;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5306
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5307 if (protomenu == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5308 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5309
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5310 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5311 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
5312 GaimPluginAction *action;
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
5313
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5314 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5315 action = (GaimPluginAction *) g_object_get_data(G_OBJECT(menuitem),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5316 "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5317 g_free(action);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5318
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5319 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
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
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5322 /* Count the number of accounts with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5323 for (l = gaim_connections_get_all(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5324 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5325 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5326
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5327 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5328 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5329
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5330 /* no need to count past 2, so don't */
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5331 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5332 break;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5333 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5334
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5335 if (count == 0) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5336 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5337 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5338 gtk_widget_set_sensitive(menuitem, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5339 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5340 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5341
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5342 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5343 /* Find the one account that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5344 for (l = gaim_connections_get_all(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5345 gc = l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5346 plugin = gc->prpl;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5347
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5348 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5349 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5350 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5351
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5352 build_plugin_actions(protomenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5353 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5354
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5355 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5356 for (l = gaim_connections_get_all(); l; l = l->next) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5357 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5358 GdkPixbuf *pixbuf, *scale;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5359 GtkWidget *image;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5360 char *buf;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5361
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5362 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5363 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5364
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5365 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
5366 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5367
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5368 account = gaim_connection_get_account(gc);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5369 buf = g_strconcat(gaim_account_get_username(account), " (",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5370 plugin->info->name, ")", NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5371 menuitem = gtk_image_menu_item_new_with_label(buf);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5372 g_free(buf);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5373
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10860
diff changeset
5374 pixbuf = gaim_gtk_create_prpl_icon(account);
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5375 if (pixbuf) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5376 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5377 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5378 image = gtk_image_new_from_pixbuf(scale);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5379 g_object_unref(G_OBJECT(pixbuf));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5380 g_object_unref(G_OBJECT(scale));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5381 gtk_widget_show(image);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5382 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
5383 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5384
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5385 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5386 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5387
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5388 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5389 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5390 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5391
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5392 build_plugin_actions(submenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5393 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5394 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5395 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5396
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5397 void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5398 gaim_gtk_blist_update_plugin_actions(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5399 {
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5400 GtkWidget *menuitem;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5401 GaimPlugin *plugin = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5402 GList *l;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5403 int count = 0;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5404
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5405 GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools"));
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5406
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5407 if (pluginmenu == NULL)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5408 return;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5409
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5410 /* Clear the old Account Actions menu */
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5411 for (l = plugin_menu_items; l; l = l->next) {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5412 GaimPluginAction *action;
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5413 plugin_menu_index--;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5414 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5415 action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5416 g_free(action);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5417
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5418 gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(menuitem));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5419 }
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5420 g_list_free(plugin_menu_items);
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5421 plugin_menu_items = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5422
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5423 /* Count the number of plugins with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5424 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5425 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5426
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5427 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5428 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5429
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5430 /* no need to count past 2, so don't */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5431 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5432 break;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5433 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5434
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5435 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5436
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5437 plugin = (GaimPlugin *) l->data;
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5438
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5439 if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5440 continue;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5441
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5442 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5443 continue;
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5444
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5445 build_plugin_actions(pluginmenu, plugin, NULL);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5446 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5447 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5448
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
5449 static void
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
5450 sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id)
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5451 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5452 if (gtk_check_menu_item_get_active(checkmenuitem))
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5453 {
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5454 gaim_gtk_blist_sort_method_set(id);
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5455 gaim_prefs_set_string("/gaim/gtk/blist/sort_type", id);
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5456 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5457 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5458
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5459 void
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5460 gaim_gtk_blist_update_sort_methods(void)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5461 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5462 GtkWidget *menuitem = NULL, *activeitem = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5463 GaimGtkBlistSortMethod *method = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5464 GList *l;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5465 GSList *sl = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5466 GtkWidget *sortmenu;
11797
e6bbf34b2465 [gaim-migrate @ 14088]
Nathan Walp <nwalp@pidgin.im>
parents: 11796
diff changeset
5467 const char *m = gaim_prefs_get_string("/gaim/gtk/blist/sort_type");
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5468
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5469 if (gtkblist == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5470 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5471
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
5472 sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies"));
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5473
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5474 if (sortmenu == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5475 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5476
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5477 /* Clear the old menu */
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5478 for (l = gtk_container_get_children(GTK_CONTAINER(sortmenu)); l; l = l->next) {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5479 menuitem = l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5480 gtk_widget_destroy(GTK_WIDGET(menuitem));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5481 }
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5482
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5483 for (l = gaim_gtk_blist_sort_methods; l; l = l->next) {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5484 method = (GaimGtkBlistSortMethod *) l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5485 menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5486 if (!strcmp(m, method->id))
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5487 activeitem = menuitem;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5488 sl = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5489 gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5490 g_signal_connect(G_OBJECT(menuitem), "toggled",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5491 G_CALLBACK(sortmethod_act), method->id);
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5492 gtk_widget_show(menuitem);
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5493 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5494 if (activeitem)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5495 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5496
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5497 }