annotate src/gtkblist.c @ 11868:4b71193448b3

[gaim-migrate @ 14159] Sean used tabs, not spaces. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 27 Oct 2005 21:48:05 +0000
parents 01c3eec6ea3c
children fdb78734e2ae
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"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
49 #include "gtkpounce.h"
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 11732
diff changeset
50 #include "gtkplugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
51 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
52 #include "gtkprivacy.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
53 #include "gtkroomlist.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
54 #include "gtkstatusbox.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
55 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
56
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
59 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
60
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
61 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
62 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
63 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
64
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
65 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
66 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
67 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
68 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
69 GtkWidget *account_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
70
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71 } GaimGtkAddBuddyData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
72
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
73 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
74 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
75 GaimAccount *account;
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
76 gchar *default_chat_name;
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
77
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
78 GtkWidget *window;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
79 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83 GtkSizeGroup *sg;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
85 GList *entries;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
86
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
87 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
88
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
89 typedef struct
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
90 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
91 GaimAccount *account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
92
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
93 GtkWidget *window;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
94 GtkWidget *account_menu;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
95 GtkWidget *entries_box;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
96 GtkSizeGroup *sg;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
97
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
98 GList *entries;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
99 } GaimGtkJoinChatData;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
100
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
101
9949
ced29c7b396c [gaim-migrate @ 10845]
Luke Schierer <lschiere@pidgin.im>
parents: 9944
diff changeset
102 static GtkWidget *protomenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
104 static GList *gaim_gtk_blist_sort_methods = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
105 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
106 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
107
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
108 /* 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
109 * 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
110 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
111 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
112 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
113 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
114 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
115 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 /* part of the best damn Docklet code this side of Tahiti */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 static gboolean gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 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
121 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
122 static char *gaim_get_tooltip_text(GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 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
124 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
125 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
126 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
127
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
128 static void gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
129
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
130 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
131 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
132 gboolean contact_expanded;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
133 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
134
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
135
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
136 static char dim_grey_string[8] = "";
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
137 static char *dim_grey()
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
138 {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
139 if (!gtkblist)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
140 return "dim grey";
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
141 if (!dim_grey_string[0]) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
142 GtkStyle *style = gtk_widget_get_style(gtkblist->treeview);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
143 snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
144 style->text_aa[GTK_STATE_NORMAL].red >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
145 style->text_aa[GTK_STATE_NORMAL].green >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
146 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
147 }
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
148 return dim_grey_string;
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
149 }
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
150
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 * Callbacks *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156 {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11692
diff changeset
157 gaim_core_quit();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 * 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
167 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
168 * 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
169 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170 gint x, y;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
174 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
176 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
177 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
178
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
179 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
180 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
181 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
182 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
183 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
184
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
185 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
188 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
189 if (x + event->width < 0 ||
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
190 y + event->height < 0 ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
191 x > gdk_screen_width() ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
192 y > gdk_screen_height()) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
193
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
194 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
195 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
196
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
197 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
198 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
199 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
200 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
201 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
202
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 gaim_gtk_blist_obscured = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 gaim_gtk_blist_obscured = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
218 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
223 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 {
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
225 gaim_gtkdialogs_im_with_user(b->account, b->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
228 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
229 {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
230 serv_send_file(b->account->gc, b->name, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
231 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
232
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
233 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
234 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
235 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
236 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
237 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
238
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
239 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 {
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
241 serv_join_chat(chat->account->gc, chat->components);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
242 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
243
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
244 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
245 char *arg2, gpointer nada)
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
246 {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
247 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
248 GtkTreePath *path;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
249 GValue val = {0,};
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
250 GaimBlistNode *node;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
251
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
252 path = gtk_tree_path_new_from_string (arg1);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
253 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
254 gtk_tree_path_free (path);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
255 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
256 node = g_value_get_pointer(&val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
257 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
258 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
259 switch (node->type){
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
260 case GAIM_BLIST_CONTACT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
261 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
262 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
263 case GAIM_BLIST_BUDDY_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
264 gaim_blist_alias_buddy((GaimBuddy*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
265 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
266 case GAIM_BLIST_GROUP_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
267 gaim_blist_rename_group((GaimGroup*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
268 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
269 case GAIM_BLIST_CHAT_NODE:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
270 gaim_blist_alias_chat((GaimChat*)node, arg2);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
271 break;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
272 default:
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
273 break;
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 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
276
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
277 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
278 {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
279 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
280 GtkTreePath *path;
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
281 const char *text = NULL;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
282
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
283 if (!(get_iter_from_node(node, &iter))) {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
284 /* 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
285 node = node->parent;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
286 if (!get_iter_from_node(node, &iter))
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
287 /* Now it's definitely a bug */
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
288 return;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
289 }
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
290
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
291 switch (node->type) {
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
292 case GAIM_BLIST_BUDDY_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
293 text = gaim_buddy_get_alias((GaimBuddy *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
294 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
295 case GAIM_BLIST_CONTACT_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
296 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
297 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
298 case GAIM_BLIST_GROUP_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
299 text = ((GaimGroup *)node)->name;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
300 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
301 case GAIM_BLIST_CHAT_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
302 text = gaim_chat_get_name((GaimChat *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
303 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
304 default:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
305 g_return_if_reached();
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
306 }
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
307
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
308 gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, text, -1);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
309
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
310 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
311 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
312 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
313 gtk_widget_grab_focus(gtkblist->treeview);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
314 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
315 gtk_tree_path_free(path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
318 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
320 gaim_gtkpounce_dialog_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
322
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
323 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 {
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
325 GaimLogType type;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
326 GaimAccount *account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
327 char *name = NULL;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
328
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
329 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
330 GaimBuddy *b = (GaimBuddy*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
331 type = GAIM_LOG_IM;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
332 name = g_strdup(b->name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
333 account = b->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
334 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
335 GaimChat *c = (GaimChat*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
336 GaimPluginProtocolInfo *prpl_info = NULL;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
337 type = GAIM_LOG_CHAT;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
338 account = c->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
339 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
340 if (prpl_info && prpl_info->get_chat_name) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
341 name = prpl_info->get_chat_name(c->components);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
342 }
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
343 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
344 gaim_gtk_log_show_contact((GaimContact *)node);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
345 return;
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
346 } else
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
347 return;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
348
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
349 if (name && account) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
350 gaim_gtk_log_show(type, name, account);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
351 g_free(name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
352 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
353 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
354
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
356 {
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8470
diff changeset
357 gaim_gtk_syslog_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
359
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
361 {
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10229
diff changeset
362 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
365 static void
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
366 do_join_chat(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
367 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
368 if (data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
369 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
370 GHashTable *components =
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
371 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
372 GList *tmp;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
373
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
374 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
375 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
376 if (g_object_get_data(tmp->data, "is_spin"))
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
377 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
378 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
379 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
380 g_strdup_printf("%d",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
381 gtk_spin_button_get_value_as_int(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
382 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
383 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
384 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
385 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
386 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
387 g_strdup(gtk_entry_get_text(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
388 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
389 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
390
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
391 serv_join_chat(gaim_account_get_connection(data->account), components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
392
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
393 g_hash_table_destroy(components);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
394 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
395 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
396
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
397 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
398 do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
399 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
400 switch(id)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
401 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
402 case GTK_RESPONSE_OK:
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
403 do_join_chat(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
404
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
405 break;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
406 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
407
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
408 gtk_widget_destroy(GTK_WIDGET(dialog));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
409 g_list_free(info->entries);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
410 g_free(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
411 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
412
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
413 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
414 * 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
415 * 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
416 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
417 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
418 joinchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
419 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
420 GaimGtkJoinChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
421 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
422 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
423 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
424 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
425
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
426 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
427
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
428 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
429 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
430 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
431 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
432 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
433 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
434 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
435 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
436 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
437 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
438
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
439 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
440 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
441
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
442 static void
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
443 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
444 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
445 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
446 GList *list = NULL, *tmp = NULL;
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
447 GHashTable *defaults = NULL;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
448 struct proto_chat_entry *pce;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
449 gboolean focus = TRUE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
450
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
451 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
452
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
453 gc = gaim_account_get_connection(data->account);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
454
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
455 while (GTK_BOX(data->entries_box)->children)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
456 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
457 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
458 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
459 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
460
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
461 if (data->entries != NULL)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
462 g_list_free(data->entries);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
463
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
464 data->entries = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
465
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
466 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
467 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
468
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
469 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
470 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
471
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
472 for (tmp = list; tmp; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
473 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
474 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
475 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
476 GtkWidget *input;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
477
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
478 pce = tmp->data;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
479
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
480 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
481 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
482
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
483 label = gtk_label_new_with_mnemonic(pce->label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
484 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
485 gtk_size_group_add_widget(data->sg, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
486 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
487
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
488 if (pce->is_int)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
489 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
490 GtkObject *adjust;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
491 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
492 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
493 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
494 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
495 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
496 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
497 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
498 {
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
499 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
500 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
501 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
502 value = g_hash_table_lookup(defaults, pce->identifier);
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
503 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
504 gtk_entry_set_text(GTK_ENTRY(input), value);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
505 if (pce->secret)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
506 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
507 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
508 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
509 G_CALLBACK(joinchat_set_sensitive_if_input_cb), data);
8303
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
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
512 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
513 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
514 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
515 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
516 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
517 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
518 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
519 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
520 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
521 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
522 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
523 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
524
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
525 g_free(pce);
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
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
528 g_list_free(list);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
529 g_hash_table_destroy(defaults);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
530
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
531 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
532 joinchat_set_sensitive_if_input_cb(NULL, data);
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 gtk_widget_show_all(data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
535 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
536
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
537 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
538 joinchat_select_account_cb(GObject *w, GaimAccount *account,
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
539 GaimGtkJoinChatData *data)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
540 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
541 if (strcmp(gaim_account_get_protocol_id(data->account),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
542 gaim_account_get_protocol_id(account)) == 0)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
543 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
544 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
545 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
546 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
547 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
548 data->account = account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
549 rebuild_joinchat_entries(data);
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 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
552
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
553 static gboolean
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
554 chat_account_filter_func(GaimAccount *account)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
555 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
556 GaimConnection *gc = gaim_account_get_connection(account);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
557 GaimPluginProtocolInfo *prpl_info = NULL;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
558
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
559 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
560
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
561 return (prpl_info->chat_info != NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
562 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
563
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
564 gboolean
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
565 gaim_gtk_blist_joinchat_is_showable()
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
566 {
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
567 GList *c;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
568 GaimConnection *gc;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
569
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
570 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
571 gc = c->data;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
572
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
573 if (chat_account_filter_func(gaim_connection_get_account(gc)))
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
574 return TRUE;
8303
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
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
577 return FALSE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
578 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
579
8305
57bdd25752c1 [gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents: 8303
diff changeset
580 void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
581 gaim_gtk_blist_joinchat_show(void)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
582 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
583 GtkWidget *hbox, *vbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
584 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
585 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
586 GaimGtkBuddyList *gtkblist;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
587 GtkWidget *img = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
588 GaimGtkJoinChatData *data = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
589
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
590 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
591 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
592 GTK_ICON_SIZE_DIALOG);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
593 data = g_new0(GaimGtkJoinChatData, 1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
594
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
595 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
596 NULL, GTK_DIALOG_NO_SEPARATOR,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
597 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8305
diff changeset
598 GAIM_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
599 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
600 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
601 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
602 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
603 gtk_container_set_border_width(
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
604 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
605 gtk_window_set_role(GTK_WINDOW(data->window), "join_chat");
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
606
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
607 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
608 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
609 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
610 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
611
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
612 vbox = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
613 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
614 gtk_container_add(GTK_CONTAINER(hbox), vbox);
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 label = gtk_label_new(_("Please enter the appropriate information "
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
617 "about the chat you would like to join.\n"));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
618 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
619 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
620 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
621
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
622 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
623 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
624
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
625 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
626
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
627 label = gtk_label_new_with_mnemonic(_("_Account:"));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
628 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
629 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
630 gtk_size_group_add_widget(data->sg, label);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
631
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
632 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE,
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
633 G_CALLBACK(joinchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
634 chat_account_filter_func, data);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
635 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
636 gtk_label_set_mnemonic_widget(GTK_LABEL(label),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
637 GTK_WIDGET(data->account_menu));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
638 gaim_set_accessible_label (data->account_menu, label);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
639
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
640 data->entries_box = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
641 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
642 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
643
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
644 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
645
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
646 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
647
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
648 g_signal_connect(G_OBJECT(data->window), "response",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
649 G_CALLBACK(do_joinchat), data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
650
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
651 g_object_unref(data->sg);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
652
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
653 gtk_widget_show_all(data->window);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
654 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
655
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
656 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
657 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
658 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
659
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
660 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
661
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
662 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
663
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
664 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
665 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
666 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
667 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
668
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
669 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
670 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
671 GValue val = {0,};
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
672
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
673 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
674
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
675 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
676
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
677 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
678 gaim_blist_node_set_bool(node, "collapsed", TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
679 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
680 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
681 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
682 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 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
685 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
686 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
687 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
688
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
689 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
690
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
691 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
692 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
693
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
694 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
695 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
696
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
697 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
698 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
699 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
700 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
701
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
702 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
703 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
704 serv_join_chat(((GaimChat *)node)->account->gc, ((GaimChat *)node)->components);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
705 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
706 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
707 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
708 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
709 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
710 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
711 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
712
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
713 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
714 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
715 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
716 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
717 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
718
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
719 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
720 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
721 if (GAIM_BLIST_NODE_IS_BUDDY(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
722 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
723 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
724 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
725 else if (GAIM_BLIST_NODE_IS_GROUP(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
726 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
727 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
728 else {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
729 gaim_blist_request_add_chat(NULL, NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
730 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
731 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
732
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
734 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
736 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
737 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
740 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
741 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
742 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
743 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
744 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
745 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
746 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
747 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
748 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
749 }
5228
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 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
752 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
753 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
754 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
755
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
756 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
757 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
758 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
759 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
760 gaim_gtkdialogs_remove_buddy((GaimBuddy*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
761 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
762 gaim_gtkdialogs_remove_chat((GaimChat*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
763 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
764 gaim_gtkdialogs_remove_group((GaimGroup*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
765 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
766 gaim_gtkdialogs_remove_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
768 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
769
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
770 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
771 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
772 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
773 struct _gaim_gtk_blist_node *gtknode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
774 GtkTreeIter iter, parent;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
775 GaimBlistNode *bnode;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
776 GtkTreePath *path;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
777
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
778 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
779 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
780
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
781 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
782
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
783 gtknode->contact_expanded = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
784
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
785 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
786 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
787 }
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
788
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
789 /* 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
790 get_iter_from_node(node, &parent);
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
791 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
792 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
793 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
794 /* Let the treeview draw so it knows where to scroll */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
795 while (gtk_events_pending())
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
796 gtk_main_iteration();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
797 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
798
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
799
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
800 gaim_gtk_blist_update(NULL, node);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
801 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
802 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
803
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
804 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
805 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
806 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
807 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
808 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
809
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
810 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
811 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
812
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
813 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
814
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
815 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
816
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
817 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
818 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
819 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
820 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
821
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
822
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
823 static void
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
824 blist_node_menu_cb(GtkMenuItem *item, GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
825 {
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
826 void (*callback)(GaimBlistNode *, gpointer);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
827 gpointer data;
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
828 callback = g_object_get_data(G_OBJECT(item), "gaimcallback");
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
829 data = g_object_get_data(G_OBJECT(item), "gaimcallbackdata");
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
830 if (callback)
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
831 callback(node, data);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
832 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
833
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
834
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
835 static void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
836 append_blist_node_action(GtkWidget *menu, GaimBlistNodeAction *act,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
837 GaimBlistNode *node, gboolean *dup_separator)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
838 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
839 if(act == NULL) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
840 if(! *dup_separator) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
841 gaim_separator(menu);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
842 *dup_separator = TRUE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
843 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
844 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
845 GtkWidget *menuitem;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
846
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
847 if (act->children == NULL) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
848 *dup_separator = FALSE;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
849
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
850 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
11038
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
851 if (act->callback != NULL) {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
852 g_object_set_data(G_OBJECT(menuitem), "gaimcallback",
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
853 act->callback);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
854 g_object_set_data(G_OBJECT(menuitem), "gaimcallbackdata",
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
855 act->data);
11038
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
856 g_signal_connect(G_OBJECT(menuitem), "activate",
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
857 G_CALLBACK(blist_node_menu_cb), node);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
858 } else {
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
859 gtk_widget_set_sensitive(menuitem, FALSE);
aedd557f46dd [gaim-migrate @ 12935]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
860 }
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
861 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
862 } else {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
863 GtkWidget *submenu = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
864 GList *l = NULL;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
865
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
866 menuitem = gtk_menu_item_new_with_mnemonic(act->label);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
867 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
868
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
869 submenu = gtk_menu_new();
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
870 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
871
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
872 for (l = act->children; l; l = l->next) {
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
873 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
874
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
875 append_blist_node_action(submenu, act, node, dup_separator);
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
876 }
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
877 g_list_free(act->children);
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
878 act->children = NULL;
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
879 }
11638
3a05b53a589e [gaim-migrate @ 13914]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11636
diff changeset
880 g_free(act);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
881 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
882 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
883
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
884
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
885 void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
886 gaim_gtk_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc,
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
887 GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
888 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
889 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
890 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
891 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
892
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
893 if(!prpl_info || !prpl_info->blist_node_menu)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
894 return;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
895
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
896 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
897 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
898 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
899 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
900 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
901 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
902
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
903
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
904 void
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
905 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
906 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
907 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
908 gboolean dup_separator = FALSE;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
909
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
910 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
911 GaimBlistNodeAction *act = (GaimBlistNodeAction *) l->data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
912 append_blist_node_action(menu, act, node, &dup_separator);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
913 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
914 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
915 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
916
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
917
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
918 void
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
919 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
920 GaimPluginProtocolInfo *prpl_info;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
921 GaimContact *contact;
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
922 gboolean contact_expanded = FALSE;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
923
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
924 g_return_if_fail(menu);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
925 g_return_if_fail(buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
926
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
927 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
928
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
929 contact = gaim_buddy_get_contact(buddy);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
930 if (contact) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
931 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
932 }
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
933
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
934 if (prpl_info && prpl_info->get_info) {
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
935 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
936 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
937 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
938 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
939 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
940 if (prpl_info && prpl_info->send_file) {
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
941 if (!prpl_info->can_receive_file ||
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
942 prpl_info->can_receive_file(buddy->account->gc, buddy->name))
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
943 {
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
944 gaim_new_item_from_stock(menu, _("_Send File"),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
945 GAIM_STOCK_FILE_TRANSFER,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
946 G_CALLBACK(gtk_blist_menu_send_file_cb),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
947 buddy, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
948 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
949 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
950 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), NULL,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
951 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
952
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
953 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
954 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
955 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
956 contact, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
957 } else if (!sub) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
958 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
959 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
960 }
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
961
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
962 gaim_gtk_append_blist_node_proto_menu(menu, buddy->account->gc,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
963 (GaimBlistNode *)buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
964 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
965
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
966 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
967
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
968 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
969 gaim_new_item_from_stock(menu, _("_Alias Buddy..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
970 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
971 gaim_new_item_from_stock(menu, _("_Remove Buddy"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
972 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
973 gaim_new_item_from_stock(menu, _("Alias Contact..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
974 G_CALLBACK(gtk_blist_menu_alias_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
975 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
976 gaim_new_item_from_stock(menu, _("Remove Contact"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
977 G_CALLBACK(gaim_gtk_blist_remove_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
978 contact, 0, 0, NULL);
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
979 } else {
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
980 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
981 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
982 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
983 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
984 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
985 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
986 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
987
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
988 static gboolean
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
989 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
990 GaimBlistNode *node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
991 GValue val = { 0, };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
992 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
993 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
994
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
995 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
996 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
997 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
998
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
999 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1000 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1001 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1003 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1004 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1005 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1006
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1007 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1008 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1009 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1010 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1011 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1012 return FALSE;
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 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1015 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1016 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1017
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1018 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1019 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1020
9013
d494fd1bd90b [gaim-migrate @ 9789]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
1021
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1022 static GtkWidget *
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1023 create_group_menu (GaimBlistNode *node, GaimGroup *g)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1024 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1025 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1026
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1027 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1028 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
1029 G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1030 gaim_new_item_from_stock(menu, _("Add a C_hat"), GTK_STOCK_ADD,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1031 G_CALLBACK(gaim_gtk_blist_add_chat_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1032 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1033 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1034 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
1035 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
1036
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1037 gaim_gtk_append_blist_node_extended_menu(menu, node);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1038
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1039 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1040 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1041
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1042
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1043 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1044 create_chat_menu(GaimBlistNode *node, GaimChat *c) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1045 GtkWidget *menu;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1046 gboolean autojoin;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1047
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1048 menu = gtk_menu_new();
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1049 autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1050 (gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1051
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1052 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1053 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
1054 gaim_new_check_item(menu, _("Auto-Join"),
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1055 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1056 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1057 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
1058
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1059 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
1060 gaim_gtk_append_blist_node_extended_menu(menu, node);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1061
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1062 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1063
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1064 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1065 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1066 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1067 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
1068
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1069 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1070 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1071
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1072 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1073 create_contact_menu (GaimBlistNode *node)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1074 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1075 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1076
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1077 menu = gtk_menu_new();
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1078
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1079 gaim_new_item_from_stock(menu, _("View _Log"), NULL,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1080 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1081 node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1082
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1083 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1084
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1085 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1086 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
1087 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1088 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1089
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1090 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1091
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1092 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1093 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1094 node, 0, 0, NULL);
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1095
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1096 gaim_gtk_append_blist_node_extended_menu(menu, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1097
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1098 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1099 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1100
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1101 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1102 create_buddy_menu(GaimBlistNode *node, GaimBuddy *b) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1103 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
1104 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1105 GtkWidget *menuitem;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1106 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
1107
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1108 menu = gtk_menu_new();
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1109 gaim_gtk_blist_make_buddy_menu(menu, b, FALSE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1110
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1111 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1112 gaim_separator(menu);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1113
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1114 if(gtknode->contact_expanded) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1115 gaim_new_item_from_stock(menu, _("_Collapse"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1116 GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1117 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1118 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1119 } else {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1120 gaim_new_item_from_stock(menu, _("_Expand"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1121 GTK_STOCK_ZOOM_IN,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1122 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1123 0, 0, NULL);
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 if(node->child->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1126 GaimBlistNode *bnode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1127
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1128 for(bnode = node->child; bnode; bnode = bnode->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1129 GaimBuddy *buddy = (GaimBuddy*)bnode;
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1130 GdkPixbuf *buf;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1131 GtkWidget *submenu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1132 GtkWidget *image;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1133
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1134 if(buddy == b)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1135 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1136 if(!buddy->account->gc)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1137 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1138 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1139 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1140
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1141 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1142 buf = gaim_gtk_blist_get_status_icon(bnode,
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1143 GAIM_STATUS_ICON_SMALL);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1144 image = gtk_image_new_from_pixbuf(buf);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1145 g_object_unref(G_OBJECT(buf));
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1146 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
1147 image);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1148 gtk_widget_show(image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1149 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1150 gtk_widget_show(menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1151
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1152 submenu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1153 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1154 gtk_widget_show(submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1155
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1156 gaim_gtk_blist_make_buddy_menu(submenu, buddy, TRUE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1157 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1158 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1159 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1160 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1161 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1162
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1163 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1164 gaim_gtk_blist_show_context_menu(GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1165 GtkMenuPositionFunc func,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1166 GtkWidget *tv,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1167 guint button,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1168 guint32 time)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1169 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1170 struct _gaim_gtk_blist_node *gtknode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1171 GtkWidget *menu = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1172 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1173
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1174 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1175
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1176 /* Create a menu based on the thing we right-clicked on */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1177 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1178 GaimGroup *g = (GaimGroup *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1179
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1180 menu = create_group_menu(node, g);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1181 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1182 GaimChat *c = (GaimChat *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1183
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1184 menu = create_chat_menu(node, c);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1185 } else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1186 menu = create_contact_menu(node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1187 } 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
1188 GaimBuddy *b;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1189
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1190 if (GAIM_BLIST_NODE_IS_CONTACT(node))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1191 b = gaim_contact_get_priority_buddy((GaimContact*)node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1192 else
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1193 b = (GaimBuddy *)node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1194
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1195 menu = create_buddy_menu(node, b);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1196 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1197
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1198 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1199 /* 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
1200 * 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
1201 This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1202 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1203 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1204 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1205 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1206 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1207
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1208 /* Now display the menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1209 if (menu != NULL) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1210 gtk_widget_show_all(menu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1211 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
1212 handled = TRUE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1213 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1214
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1215 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1216 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1217
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1218 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
1219 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1220 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1221 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1222 GValue val = { 0, };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1223 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1224 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1225 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1226 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1227 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1228 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1229
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1230 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1231 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
1232 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1233 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
1234 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
1235 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1236 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1237
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1238 /* Right click draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1239 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1240 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
1241
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1242 /* CTRL+middle click expands or collapse a contact */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1243 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1244 (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1245 if (gtknode->contact_expanded)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1246 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1247 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1248 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1249 handled = TRUE;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1250
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1251 /* Double middle click gets info */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1252 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1253 ((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
1254 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1255 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1256 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1257 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1258 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1259
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1260 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1261 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1262 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1263
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1264 if (prpl && prpl_info->get_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1265 serv_get_info(b->account->gc, b->name);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1266 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1267 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1268
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1269 #if (1)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1270 /*
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
1271 * 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
1272 * FALSE here, as would be normal the event propoagates down and
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1273 * somehow gets interpreted as the start of a drag event.
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1274 *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1275 * 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
1276 * was handled? --Mark
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1277 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1278 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1279 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1280 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1281 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1282 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1283 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1284 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1285 gtk_tree_path_free(path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1286
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1287 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1288 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1289
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1290 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1291 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1292 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1293 GaimBlistNode *node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1294 GValue val = { 0, };
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1295 GtkTreeIter iter;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1296 GtkTreeSelection *sel;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1297 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1298
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1299 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1300 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1301 return FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1302
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1303 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1304 &iter, NODE_COLUMN, &val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1305 node = g_value_get_pointer(&val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1306
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1307 /* Shift+F10 draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1308 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
1309
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1310 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1311 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1312
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1313 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
1314 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1315 gaim_prefs_set_bool("/gaim/gtk/blist/show_buddy_icons",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1316 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1317 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1318
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1319 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
1320 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1321 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1322 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1323 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1324
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1325 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
1326 GtkWidget *checkitem) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1327 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1328 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1329 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1330 while (gtk_events_pending())
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1331 gtk_main_iteration();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1332 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1333 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1334
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1335 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1336 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1337
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1338 if(gtkblist->window->window) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1339 GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1340 gdk_window_set_cursor(gtkblist->window->window, cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1341 gdk_cursor_unref(cursor);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1342 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1343 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1344
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1345 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
1346 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1347 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
1348 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1349
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1350 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
1351 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1352 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
1353 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1354 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1355
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1356 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
1357 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1358 gboolean sensitive = TRUE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1359
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1360 if(!strcmp(value, "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1361 sensitive = FALSE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1362
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1363 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
1364 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1365
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1366 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1367 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
1368 const char *alias)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1369 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1370 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1371 GaimAccount *account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1372 GaimConnection *gc;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1373
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1374 if (list == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1375 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1376
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1377 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1378 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1379 gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1380 account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1381
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1382 if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1383 break;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1384
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1385 account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1386 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1387
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1388 if (account != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1389 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1390 for (l = list; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1391 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1392 gaim_blist_request_add_buddy(account, l->data,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1393 (group ? group->name : NULL),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1394 alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1395 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1396 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1397
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1398 g_list_foreach(list, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1399 g_list_free(list);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1400 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1401
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1402 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1403 parse_vcard(const char *vcard, GaimGroup *group)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1404 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1405 char *temp_vcard;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1406 char *s, *c;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1407 char *alias = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1408 GList *aims = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1409 GList *icqs = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1410 GList *yahoos = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1411 GList *msns = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1412 GList *jabbers = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1413
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1414 s = temp_vcard = g_strdup(vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1415
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1416 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
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 char *field, *value;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1419
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1420 field = s;
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 /* Grab the field */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1423 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1424 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1425
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1426 if (*s == '\r') s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1427 if (*s == '\n')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1428 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1429 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1430 continue;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1431 }
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 if (*s != '\0') *s++ = '\0';
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 if ((c = strchr(field, ';')) != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1436 *c = '\0';
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 /* Proceed to the end of the line */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1439 value = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1440
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1441 while (*s != '\r' && *s != '\n' && *s != '\0')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1442 s++;
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 if (*s == '\r') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1445 if (*s == '\n') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1446
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1447 /* We only want to worry about a few fields here. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1448 if (!strcmp(field, "FN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1449 alias = g_strdup(value);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1450 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1451 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1452 !strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1453 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1454 char **values = g_strsplit(value, ":", 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1455 char **im;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1456
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1457 for (im = values; *im != NULL; im++)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1458 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1459 if (!strcmp(field, "X-AIM"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1460 aims = g_list_append(aims, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1461 else if (!strcmp(field, "X-ICQ"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1462 icqs = g_list_append(icqs, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1463 else if (!strcmp(field, "X-YAHOO"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1464 yahoos = g_list_append(yahoos, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1465 else if (!strcmp(field, "X-MSN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1466 msns = g_list_append(msns, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1467 else if (!strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1468 jabbers = g_list_append(jabbers, g_strdup(*im));
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1471 g_strfreev(values);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1472 }
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1475 g_free(temp_vcard);
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 if (aims == NULL && icqs == NULL && yahoos == NULL &&
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1478 msns == NULL && jabbers == NULL)
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 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1481 g_free(alias);
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 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1484 }
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 add_buddies_from_vcard("prpl-oscar", group, aims, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1487 add_buddies_from_vcard("prpl-oscar", group, icqs, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1488 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1489 add_buddies_from_vcard("prpl-msn", group, msns, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1490 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
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 (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1493 g_free(alias);
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 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1496 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1497
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1498 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1499 static void gaim_gtk_blist_drag_begin(GtkWidget *widget,
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1500 GdkDragContext *drag_context, gpointer user_data)
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1501 {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1502 gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1503
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1504
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1505 /* 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
1506 * to appear and obscure the dragging operation.
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1507 * This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1508 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1509 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1510 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1511 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1512 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1513 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1514
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1515 static void gaim_gtk_blist_drag_data_get_cb(GtkWidget *widget,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1516 GdkDragContext *dc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1517 GtkSelectionData *data,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1518 guint info,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1519 guint time,
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1520 gpointer null)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1521 {
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1522
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1523 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1524 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1525 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
1526 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1527 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1528 GaimBlistNode *node = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1529 GValue val = {0};
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1530 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1531 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1532 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1533 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
1534 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1535 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1536 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1537 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1538 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1539 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1540
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1541 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1542 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1543 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
1544 {
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1545 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1546 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1547 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1548 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1549 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1550 GaimConnection *gc;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1551 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1552 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1553 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1554 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1555
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1556 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
1557 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1558
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1559 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1560 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1561
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1562 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1563 sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1564 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1565 NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1566
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1567 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1568
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1569 if (GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1570 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1571 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1572 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1573 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1574 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1575 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1576 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1577 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1578 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1579 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1580 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1581 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1582
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1583 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1584
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1585 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1586 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1587 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1588 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1589 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1590
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1591 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1592 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1593 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1594
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1595 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1596 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1597 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1598 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1599 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1600 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1601 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1602 buddy->name);
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 if (buddy->alias != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1605 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1606 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1607 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1608 buddy->alias);
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
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1611 str = g_string_append(str, "\r\n");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1612
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1613 mime_str = g_string_free(str, FALSE);
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 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1616 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1617 8, /* bits */
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1618 (const guchar *)mime_str,
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1619 strlen(mime_str) + 1);
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 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1622 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1623 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1624 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1625
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1626 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
1627 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1628 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1629 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1630 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1631 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1632 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1633 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1634 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
1635 /* 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
1636 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1637 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1638 GValue val = {0};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1639 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1640
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1641 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1642 &iter, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1643 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1644 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1645 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1646 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1647
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1648 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1649 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1650 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1651 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1652 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1653 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1654 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1655 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1656 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1657 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1658 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1659 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1660 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1661 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1662 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1663 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1664 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1665 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1666 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1667 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1668 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1669 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1670 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1671 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1672 GaimBuddy *b = (GaimBuddy*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1673 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1674 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1675 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1676 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1677 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1678 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1679 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1680 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1681 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1682 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1683 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1684 node->prev);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1685 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1686 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1687 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1688 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1689 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1690 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1691 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1692 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1693 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1694 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1695 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1696 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1697 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1698 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1699 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1700 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1701 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1702 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1703 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1704 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1705 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1706 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1707 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1708 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1709 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1710 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1711 (GaimGroup*)node->parent, NULL);
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 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1714 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1715 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1716 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1717 break;
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 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1720 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1721 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1722 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1723 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1724 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1725 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1726 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1727 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1728 (GaimGroup*)node->parent->parent, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1729 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1730 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1731 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1732 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1733 (GaimGroup*)node->parent->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1734 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1735 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1736 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1737 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1738 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1739 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1740 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1741 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1742 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1743 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1744 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1745 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1746 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1747 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1748 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1749 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1750 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1751 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1752 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1753 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1754 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1755 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1756 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1757 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1758 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1759 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1760 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1761 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1762 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1763 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1764 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1765 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1766 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1767 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1768 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1769 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1770 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1771 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1772
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1773 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1774 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1775 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1776 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1777 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1778 FALSE) && sd->data)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1779 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1780 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1781 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1782 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1783 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1784 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1785 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1786 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1787
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1788 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
1789 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1790 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1791 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1792 GaimBlistNode *node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1793 GValue val = {0};
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1794
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1795 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1796 &iter, path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1797 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1798 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1799 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1800
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1801 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1802 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1803 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1804 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1805 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1806 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1807 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1808 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1809 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1810 else if (GAIM_BLIST_NODE_IS_GROUP(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1811 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1812 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1813 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1814 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1815
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1816 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
1817 &protocol, &username, &alias))
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1818 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1819 if (account == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1820 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1821 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1822 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1823 "can add that buddy."), NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1824 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1825 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1826 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1827 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1828 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1829 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1830 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1831 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1832
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1833 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1834 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1835 if (alias != NULL) g_free(alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1836
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1837 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1838 gtk_tree_path_free(path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1839
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1840 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1841 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1842 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
1843 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1844 gboolean result;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1845 GaimGroup *group = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1846 GtkTreePath *path = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1847 GtkTreeViewDropPosition position;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1848
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1849 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
1850 x, y, &path, &position))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1851 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1852 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1853 GaimBlistNode *node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1854 GValue val = {0};
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1855
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1856 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1857 &iter, path);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1858 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1859 &iter, NODE_COLUMN, &val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1860 node = g_value_get_pointer(&val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1861
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1862 if (GAIM_BLIST_NODE_IS_BUDDY(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1863 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1864 group = (GaimGroup *)node->parent->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1865 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1866 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1867 GAIM_BLIST_NODE_IS_CONTACT(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1868 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1869 group = (GaimGroup *)node->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1870 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1871 else if (GAIM_BLIST_NODE_IS_GROUP(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1872 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1873 group = (GaimGroup *)node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1874 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1875 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1876
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1877 result = parse_vcard((const gchar *)sd->data, group);
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1878
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1879 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
1880 } 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
1881 GtkTreePath *path = NULL;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1882 GtkTreeViewDropPosition position;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1883
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1884 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
1885 x, y, &path, &position))
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1886 {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1887 GtkTreeIter iter;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1888 GaimBlistNode *node;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1889 GValue val = {0};
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1890
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1891 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1892 &iter, path);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1893 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1894 &iter, NODE_COLUMN, &val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1895 node = g_value_get_pointer(&val);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1896
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1897 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
1898 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
1899 gaim_dnd_file_manage(sd, b->account, b->name);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1900 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1901 } else {
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1902 gtk_drag_finish(dc, FALSE, FALSE, t);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1903 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1904 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1905 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1906 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1907
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1908 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBlistNode *node,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1909 gboolean scaled, gboolean greyed)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1910 {
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
1911 GdkPixbuf *buf, *ret = NULL;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1912 GdkPixbufLoader *loader;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1913 GaimBuddyIcon *icon;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1914 const guchar *data;
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1915 gsize len;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1916 GaimBuddy *buddy = (GaimBuddy *)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1917
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1918 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1919 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1920 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1921 buddy = (GaimBuddy*)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1922 } else {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1923 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1924 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1925
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1926 #if 0
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1927 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1928 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1929 #endif
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1930
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1931 if (!(icon = gaim_buddy_get_icon(buddy)))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1932 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
1933 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1934
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1935 loader = gdk_pixbuf_loader_new();
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1936 data = gaim_buddy_icon_get_data(icon, &len);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1937 gdk_pixbuf_loader_write(loader, data, len, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1938 buf = gdk_pixbuf_loader_get_pixbuf(loader);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1939 if (buf)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1940 g_object_ref(G_OBJECT(buf));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1941 gdk_pixbuf_loader_close(loader, NULL);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1942 g_object_unref(G_OBJECT(loader));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1943
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1944 if (buf) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1945 GaimAccount *account = gaim_buddy_get_account(buddy);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1946 GaimPluginProtocolInfo *prpl_info = NULL;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1947 int orig_width, orig_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1948 int scale_width, scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1949
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1950 if(account && account->gc)
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1951 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1952
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1953 if (greyed) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1954 GaimPresence *presence = gaim_buddy_get_presence(buddy);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1955 if (!GAIM_BUDDY_IS_ONLINE(buddy))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1956 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1957 if (gaim_presence_is_idle(presence))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1958 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1959 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1960
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1961 /* 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
1962 * 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
1963 * purposes */
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1964 scale_width = orig_width = gdk_pixbuf_get_width(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1965 scale_height = orig_height = gdk_pixbuf_get_height(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1966
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1967 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
1968
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1969 if (scaled) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1970 if(scale_height > scale_width) {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1971 scale_width = 30.0 * (double)scale_width / (double)scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1972 scale_height = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1973 } else {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1974 scale_height = 30.0 * (double)scale_height / (double)scale_width;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1975 scale_width = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1976 }
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1977
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1978 ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 30, 30);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1979 gdk_pixbuf_fill(ret, 0x00000000);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1980 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
1981 } else {
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
1982 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
1983 }
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1984 g_object_unref(G_OBJECT(buf));
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1985 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1986
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
1987 return ret;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1988 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1989
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1990 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
1991 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1992 GtkStyle *style;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1993 GdkPixbuf *pixbuf = gaim_gtk_blist_get_status_icon(node, GAIM_STATUS_ICON_LARGE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1994 PangoLayout *layout;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1995 GdkPixbuf *avatar = NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1996 int layout_width, layout_height;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1997
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
1998 if(gtkblist->tooltiptext == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1999 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2000
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2001 avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2002
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2003 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2004 pango_layout_set_markup(layout, gtkblist->tooltiptext, strlen(gtkblist->tooltiptext));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2005 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2006 pango_layout_set_width(layout, 300000);
10482
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 int w, h;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2009 pango_layout_get_size (layout, &w, &h);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2010 layout_width = PANGO_PIXELS(w) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2011 layout_height = PANGO_PIXELS(h) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2012 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2013 style = gtkblist->tipwindow->style;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2014
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2015 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2016 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2017
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2018 #if GTK_CHECK_VERSION(2,2,0)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2019 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, pixbuf,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2020 0, 0, 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2021 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2022 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2023 avatar, 0, 0, layout_width + 38 + 4, 4, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2024 #else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2025 gdk_pixbuf_render_to_drawable(pixbuf, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2026 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2027 gdk_pixbuf_render_to_drawable(avatar,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2028 GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, layout_width + 38 + 4,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2029 4, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2030 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2031
10778
e4cbe9401018 [gaim-migrate @ 12399]
Sean Egan <seanegan@gmail.com>
parents: 10738
diff changeset
2032 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2033 NULL, gtkblist->tipwindow, "tooltip", 38 + 4, 4, layout);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2034
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2035 if(avatar)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2036 g_object_unref (avatar);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2037
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2038 g_object_unref (pixbuf);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2039 g_object_unref (layout);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2040
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2041 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2042 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2043
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2044 static void gaim_gtk_blist_tooltip_destroy()
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2045 {
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2046 g_free(gtkblist->tooltiptext);
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2047 gtkblist->tooltiptext = NULL;
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2048
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2049 if (gtkblist->tipwindow == NULL)
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2050 return;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2051
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2052 gtk_widget_destroy(gtkblist->tipwindow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2053 gtkblist->tipwindow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2054 }
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2055
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2056 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2057 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2058 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2059 GtkTreeIter iter;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2060 GaimBlistNode *node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2061 GValue val = {0};
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2062 struct _gaim_gtk_blist_node *gtknode;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2063
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2064 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
2065 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2066 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
2067 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
2068 node = g_value_get_pointer(&val);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2069
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2070 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2071 gtk_tree_path_free(path);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2072 return FALSE;
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2073 }
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2074
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2075 gtknode = node->ui_data;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2076
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2077 if (!gtknode->contact_expanded) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2078 GtkTreeIter i;
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2079
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2080 gaim_gtk_blist_expand_contact_cb(NULL, node);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2081
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2082 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
2083 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
2084 gtkblist->mouseover_contact = node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2085 gtk_tree_path_down (path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2086 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
2087 GdkRectangle rect;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2088 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
2089 gtkblist->contact_rect.height += rect.height;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2090 gtk_tree_path_next(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2091 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2092 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2093 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2094 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2095 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2096
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2097 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2098 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2099 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2100 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2101 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2102 GValue val = {0};
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2103 int scr_w, scr_h, w, h, x, y;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2104 #if GTK_CHECK_VERSION(2,2,0)
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2105 int mon_num;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2106 GdkScreen *screen = NULL;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2107 #endif
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2108 PangoLayout *layout;
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2109 gboolean tooltip_top = FALSE;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2110 struct _gaim_gtk_blist_node *gtknode;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2111 GdkRectangle mon_size;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2112
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2113 /*
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2114 * Attempt to free the previous tooltip. I have a feeling
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2115 * this is never needed... but just in case.
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2116 */
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2117 gaim_gtk_blist_tooltip_destroy();
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2118
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2119 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
2120 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2121 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2122 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
2123 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2124
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2125 gtk_tree_path_free(path);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2126
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2127 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
2128 && !GAIM_BLIST_NODE_IS_CHAT(node))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2129 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2130
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2131 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2132
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2133 gtkblist->tooltiptext = gaim_get_tooltip_text(node);
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2134 if (gtkblist->tooltiptext == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2135 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2136
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2137 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2138 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2139 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2140 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2141 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2142 G_CALLBACK(gaim_gtk_blist_paint_tip), node);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2143 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2144
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2145 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2146 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2147 pango_layout_set_width(layout, 300000);
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2148 pango_layout_set_markup(layout, gtkblist->tooltiptext, strlen(gtkblist->tooltiptext));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2149 pango_layout_get_size (layout, &w, &h);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2150
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2151 #if GTK_CHECK_VERSION(2,2,0)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2152 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
2153 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2154 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2155
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2156 scr_w = mon_size.width + mon_size.x;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2157 scr_h = mon_size.height + mon_size.y;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2158 #else
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2159 scr_w = gdk_screen_width();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2160 scr_h = gdk_screen_height();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2161 gdk_window_get_pointer(NULL, &x, &y, NULL);
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2162 mon_size.x = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2163 mon_size.y = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2164 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2165
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2166 w = PANGO_PIXELS(w) + 8;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2167 h = PANGO_PIXELS(h) + 8;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2168
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2169 /* 38 is the size of a large status icon plus 4 pixels padding on each side.
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2170 * I should #define this or something */
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2171 w = w + 38;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2172 h = MAX(h, 38);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2173
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2174 /* Now the size of the buddy icon */
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2175 {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2176 GdkPixbuf *avatar = NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2177
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2178 if ((avatar = gaim_gtk_blist_get_buddy_icon(node, FALSE, FALSE))) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2179 w += gdk_pixbuf_get_width(avatar) + 8;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2180 h = MAX(h, gdk_pixbuf_get_height(avatar) + 8);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2181 g_object_unref(avatar);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2182 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2183 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2184
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2185 #if GTK_CHECK_VERSION(2,2,0)
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2186 if (w > mon_size.width)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2187 w = mon_size.width - 10;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2188
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2189 if (h > mon_size.height)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2190 h = mon_size.height - 10;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2191 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2192
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2193 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2194 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2195
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2196 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2197
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2198 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2199 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2200 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2201 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2202
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2203 if (y < mon_size.y)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2204 y = mon_size.y;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2205
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2206 if (y != mon_size.y) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2207 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2208 x -= (x + w + 5) - scr_w;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2209 else if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2210 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2211 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2212 x -= (w / 2 + 10);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2213 if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2214 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2215 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2216
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2217 g_object_unref (layout);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2218 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2219 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2220 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2221
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2222 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2223 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2224
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2225 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
2226 gint x, gint y, guint time, gpointer user_data)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2227 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2228 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2229 int delay;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2230
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2231 delay = 500;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2232
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2233 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2234 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
2235 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2236 /* 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
2237 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2238 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2239
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2240 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
2241 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
2242
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2243 if (path)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2244 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2245 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
2246
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2247 if (gtkblist->mouseover_contact) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2248 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
2249 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2250 gtkblist->mouseover_contact = NULL;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2251 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2252 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2253
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2254 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2255 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2256
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2257 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
2258 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2259 GtkTreePath *path;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2260 int delay;
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2261
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2262 delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2263
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2264 if (delay == 0)
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2265 return FALSE;
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2266
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2267 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2268 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
2269 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2270 /* 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
2271 gaim_gtk_blist_tooltip_destroy();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2272 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2273 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2274
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2275 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
2276 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
2277
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2278 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2279 gtk_tree_path_free(path);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2280 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
2281
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2282 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2283 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
2284 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2285 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2286 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2287 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2288
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2289 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2290 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2291
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2292 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
2293 {
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2294
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2295 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2296 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2297 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2298 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2299
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2300 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2301 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2302 gtkblist->drag_timeout = 0;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2303 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2304
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2305 gaim_gtk_blist_tooltip_destroy();
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2306
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2307 if (gtkblist->mouseover_contact &&
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2308 !((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
2309 (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
2310 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2311 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2312 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2313 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2314
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2315 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2316 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2317 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2318 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2319 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2320 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2321
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2322
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2323 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2324 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2325 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2326 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2327 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2328 /* Buddies menu */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2329 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>" },
9714
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2330 { 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
2331 { 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
2332 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO },
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2333 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2334 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>" },
11025
8d2007d738d5 [gaim-migrate @ 12899]
Mark Doliner <mark@kingant.net>
parents: 11023
diff changeset
2335 { 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
2336 { 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
2337 { N_("/Buddies/Show Buddy _Details"), NULL, gaim_gtk_blist_buddy_details_cb, 1, "<CheckItem>"},
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
2338 { N_("/Buddies/Sort Buddies"), NULL, NULL, 0, "<Branch>" },
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
2339 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>" },
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
2340 { 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
2341 { 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
2342 { 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
2343 { "/Buddies/sep3", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2344 { 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
2345
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2346 /* Tools */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2347 { N_("/_Tools"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2348 { N_("/Tools/Buddy _Pounce"), NULL, NULL, 0, "<Branch>" },
8845
48086c7bd568 [gaim-migrate @ 9612]
Mark Doliner <mark@kingant.net>
parents: 8844
diff changeset
2349 { N_("/Tools/Account Ac_tions"), NULL, NULL, 0, "<Branch>" },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2350 { "/Tools/sep1", NULL, NULL, 0, "<Separator>" },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2351 { N_("/Tools/A_ccounts"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
2352 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 11732
diff changeset
2353 { N_("/Tools/P_lugins"), NULL, gaim_gtk_plugin_dialog_show, 0, NULL },
10694
06f68443e6e5 [gaim-migrate @ 12246]
Mark Doliner <mark@kingant.net>
parents: 10664
diff changeset
2354 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR },
10019
8cc6f0bfa215 [gaim-migrate @ 10943]
Luke Schierer <lschiere@pidgin.im>
parents: 10018
diff changeset
2355 { 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
2356 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX },
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
2357 { "/Tools/sep2", NULL, NULL, 0, "<Separator>" },
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
2358 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>"},
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2359 { N_("/Tools/View System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2360
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2361 /* Help */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2362 { N_("/_Help"), NULL, NULL, 0, "<Branch>" },
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2363 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2364 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, NULL },
9753
60705fd4f411 [gaim-migrate @ 10620]
Mark Doliner <mark@kingant.net>
parents: 9749
diff changeset
2365 { 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
2366 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2367
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2368 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2369 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2370 *********************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2371
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2372 static char *gaim_get_tooltip_text(GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2373 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2374 GString *str = g_string_new("");
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2375 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2376 GaimPluginProtocolInfo *prpl_info = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2377 char *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2378
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2379 if (GAIM_BLIST_NODE_IS_CHAT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2380 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2381 GaimChat *chat;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2382 GList *cur;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2383 struct proto_chat_entry *pce;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2384 char *name, *value;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2385
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2386 chat = (GaimChat *)node;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2387 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
2388 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2389
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2390 tmp = g_markup_escape_text(gaim_chat_get_name(chat), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2391 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
2392 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2393
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2394 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2395 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2396 tmp = g_markup_escape_text(chat->account->username, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2397 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2398 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2399 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2400
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
2401 if (prpl_info->chat_info != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2402 cur = prpl_info->chat_info(chat->account->gc);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2403 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2404 cur = NULL;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2405
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2406 while (cur != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2407 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2408 pce = cur->data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2409
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2410 if (!pce->secret && (!pce->required &&
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2411 g_hash_table_lookup(chat->components, pce->identifier) == NULL))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2412 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2413 tmp = gaim_text_strip_mnemonic(pce->label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2414 name = g_markup_escape_text(tmp, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2415 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2416 value = g_markup_escape_text(g_hash_table_lookup(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2417 chat->components, pce->identifier), -1);
10924
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2418 g_string_append_printf(str, "\n<b>%s</b> %s",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2419 name ? name : "",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2420 value ? value : "");
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2421 g_free(name);
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2422 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2423 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2424
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2425 g_free(pce);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2426 cur = g_list_remove(cur, pce);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2427 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2428 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2429 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
2430 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2431 GaimContact *c;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2432 GaimBuddy *b;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2433 GaimPresence *presence;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2434 char *tmp;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2435 gboolean idle;
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2436 time_t idle_secs, signon;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2437
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2438 if (GAIM_BLIST_NODE_IS_CONTACT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2439 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2440 c = (GaimContact *)node;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2441 b = gaim_contact_get_priority_buddy(c);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2442 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2443 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2444 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2445 b = (GaimBuddy *)node;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2446 c = gaim_buddy_get_contact(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2447 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2448
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2449 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
2450 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2451
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2452 presence = gaim_buddy_get_presence(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2453
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2454 /* Buddy Name */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2455 tmp = g_markup_escape_text(gaim_buddy_get_name(b), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2456 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
2457 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2458
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2459 /* Account */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2460 if (g_list_length(gaim_connections_get_all()) > 1)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2461 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2462 tmp = g_markup_escape_text(gaim_account_get_username(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2463 gaim_buddy_get_account(b)), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2464 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2465 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2466 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2467
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2468 /* Contact Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2469 if (GAIM_BLIST_NODE_IS_CONTACT(node) &&
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2470 (c->alias != NULL))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2471 {
10499
d0c336ad0b27 [gaim-migrate @ 11791]
Mark Doliner <mark@kingant.net>
parents: 10484
diff changeset
2472 tmp = g_markup_escape_text(c->alias, -1);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2473 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
2474 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2475 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2476
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2477 /* Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2478 if ((b->alias != NULL) && (b->alias[0] != '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2479 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2480 tmp = g_markup_escape_text(b->alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2481 g_string_append_printf(str, _("\n<b>Alias:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2482 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2483 }
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 /* Nickname/Server Alias */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2486 if (b->server_alias != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2487 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2488 tmp = g_markup_escape_text(b->server_alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2489 g_string_append_printf(str, _("\n<b>Nickname:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2490 g_free(tmp);
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
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2493 /* Logged In */
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2494 signon = gaim_presence_get_login_time(presence);
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2495 if (GAIM_BUDDY_IS_ONLINE(b) && signon > 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2496 {
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2497 tmp = gaim_str_seconds_to_string(time(NULL) - signon);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2498 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
2499 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2500 }
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 /* Idle */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2503 idle = gaim_presence_is_idle(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2504 if (idle)
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 idle_secs = gaim_presence_get_idle_time(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2507 if (idle_secs > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2508 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2509 tmp = gaim_str_seconds_to_string(time(NULL) - idle_secs);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2510 g_string_append_printf(str, _("\n<b>Idle:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2511 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2512 }
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
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2515 /* Last Seen */
11437
1c20849fc716 [gaim-migrate @ 13674]
Richard Laager <rlaager@wiktel.com>
parents: 11436
diff changeset
2516 if ((!GAIM_BUDDY_IS_ONLINE(b) && b->present != GAIM_BUDDY_SIGNING_OFF) ||
1c20849fc716 [gaim-migrate @ 13674]
Richard Laager <rlaager@wiktel.com>
parents: 11436
diff changeset
2517 b->present == GAIM_BUDDY_SIGNING_ON)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2518 {
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2519 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2520 GaimBlistNode *bnode;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2521 int lastseen = 0;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2522
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2523 if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2524 {
11437
1c20849fc716 [gaim-migrate @ 13674]
Richard Laager <rlaager@wiktel.com>
parents: 11436
diff changeset
2525 /* 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
2526 * an expanded contact itself so we show the most recent
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2527 * (largest) last_seen time for any of the buddies under
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2528 * the contact. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2529 for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2530 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2531 int value = gaim_blist_node_get_int(bnode, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2532 if (value > lastseen)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2533 lastseen = value;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2534 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2535 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2536 else
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2537 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2538 /* We're dealing with a buddy under an expanded contact,
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2539 * so we show the last_seen time for the buddy. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2540 lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2541 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2542
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2543 if (lastseen > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2544 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2545 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2546 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
2547 g_free(tmp);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2548 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2549 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2550
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2551
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2552 /* Offline? */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2553 if (!GAIM_BUDDY_IS_ONLINE(b)) {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2554 g_string_append_printf(str, _("\n<b>Status:</b> Offline"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2555 }
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2556
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2557 if (prpl_info && prpl_info->tooltip_text)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2558 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2559 /* Additional text from the PRPL */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2560 const char *end;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2561 tmp = prpl_info->tooltip_text(b);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2562
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2563 if (tmp && !g_utf8_validate(tmp, -1, &end))
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 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
2566 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2567 tmp = new;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2568 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2569
11634
c7305c2d650b [gaim-migrate @ 13910]
Mark Doliner <mark@kingant.net>
parents: 11624
diff changeset
2570 if (tmp != NULL)
c7305c2d650b [gaim-migrate @ 13910]
Mark Doliner <mark@kingant.net>
parents: 11624
diff changeset
2571 g_string_append(str, tmp);
10476
d02e70b5d197 [gaim-migrate @ 11763]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10475
diff changeset
2572 g_free(tmp);
10475
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
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2575 /* These are Easter Eggs. Patches to remove them will be rejected. */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2576 if (!g_ascii_strcasecmp(b->name, "robflynn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2577 g_string_append(str, _("\n<b>Description:</b> Spooky"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2578 if (!g_ascii_strcasecmp(b->name, "seanegn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2579 g_string_append(str, _("\n<b>Status:</b> Awesome"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2580 if (!g_ascii_strcasecmp(b->name, "chipx86"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2581 g_string_append(str, _("\n<b>Status:</b> Rockin'"));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2582 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2583
8824
f08245ed03aa [gaim-migrate @ 9587]
Sean Egan <seanegan@gmail.com>
parents: 8823
diff changeset
2584 gaim_signal_emit(gaim_gtk_blist_get_handle(),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
2585 "drawing-tooltip", node, str);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2586
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2587 return g_string_free(str, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2588 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2589
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2590 struct _emblem_data {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9949
diff changeset
2591 const char *filename;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2592 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2593 int y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2594 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2595
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2596 GdkPixbuf *
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2597 gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2598 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2599 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2600 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2601 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2602 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2603 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2604 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2605 {NULL, 0, 0}, {NULL, 15, 0}};
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2606 GaimPresence *presence = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2607 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2608 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2609
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2610 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2611 if(!gtknode->contact_expanded)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2612 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2613 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2614 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2615 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2616 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2617 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2618 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2619 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2620
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2621 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2622 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2623 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2624 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2625
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2626 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2627 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2628 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2629 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2630
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2631 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2632 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2633 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2634
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2635 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2636
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2637 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2638 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2639 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2640 if(prpl_info && prpl_info->list_emblems && buddy) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2641 if(buddy->present != GAIM_BUDDY_SIGNING_OFF)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2642 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2643 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2644 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2645 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2646 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2647
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2648 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2649 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2650 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2651 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2652 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2653
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2654 if(buddy && buddy->present == GAIM_BUDDY_SIGNING_ON) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2655 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2656 } else if(buddy && buddy->present == GAIM_BUDDY_SIGNING_OFF) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2657 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
2658 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2659 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2660 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2661 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2662 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2663 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2664 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2665 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2666
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2667 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2668 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2669
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2670 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2671 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2672
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2673 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2674 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2675 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2676
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2677 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2678 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2679 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2680 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2681 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2682 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2683 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2684 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2685 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2686 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2687 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2688 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2689 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2690 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2691 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2692 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2693 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2694 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2695 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2696 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2697 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2698 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2699 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2700 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2701 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2702 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2703 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2704 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2705 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2706 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2707
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2708 if(buddy) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2709 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2710
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2711 if (!GAIM_BUDDY_IS_ONLINE(buddy))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2712 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2713 else if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2714 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2715 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2716 }
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2717
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2718 if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy)))
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2719 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2720 GdkPixbuf *emblem;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2721 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
2722
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2723 emblem = gdk_pixbuf_new_from_file(filename, NULL);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2724 g_free(filename);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2725
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2726 if (emblem)
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2727 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2728 gdk_pixbuf_composite(emblem, scale,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2729 0, 0, scalesize, scalesize,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2730 0, 0,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2731 (double)scalesize / gdk_pixbuf_get_width(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2732 (double)scalesize / gdk_pixbuf_get_height(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2733 GDK_INTERP_BILINEAR,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2734 224);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2735 g_object_unref(emblem);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2736 }
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2737 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2738 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2739
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2740 return scale;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2741 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2742
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2743 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
2744 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2745 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2746 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2747 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2748 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2749 GaimContact *contact;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2750 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2751 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2752 char *idletime = NULL, *statustext = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2753 time_t t;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2754 /* XXX Clean up this crap */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2755
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2756 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2757 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2758 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2759
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2760 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2761 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2762 else
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
2763 name = gaim_buddy_get_alias(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2764 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2765
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2766 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2767
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2768 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2769 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2770
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2771 presence = gaim_buddy_get_presence(b);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2772
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2773 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
2774
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2775 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
2776 {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2777 text = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2778 dim_grey(), esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2779 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2780 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2781 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2782 else
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2783 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2784 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2785
8122
36674144c510 [gaim-migrate @ 8826]
Christian Hammond <chipx86@chipx86.com>
parents: 8113
diff changeset
2786 if (prpl_info && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2787 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2788 const char *end;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2789
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2790 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2791 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2792 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2793 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2794 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2795 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2796
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2797 #if !GTK_CHECK_VERSION(2,6,0)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2798 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2799 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2800 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2801 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2802 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2803 g_strdelimit(tmp, "\n", ' ');
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804 gaim_str_strip_cr(tmp);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2805
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2806 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2807 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2808 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2809 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2810 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2811 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2812 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2813 c = g_utf8_next_char(c); /* this is fun */
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 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2817
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2818 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2819 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2820 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2821 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2822
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2823 statustext = g_strdup_printf(buf, tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2824
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2825 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2826 }
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2827 #else
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2828 statustext = tmp;
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2829 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2830 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2831
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
2832 if (gaim_presence_is_idle(presence)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2833 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2834
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
2835 if (idle_secs > 0) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2836 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2837
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2838 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2839 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2840 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2841
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2842 if (ihrs)
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2843 idletime = g_strdup_printf(_("Idle (%dh %02dm) "), ihrs, imin);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2844 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2845 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2846 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2847 else
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2848 idletime = g_strdup(_("Idle "));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2849 }
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 if(!GAIM_BUDDY_IS_ONLINE(b) && !statustext)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2852 statustext = g_strdup(_("Offline "));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2853
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2854 if (gaim_presence_is_idle(presence) && !selected) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2855 text = g_strdup_printf("<span color='%s'>%s</span>\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2856 "<span color='%s' size='smaller'>%s%s%s</span>",
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2857 dim_grey(), esc, dim_grey(),
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2858 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2859 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2860 idletime != NULL ? idletime : "");
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2861 } else if (statustext == NULL && idletime == NULL && GAIM_BUDDY_IS_ONLINE(b)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2862 text = g_strdup(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2863 } else {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2864 if (selected)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2865 text = g_strdup_printf("%s\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2866 "<span size='smaller'>%s%s%s</span>", esc,
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2867 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2868 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2869 idletime != NULL ? idletime : "");
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2870 else
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2871 text = g_strdup_printf("%s\n"
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2872 "<span color='%s' size='smaller'>%s%s%s</span>", esc,
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
2873 dim_grey(),
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2874 statustext != NULL ? statustext : "",
11134
f78e7e982cf4 [gaim-migrate @ 13195]
Richard Laager <rlaager@wiktel.com>
parents: 11111
diff changeset
2875 (idletime != NULL && statustext != NULL) ? " - " : "",
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2876 idletime != NULL ? idletime : "");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2877 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2878 if (idletime)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2879 g_free(idletime);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2880 if (statustext)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2881 g_free(statustext);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2882 if (esc)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2883 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2884
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2885 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2886 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2887
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2888 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2889 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2890 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2891
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2892 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2893
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2894 /* 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
2895 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2896 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2897 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2898
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2899 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2900 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2901 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2902
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2903 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2904 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2905 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2906 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2907 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2908
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2909 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2910 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2911 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2912 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2913
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2914 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2915 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2916 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2917 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2918 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2919
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2920 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2921 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2922 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2923
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2924 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2925 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2926 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2927 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2928 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2929 GaimBuddy *buddy;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2930
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2931 buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
2932
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
2933 if (buddy &&
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
2934 gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2935 gaim_gtk_blist_update(list, cnode);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2936 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2937 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2938 }
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 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2941 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2942 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2943
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2944 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
2945 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2946 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
2947 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2948
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2949 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2950 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2951
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2952 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2953 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2954
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2955 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2956 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2957 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
2958 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2959 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2960 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2961 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2962 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2963 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2964 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
2965
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2966 static const char *require_connection[] =
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2967 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2968 N_("/Buddies/New Instant Message..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2969 N_("/Buddies/Join a Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2970 N_("/Buddies/Get User Info..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2971 N_("/Buddies/Add Buddy..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2972 N_("/Buddies/Add Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2973 N_("/Buddies/Add Group..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2974 };
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2975
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
2976 static const int require_connection_size = sizeof(require_connection)
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
2977 / sizeof(*require_connection);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2978
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2979 /**
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2980 * Rebuild dynamic menus and make menu items sensitive/insensitive
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2981 * where appropriate.
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2982 */
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2983 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2984 update_menu_bar(GaimGtkBuddyList *gtkblist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2985 {
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2986 GtkWidget *widget;
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2987 gboolean sensitive;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2988 int i;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2989
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2990 g_return_if_fail(gtkblist != NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
2991
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2992 gaim_gtk_blist_update_protocol_actions();
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8222
diff changeset
2993 gaim_gtkpounce_menu_build(gtkblist->bpmenu);
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
2994
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2995 sensitive = (gaim_connections_get_all() != NULL);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2996
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
2997 for (i = 0; i < require_connection_size; i++)
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2998 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
2999 widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3000 gtk_widget_set_sensitive(widget, sensitive);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3001 }
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3002
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3003 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
3004 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3005
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3006 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
8939
19885cb8a24c [gaim-migrate @ 9709]
Mark Doliner <mark@kingant.net>
parents: 8938
diff changeset
3007 gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
8938
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3008
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3009 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3010 gtk_widget_set_sensitive(widget, gaim_gtk_privacy_is_showable());
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3011 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3012
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3013 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3014 sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3015 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3016 GaimGtkBuddyList *gtkblist = GAIM_GTK_BLIST(blist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3017
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3018 update_menu_bar(gtkblist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3019 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3020
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3021 static void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3022 plugin_changed_cb(GaimPlugin *p, gpointer *data)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3023 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3024 gaim_gtk_blist_update_plugin_actions();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3025 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3026
5228
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 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3029 **********************************************************************************/
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
3030
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3031 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3032 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3033 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3034
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3035 gtkblist = g_new0(GaimGtkBuddyList, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3036 blist->ui_data = gtkblist;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3037 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3038
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3039 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3040 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3041 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3042 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3043
11018
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3044 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3045 {
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3046 if GAIM_BLIST_NODE_IS_BUDDY(node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3047 node = node->parent;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3048
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3049 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
3050
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3051 return ((struct _gaim_gtk_blist_node *)node->ui_data)->contact_expanded;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3052 }
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3053
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3054 void gaim_gtk_blist_update_columns()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3055 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3056 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3057 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3058
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3059 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3060 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3061 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3062 } else {
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3063 gtk_tree_view_column_set_visible(gtkblist->idle_column, TRUE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3064 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3065 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3066 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3067
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3068 enum {
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3069 DRAG_BUDDY,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3070 DRAG_ROW,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3071 DRAG_VCARD,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3072 DRAG_TEXT,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3073 DRAG_URI,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3074 NUM_TARGETS
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3075 };
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3076
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3077 static char *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3078 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3079 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3080 return _((char *)path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3081 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3082
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3083 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3084 {
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3085 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
3086 #if GTK_CHECK_VERSION(2,2,1)
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3087 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
3088 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
3089 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
3090 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3091 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
3092 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3093
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3094 static void _prefs_change_redo_list()
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3095 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3096 redo_buddy_list(gaim_get_blist(), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3097 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3098
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3099 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
3100 gpointer val, gpointer data)
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3101 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3102 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3103 gaim_gtk_blist_sort_method_set(val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3104 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3105
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3106 /*
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3107 * "This is so dead sexy."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3108 * "Two thumbs up."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3109 * "Best movie of the year."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3110 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3111 * 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
3112 * It finds the top-most buddy/group/chat/whatever containing the
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3113 * entered string.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3114 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3115 * 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
3116 * "name" column of the buddy list (because the GtkTreeModel does not
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3117 * 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
3118 * 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
3119 * used rarely, so it shouldn't matter TOO much.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3120 */
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3121 static gboolean
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3122 _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
3123 {
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3124 gboolean result;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3125 gchar *enteredstring;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3126 gchar *withmarkup;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3127 gchar *nomarkup;
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3128 gchar *normalized;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3129
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3130 gtk_tree_model_get(model, iter, column, &withmarkup, -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3131
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3132 enteredstring = g_utf8_casefold(gaim_normalize(NULL, key), -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3133 nomarkup = gaim_markup_strip_html(withmarkup);
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3134 normalized = g_utf8_casefold(gaim_normalize(NULL, nomarkup), -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3135
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3136 result = (g_strstr_len(normalized, strlen(normalized), enteredstring) == NULL);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3137
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3138 g_free(withmarkup);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3139 g_free(enteredstring);
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3140 g_free(nomarkup);
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3141 g_free(normalized);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3142
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3143 return result;
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3144 }
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3145
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3146 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3147 {
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3148 void *handle;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3149 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3150 GtkTreeViewColumn *column;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3151 GtkWidget *menu;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3152 GtkWidget *sw;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3153 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3154 GtkTreeSelection *selection;
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3155 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
3156 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3157 {"text/x-vcard", 0, DRAG_VCARD },
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3158 {"text/uri-list", 0, DRAG_URI},
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3159 {"text/plain", 0, DRAG_TEXT}};
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3160 GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3161 {"application/x-im-contact", 0, DRAG_BUDDY},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3162 {"text/x-vcard", 0, DRAG_VCARD }};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3163 if (gtkblist && gtkblist->window) {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11692
diff changeset
3164 if (gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"))
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3165 gtk_widget_show(gtkblist->window);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3166 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3167 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3168
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3169 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3170
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3171 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3172 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
9746
3a71d70e3945 [gaim-migrate @ 10611]
Luke Schierer <lschiere@pidgin.im>
parents: 9737
diff changeset
3173 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3174
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3175 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3176 gtk_widget_show(gtkblist->vbox);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3177 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3178
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11692
diff changeset
3179 g_signal_connect_after(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
3180 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3181 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3182 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3183
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3184 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3185 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3186 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3187 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3188 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
3189 gtk_item_factory_set_translate_func(gtkblist->ift,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3190 item_factory_translate_func,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3191 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3192 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
3193 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3194 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3195 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3196 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3197 menu = gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>");
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3198 gtk_widget_show(menu);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3199 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
3200
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3201 gtkblist->bpmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounce"));
8844
76013c5ef153 [gaim-migrate @ 9611]
Luke Schierer <lschiere@pidgin.im>
parents: 8824
diff changeset
3202 protomenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Account Actions"));
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3203
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3204 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3205 sw = gtk_scrolled_window_new(NULL,NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3206 gtk_widget_show(sw);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3207 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
3208 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
3209
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3210 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3211 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN,
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3212 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
3213
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3214 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
3215 gtk_widget_show(gtkblist->treeview);
9176
7dc10a14c568 [gaim-migrate @ 9971]
Luke Schierer <lschiere@pidgin.im>
parents: 9113
diff changeset
3216 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3217
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3218 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3219 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3220 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
3221
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3222 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3223 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
3224 GDK_BUTTON1_MASK, ste, 3,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3225 GDK_ACTION_COPY);
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3226 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
3227 dte, 5,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3228 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3229
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
3230 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
3231 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
3232 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3233 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
3234 #endif
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3235
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3236 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
3237
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3238 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3239 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
3240 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
3241
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3242 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3243
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3244 gtkblist->text_column = column = gtk_tree_view_column_new ();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3245
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3246 rend = gtk_cell_renderer_pixbuf_new();
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3247 gtk_tree_view_column_pack_start(column, rend, FALSE);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3248 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3249 "pixbuf", STATUS_ICON_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3250 "visible", STATUS_ICON_VISIBLE_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3251 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3252 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3253
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3254 gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3255 gtk_tree_view_column_pack_start (column, rend, TRUE);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3256 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3257 "markup", NAME_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3258 NULL);
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3259 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
3260 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3261 #if GTK_CHECK_VERSION(2,6,0)
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3262 gtk_tree_view_column_set_expand (column, TRUE);
10501
4806967e093e [gaim-migrate @ 11793]
Sean Egan <seanegan@gmail.com>
parents: 10499
diff changeset
3263 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3264 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3265 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3266
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3267 rend = gtk_cell_renderer_text_new();
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3268 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
3269 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
3270 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
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 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3273 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
3274 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3275 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
3276
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3277 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
3278 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
3279 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
3280 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
3281 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
3282 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
3283
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3284 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3285 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
3286 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
3287
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3288 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3289 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3290 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3291
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3292 /* TODO: functionize this */
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3293 {
11768
a9e9b76905b4 [gaim-migrate @ 14059]
Gary Kramlich <grim@reaperworld.com>
parents: 11745
diff changeset
3294 #if 0
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3295 GList *accounts, *l;
11768
a9e9b76905b4 [gaim-migrate @ 14059]
Gary Kramlich <grim@reaperworld.com>
parents: 11745
diff changeset
3296 #endif
11732
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3297 /* Set up some per account status boxes */
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3298 gtkblist->statusboxbox = gtk_vbox_new(FALSE, 0);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3299 gtkblist->statusboxes = NULL;
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3300 #if 0
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3301 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
3302 GtkWidget *statusbox = gtk_gaim_status_box_new_with_account(l->data);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3303 gtkblist->statusboxes = g_list_append(gtkblist->statusboxes, statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3304 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
3305 gtk_widget_show(statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3306 }
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3307 g_list_free(accounts);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3308 #endif
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3309 gtk_widget_show(gtkblist->statusboxbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3310 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusboxbox, FALSE, TRUE, 0);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3311
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3312 gtkblist->statusbox = gtk_gaim_status_box_new();
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3313
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3314 gtk_widget_show(gtkblist->statusbox);
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3315 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
3316
03c813a42c76 [gaim-migrate @ 14023]
Tim Ringenbach <marv@pidgin.im>
parents: 11729
diff changeset
3317 }
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3318
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3319 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3320 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3321 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3322 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
3323 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3324 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
3325 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3326 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
3327 gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3328 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))),
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3329 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"));
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3330 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
3331 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
3332
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3333 /* Update some dynamic things */
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3334 update_menu_bar(gtkblist);
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3335 gaim_gtk_blist_update_plugin_actions();
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3336 gaim_gtk_blist_update_sort_methods();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3337
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3338 /* OK... let's show this bad boy. */
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11692
diff changeset
3339 if (gaim_prefs_get_bool("/gaim/gtk/blist/list_visible")) {
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3340 gaim_gtk_blist_refresh(list);
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3341 gaim_gtk_blist_restore_position();
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3342 gtk_widget_show(gtkblist->window);
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3343 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3344
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3345 /* start the refresh timer */
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3346 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
3347
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3348 handle = gaim_gtk_blist_get_handle();
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3349
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3350 /* things that affect how buddies are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3351 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3352 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3353 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_empty_groups",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3354 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3355 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_offline_buddies",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3356 _prefs_change_redo_list, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3357
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3358 /* sorting */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3359 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/sort_type",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3360 _prefs_change_sort_method, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3361
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3362 /* things that affect what columns are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3363 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3364 gaim_gtk_blist_update_columns, NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3365
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3366 /* menus */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3367 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/mute",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3368 gaim_gtk_blist_mute_pref_cb, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3369 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/method",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3370 gaim_gtk_blist_sound_method_pref_cb, NULL);
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3371
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3372 /* Setup some gaim signal handlers. */
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3373 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3374 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3375 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3376 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3377
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3378 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3379 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3380 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3381 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3382
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3383 /* emit our created signal */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3384 gaim_signal_emit(handle, "gtkblist-created", list);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3385 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3386
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3387 /* XXX: does this need fixing? */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3388 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3389 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3390 GaimBlistNode *gnode, *cnode, *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3391
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3392 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3393 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3394 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3395 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3396 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3397 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3398 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3399
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3400 for(bnode = cnode->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3401 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3402 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3403 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3404 gaim_gtk_blist_hide_node(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3405 gaim_gtk_blist_update(list, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3406 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3407
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3408 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3409 } else if(GAIM_BLIST_NODE_IS_CHAT(cnode)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3410 if(remove)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3411 gaim_gtk_blist_hide_node(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3412
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3413 gaim_gtk_blist_update(list, cnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3414 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3415 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3416 gaim_gtk_blist_update(list, gnode);
5228
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
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3420 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3421 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3422 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3423 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3424
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3425 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3426 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3427 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3428 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3429 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3430
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3431 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3432 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3433
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3434 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
3435 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3436
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3437 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3438 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
3439 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3440
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3441 if (!gtknode) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3442 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3443 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3444
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3445 if (!gtkblist) {
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3446 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
3447 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3448 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3449
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3450 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3451 return FALSE;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3452
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3453
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3454 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3455 return FALSE;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3456
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3457 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
3458 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3459 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3460 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3461 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3462 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3463 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3464
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3465 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3466 {
10222
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3467 gaim_request_close_with_handle(node);
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3468
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3469 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3470
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3471 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3472 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3473
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3474 /* There's something I don't understand here - Ethan */
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3475 /* 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
3476 * 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
3477 * 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
3478 * comment it out again. Stu */
10510
1044c0930e03 [gaim-migrate @ 11808]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
3479 /* 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
3480 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3481 /* I think it's fixed now. Stu. */
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3482 g_free(node->ui_data);
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3483 node->ui_data = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3484 }
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 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3487 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3488 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3489
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3490 /* 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
3491 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3492 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3493 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3494 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3495 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3496 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3497 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3498 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3499
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3500 return FALSE;
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
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3503 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3504 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3505 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3506 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3507
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3508 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3509 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3510 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3511 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
3512
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3513 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3514 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3515 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3516
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3517 static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3518 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3519 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3520 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3521 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3522
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3523 if(!iter)
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3524 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3525
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3526 if(node->parent && !get_iter_from_node(node->parent, &parent_iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3527 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3528
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3529 if(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3530 curptr = &cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3531
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3532 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
3533 *iter = current_sort_method->func(node, list, parent_iter, curptr);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3534 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3535 *iter = sort_method_none(node, list, parent_iter, curptr);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3536 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3537
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3538 if(gtknode != NULL) {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3539 gtk_tree_row_reference_free(gtknode->row);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3540 } else {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3541 gaim_gtk_blist_new_node(node);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3542 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3543 }
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3544
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3545 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3546 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3547 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3548 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3549 newpath);
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3550
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3551 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3552
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3553 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3554 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3555 -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3556
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3557 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3558 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3559 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3560
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3561 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3562 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3563 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
3564 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3565 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3566 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
3567 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3568 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
3569 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
3570 gtk_tree_path_free(expand);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3571 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3572 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3573
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3574 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3575 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3576
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3577 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3578 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3579 GaimGroup *group;
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3580 int count;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3581
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3582 g_return_if_fail(GAIM_BLIST_NODE_IS_GROUP(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3583
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3584 group = (GaimGroup*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3585
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3586 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3587 count = gaim_blist_get_group_size(group, FALSE);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3588 else
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3589 count = gaim_blist_get_group_online_count(group);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
3590 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
3591 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3592 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3593
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3594 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3595 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3596
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3597 esc = g_markup_escape_text(group->name, -1);
8945
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3598 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3599 esc, gaim_blist_get_group_online_count(group),
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
3600 gaim_blist_get_group_size(group, FALSE));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3601 g_free(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3602
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3603 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3604 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3605 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3606 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3607 NODE_COLUMN, node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3608 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3609 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3610 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3611 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3612 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3613 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3614
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3615 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3616 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3617 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3618 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3619 char *mark;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3620 char *idle = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3621 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3622
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3623 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3624
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3625 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3626 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3627 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3628
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
3629 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
3630 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3631
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3632 if (gaim_presence_is_idle(presence))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3633 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3634 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3635
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3636 if (idle_secs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3637 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3638 time_t t;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3639 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3640 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3641 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3642 imin = ((t - idle_secs) / 60) % 60;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3643
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3644 if (ihrs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3645 idle = g_strdup_printf("(%d:%02d)", ihrs, imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3646 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3647 idle = g_strdup_printf("(%d)", imin);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3648 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3649 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3650
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3651 if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3652 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3653 if (idle && !selected) {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3654 char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
3655 dim_grey(), idle);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3656 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3657 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3658 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3659 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3660
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3661 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3662 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3663 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3664 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3665 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3666 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3667 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3668
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3669 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3670 if(idle)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3671 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3672 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3673 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3674 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3675 g_object_unref(avatar);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3676 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3677
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3678 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3679 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3680 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3681 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3682 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3683
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3684 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3685
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3686 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3687 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3688
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3689 contact = (GaimContact*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3690 buddy = gaim_contact_get_priority_buddy(contact);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3691
11577
2898c59b49a3 [gaim-migrate @ 13846]
Nathan Walp <nwalp@pidgin.im>
parents: 11556
diff changeset
3692 if (buddy && gaim_account_is_connected(buddy->account) &&
2898c59b49a3 [gaim-migrate @ 13846]
Nathan Walp <nwalp@pidgin.im>
parents: 11556
diff changeset
3693 (gaim_presence_is_online(buddy->presence) ||
11434
f191b5bc199b [gaim-migrate @ 13671]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11338
diff changeset
3694 buddy->present == GAIM_BUDDY_SIGNING_OFF ||
11577
2898c59b49a3 [gaim-migrate @ 13846]
Nathan Walp <nwalp@pidgin.im>
parents: 11556
diff changeset
3695 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") ||
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3696 gaim_blist_node_get_bool(node, "show_offline")))
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3697 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3698 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3699
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3700 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3701 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3702
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3703 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
3704
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3705 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3706 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3707 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3708
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3709 status = gaim_gtk_blist_get_status_icon(node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3710 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3711 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3712
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3713 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3714
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3715 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3716 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3717 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3718 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3719 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3720 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3721 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3722 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3723 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3724 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3725 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3726 buddy_node(buddy, &iter, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3727 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3728 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3729 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3730 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3731 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3732
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3733 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3734 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3735 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3736 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3737 struct _gaim_gtk_blist_node *gtkparentnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3738
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3739 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3740
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3741 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3742 contact = (GaimContact*)node->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3743
11624
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
3744 if (contact == NULL)
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
3745 return;
45d54425dc65 [gaim-migrate @ 13899]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11577
diff changeset
3746
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3747 /* First things first, update the contact */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3748 gaim_gtk_blist_update_contact(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3749
10918
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
3750 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
3751
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3752 if (gtkparentnode->contact_expanded &&
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3753 (gaim_presence_is_online(buddy->presence) ||
11434
f191b5bc199b [gaim-migrate @ 13671]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11338
diff changeset
3754 buddy->present == GAIM_BUDDY_SIGNING_OFF ||
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3755 (gaim_account_is_connected(buddy->account) &&
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3756 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies")) ||
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3757 gaim_blist_node_get_bool(node->parent, "show_offline")))
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3758 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3759 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3760
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3761 if (!insert_node(list, node, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3762 return;
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3763
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3764 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3765
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3766 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3767 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3768 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3769
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3770 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3771
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3772 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3773 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3774 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3775
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3776 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3777
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3778 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3779 gaim_gtk_blist_update_group(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3780
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3781 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3782
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3783 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3784 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3785 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3786 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3787
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3788 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
3789 return;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3790
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3791 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3792 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3793 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
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 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
3796
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3797 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3798 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3799 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3800 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3801 -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3802
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3803 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3804 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3805 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3806 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3807 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3808 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3809 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3810
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3811 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3812 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3813 if(!gtkblist)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3814 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3815
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3816 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3817 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3818 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3819 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3820 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3821 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3822 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3823 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3824 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3825 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3826 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3827 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3828 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3829 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3830 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3831 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3832
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3833 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3834 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3835
7620
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 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3838 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3839 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3840 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3841
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3842 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3843 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3844 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3845 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3846
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3847 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3848
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
3849 gaim_gtk_blist_tooltip_destroy();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3850
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3851 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3852 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3853 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3854 g_source_remove(gtkblist->timeout);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3855 if (gtkblist->drag_timeout)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3856 g_source_remove(gtkblist->drag_timeout);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3857
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3858 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3859 gtkblist->timeout = 0;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3860 gtkblist->drag_timeout = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3861 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3862 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3863 gtkblist->idle_column = NULL;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3864 gtkblist->buddy_icon_column = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3865 g_object_unref(G_OBJECT(gtkblist->ift));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3866 protomenu = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3867 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3868
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3869 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle());
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3870 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3871
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3872 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3873 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3874 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3875 return;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
3876
10282
778dd5d6d55e [gaim-migrate @ 11451]
Sean Egan <seanegan@gmail.com>
parents: 10273
diff changeset
3877 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", show);
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
3878
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3879 if (show) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3880 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3881 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3882 } else {
11709
cae2fb7e8594 [gaim-migrate @ 14000]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11692
diff changeset
3883 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3884 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3885 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3886
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3887 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3888 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3889 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3890 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3891 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3892 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3893 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3894
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3895 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3896 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3897 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3898 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3899 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3900 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3901 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3902 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3903 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3904 gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3905 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3906 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3907 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3908 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3909 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3910 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3911 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3912 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3913 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3914
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3915 return tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3916 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3917
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3918 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3919 add_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3920 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3921 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3922 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3923 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3924 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3925
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3926 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3927 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
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 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3930 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3931
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3932 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3933 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3934 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3935 const char *grp, *who, *whoalias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3936 GaimConversation *c;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3937 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3938 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3939
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3940 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3941 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3942 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3943 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
3944 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
3945 if (*whoalias == '\0')
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
3946 whoalias = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3947
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3948 if ((g = gaim_find_group(grp)) == NULL)
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 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3951 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3952 }
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 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3955 gaim_blist_add_buddy(b, NULL, g, NULL);
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3956 gaim_account_add_buddy(data->account, b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3957
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3958 /*
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3959 * XXX
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3960 * 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
3961 * gaim_account_add_buddy() and gaim_conversation_update() were done in
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3962 * blist.c, possibly in the gaim_blist_add_buddy() function. Maybe
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3963 * gaim_account_add_buddy() should be renamed to
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3964 * 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
3965 * gaim_blist_add_buddy() after it creates it. --Mark
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3966 *
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
3967 * 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
3968 * 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
3969 * gaim_account_add_buddy and gaim_blist_add_buddy().
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
3970 * Or something. --Mark
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3971 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
3972
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11258
diff changeset
3973 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
3974 if (c != NULL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3975 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
3976 gaim_conversation_update(c, GAIM_CONV_UPDATE_ADD);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3977 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3978 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3979
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3980 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3981 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3982
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3983 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3984 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3985 const char *group, const char *alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3986 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3987 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3988 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3989 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3990 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3991 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3992 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3993 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3994
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3995 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3996 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3997 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3998 : gaim_connection_get_account(gaim_connections_get_all()->data));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3999
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4000 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4001 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4003 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
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 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4006 NULL, GTK_DIALOG_NO_SEPARATOR,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4007 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4008 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4009 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4010
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4011 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
4012 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
4013 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4014 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
4015 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
4016 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4017 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4018 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4019
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4020 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4021 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4022 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4023 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4024
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4025 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4026 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4027
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4028 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4029 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4030 "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
4031 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4032 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4033
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4034 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4035 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4036 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4037 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4038
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4039 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4040 gtk_container_add(GTK_CONTAINER(vbox), hbox);
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_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4043 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4044
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4045 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4046 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4047 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4050
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4051 label = gtk_label_new(_("Screen Name:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4053 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
4054
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4055 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4056 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
4057 gtk_widget_grab_focus(data->entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4058
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4059 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4060 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4061
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4062 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4063 gaim_set_accessible_label (data->entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4065 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4066 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4067 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
4068
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4069 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4070 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4071 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4072
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4073 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4074 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4075
10734
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4076 if (username != NULL)
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4077 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4078
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4079 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
4080 gaim_set_accessible_label (data->entry_for_alias, label);
7620
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 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4083 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4084 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
4085
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4086 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4087 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4088 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
4089 gaim_set_accessible_label (data->combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4090
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4091 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4092 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4094 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
4095
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4097 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4098
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4099 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
4100 gaim_set_accessible_label (data->account_box, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4101 /* End of account box */
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 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4104 G_CALLBACK(add_buddy_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4105
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4106 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4107
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4108 if (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4109 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
4110 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4111
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4112 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4113 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4114 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4115 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4116 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4117 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4118 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4119 const char *group_name;
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4120 char *chat_name = NULL;
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4121 GaimConversation *conv = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4122 const char *value;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4123
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4124 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
4125 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4126
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4127 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4128 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4129 if (g_object_get_data(tmp->data, "is_spin"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4130 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4131 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4132 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4133 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4134 gtk_spin_button_get_value_as_int(tmp->data)));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4135 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4136 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4137 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4138 value = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4139 if (*value != '\0')
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4140 g_hash_table_replace(components,
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4141 g_strdup(g_object_get_data(tmp->data, "identifier")),
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4142 g_strdup(value));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4143 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4144 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4145
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4146 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4147 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4148 components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4149
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4150 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
4151
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4152 if ((group = gaim_find_group(group_name)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4153 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4154 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4155 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4156 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4157
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158 if (chat != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160 gaim_blist_add_chat(chat, group, NULL);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4161
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4162 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
4163 chat_name = GAIM_PLUGIN_PROTOCOL_INFO(
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4164 data->account->gc->prpl)->get_chat_name(chat->components);
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4165
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4166 if (chat_name != NULL) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11258
diff changeset
4167 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
10246
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4168 chat_name,
a66cf83552dc [gaim-migrate @ 11386]
Mark Doliner <mark@kingant.net>
parents: 10240
diff changeset
4169 data->account);
9918
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4170 g_free(chat_name);
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4171 }
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4172
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4173 if (conv != NULL)
c203312d8224 [gaim-migrate @ 10810]
Luke Schierer <lschiere@pidgin.im>
parents: 9917
diff changeset
4174 gaim_conversation_update(conv, GAIM_CONV_UPDATE_ADD);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 }
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 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4178 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4179 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4180 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4181 }
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 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4184 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
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 if (resp == GTK_RESPONSE_OK)
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 add_chat_cb(NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4189 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4190 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4191 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4192 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4193 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4194 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4195 g_free(data);
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 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4198
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4199 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4200 * 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
4201 * 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
4202 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4203 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4204 addchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4205 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4206 GaimGtkAddChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4207 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4208 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4209 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4210 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4211
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4212 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4213
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4214 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4215 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4216 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4217 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4218 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4219 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4220 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4221 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4222 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4223 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4224
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4225 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
4226 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4227
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4228 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4229 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4230 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4231 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4232 GList *list = NULL, *tmp = NULL;
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4233 GHashTable *defaults = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4234 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4235 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4236
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4237 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4238
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4239 gc = gaim_account_get_connection(data->account);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4240
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4241 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4242 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4243 gtk_container_remove(GTK_CONTAINER(data->entries_box),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4244 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4245 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4246
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4247 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4248 g_list_free(data->entries);
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 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4251
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4252 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4253 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4254
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4255 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
4256 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
4257
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4258 for (tmp = list; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4259 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4260 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4261 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4262 GtkWidget *input;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4263
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4264 pce = tmp->data;
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 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4267 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
4268
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
4269 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4270 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4272 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
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 if (pce->is_int)
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 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4277 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4279 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4280 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4281 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
4282 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4283 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4284 {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4285 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4286 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4287 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4288 value = g_hash_table_lookup(defaults, pce->identifier);
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4289 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4290 gtk_entry_set_text(GTK_ENTRY(input), value);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4291 if (pce->secret)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4292 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4293 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4294 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4295 G_CALLBACK(addchat_set_sensitive_if_input_cb), data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4296 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4297
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4298 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4299 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4300 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4301 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4302 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4303 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4304 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4305 gaim_set_accessible_label(input, label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4306 g_object_set_data(G_OBJECT(input), "identifier", pce->identifier);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4307 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
4308 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
4309 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4310
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4311 g_free(pce);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4314 g_list_free(list);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4315 g_hash_table_destroy(defaults);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4316
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4317 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4318 addchat_set_sensitive_if_input_cb(NULL, data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4319
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4320 gtk_widget_show_all(data->entries_box);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4323 static void
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4324 addchat_select_account_cb(GObject *w, GaimAccount *account,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4325 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4326 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4327 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4328 gaim_account_get_protocol_id(account)) == 0)
7620
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 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4331 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4332 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4333 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4334 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4335 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4336 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4337 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4338
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4339 void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4340 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4341 const char *alias, const char *name)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4342 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4343 GaimGtkAddChatData *data;
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4344 GaimGtkBuddyList *gtkblist;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4345 GList *l;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4346 GaimConnection *gc;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4347 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4348 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4349 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4350 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4351 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4352
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4353 if (account != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4354 gc = gaim_account_get_connection(account);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4355
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4356 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4357 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
4358 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4359 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4360 } else {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4361 /* Find an account with chat capabilities */
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4362 for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4363 gc = (GaimConnection *)l->data;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4364
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4365 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4366 account = gaim_connection_get_account(gc);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4367 break;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4368 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4369 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4370
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4371 if (account == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4372 gaim_notify_error(NULL, NULL,
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4373 _("You are not currently signed on with any "
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4374 "protocols that have the ability to chat."), NULL);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4375 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4376 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4377 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4378
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4379 data = g_new0(GaimGtkAddChatData, 1);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4380 data->account = account;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4381 data->default_chat_name = g_strdup(name);
7620
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 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4384 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4385
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4386 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4387
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4388 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4389
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4390 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4391 NULL, GTK_DIALOG_NO_SEPARATOR,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4392 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4393 GTK_STOCK_ADD, GTK_RESPONSE_OK,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4394 NULL);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4395
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4396 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
4397 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
4398 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4399 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
4400 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
4401 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4402 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4403 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4404
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4405 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4406 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4407 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4408 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4409
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4410 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4411 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4412
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4413 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4414 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4415 "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
4416 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4417 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4418 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4419 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4420
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4421 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4422 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4423
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4424 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4425 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4426 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4427 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
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 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
4430 G_CALLBACK(addchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
4431 chat_account_filter_func, data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4432 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
4433 gaim_set_accessible_label (data->account_menu, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4434
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4435 data->entries_box = gtk_vbox_new(FALSE, 5);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4436 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
4437 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
4438
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4439 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4440
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4441 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4442 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4443
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4444 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4445 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4446 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4447 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4448
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4449 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4450 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4451 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4452 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
4453 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
4454 gaim_set_accessible_label (data->alias_entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4455
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4456 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4457 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4458
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4459 label = gtk_label_new(_("Group:"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4460 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4461 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4462 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4463
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4464 data->group_combo = gtk_combo_new();
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4465 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
4466 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
4467
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4468 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4469 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4470 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
4471 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4472 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4473 gaim_set_accessible_label (data->group_combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4474
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4475 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4476 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4477
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4478 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4479 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4480
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4481 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4482 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4483 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4484 GaimGroup *group;
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4485
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4486 group = gaim_group_new(group_name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4487 gaim_blist_add_group(group, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4488 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4489
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4490 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4491 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4492 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
4493 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4494 _("Please enter the name of the group to be added."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
4495 NULL, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4496 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4497 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4498 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4499
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4500 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4501 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4502 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4503 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4504 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4505 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4506 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4507 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4508 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4509 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4510 gaim_gtk_blist_request_add_chat,
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
4511 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4512 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4513
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4514
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4515 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4516 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4517 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4518 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4519 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4520
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4521 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist()
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4522 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4523 return gtkblist;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4524 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
4525
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4526 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4527 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4528 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4529 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4530 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4531 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4532 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4533 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4534 for(cnode = gnode->child; cnode; cnode = cnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4535 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4536 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4537
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4538 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4539 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4540
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4541 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4542
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4543 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4544 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4545
8197
7c45eb829340 [gaim-migrate @ 8919]
Nathan Walp <nwalp@pidgin.im>
parents: 8143
diff changeset
4546 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
8198
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4547 (gaim_blist_node_get_string((GaimBlistNode*)chat,
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
4548 "gtk-autojoin") != NULL))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4549 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4550 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4551 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4552 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4553
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4554 void *
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4555 gaim_gtk_blist_get_handle() {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4556 static int handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4557
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4558 return &handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4559 }
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4560
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4561 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4562 {
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4563 void *gtk_blist_handle = gaim_gtk_blist_get_handle();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4564
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4565 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4566 gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4567 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4568
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4569 /* Initialize prefs */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4570 gaim_prefs_add_none("/gaim/gtk/blist");
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4571 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4572 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4573 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
4574 gaim_prefs_add_bool("/gaim/gtk/blist/list_visible", TRUE);
9711
b0ddfeccb9e6 [gaim-migrate @ 10572]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
4575 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "alphabetical");
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4576 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4577 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
9778
3d40125495e3 [gaim-migrate @ 10646]
Mark Doliner <mark@kingant.net>
parents: 9775
diff changeset
4578 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
4579 gaim_prefs_add_int("/gaim/gtk/blist/height", 500); /* Golden ratio, baby */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4580 gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
4581
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4582 /* Register our signals */
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4583 gaim_signal_register(gtk_blist_handle, "gtkblist-created",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4584 gaim_marshal_VOID__POINTER, NULL, 1,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4585 gaim_value_new(GAIM_TYPE_SUBTYPE,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4586 GAIM_SUBTYPE_BLIST));
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4587
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
4588 gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4589 gaim_marshal_VOID__POINTER_POINTER, NULL, 2,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4590 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_NODE),
10477
5cb55bcad11b [gaim-migrate @ 11764]
Mark Doliner <mark@kingant.net>
parents: 10476
diff changeset
4591 gaim_value_new_outgoing(GAIM_TYPE_BOXED, "GString *"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4592 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4593
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4594 void
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4595 gaim_gtk_blist_uninit(void) {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4596 gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
4597 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4598
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4599 /*********************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4600 * Public utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4601 *********************************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4602
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4603 GdkPixbuf *
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10860
diff changeset
4604 gaim_gtk_create_prpl_icon(GaimAccount *account)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4605 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4606 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4607 GaimPluginProtocolInfo *prpl_info = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4608 GdkPixbuf *status = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4609 char *filename = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4610 const char *protoname = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4611 char buf[256];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4612
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
4613 g_return_val_if_fail(account != NULL, NULL);
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
4614
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
4615 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4616
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4617 if (prpl != NULL) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4618 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4619
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4620 if (prpl_info->list_icon != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4621 protoname = prpl_info->list_icon(account, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4622 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4623
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4624 if (protoname == NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4625 return NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4626
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4627 /*
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4628 * Status icons will be themeable too, and then it will look up
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4629 * protoname from the theme
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4630 */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4631 g_snprintf(buf, sizeof(buf), "%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4632
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4633 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status",
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4634 "default", buf, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4635 status = gdk_pixbuf_new_from_file(filename, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4636 g_free(filename);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4637
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4638 return status;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4639 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4640
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4641
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4642 /*********************************************************************
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4643 * Buddy List sorting functions *
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4644 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4645
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4646 GList *gaim_gtk_blist_get_sort_methods()
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4647 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4648 return gaim_gtk_blist_sort_methods;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4649 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4650
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4651 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
4652 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4653 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
4654 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4655 method->name = g_strdup(name);
9775
4c1a1be8ce33 [gaim-migrate @ 10643]
Mark Doliner <mark@kingant.net>
parents: 9774
diff changeset
4656 method->func = func;
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4657 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
4658 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4659 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4660
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4661 void gaim_gtk_blist_sort_method_unreg(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4662 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4663
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4664 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4665 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4666 if(!strcmp(method->id, id)) {
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4667 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
4668 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4669 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4670 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4671 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4672 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4673 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4674 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4675 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4676
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4677 void gaim_gtk_blist_sort_method_set(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
4678 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4679
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4680 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4681 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4682
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4683 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
4684 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4685
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4686 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4687 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4688 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4689 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4690 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4691 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4692 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4693
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4694 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4695
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4696 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4697 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4698 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4699
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4700 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
4701 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4702 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4703 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4704 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4705
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4706 if(cur)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4707 return *cur;
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 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4710 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4711 }
7620
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 gtk_tree_store_insert_after(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4714 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4715 sibling ? &sibling_iter : NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4716
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4717 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4718 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4719
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4720 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4721
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4722 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
4723 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4724 GtkTreeIter more_z, iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4725 GaimBlistNode *n;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4726 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4727
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4728 const char *my_name;
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 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4731 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4732 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4733 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4734 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4735 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4736 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4737
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4738
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4739 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
4740 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4741 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4742 }
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 do {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4745 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4746 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4747
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4748 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
4749 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4750
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4751 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4752 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4753 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4754 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4755 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4756 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4757 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4758
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4759 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4760
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4761 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4762 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4763 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4764 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4765 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4766 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4767 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4768 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4769 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4770 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4771 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4772 } 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
4773
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4774 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4775 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4776 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4777 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4778 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4779 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4780 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4781 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4782
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4783 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
4784 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4785 GtkTreeIter more_z, iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4786 GaimBlistNode *n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4787 GValue val = {0,};
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4788
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4789 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4790
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4791 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4792 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4793 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4794 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4795 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4796
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4797 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4798 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4799 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4800 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4801 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4802
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4803
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4804 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
4805 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4806 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4807 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4808
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4809 do {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4810 gint name_cmp;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4811 gint presence_cmp;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4812
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4813 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
4814 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4815
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4816 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4817 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4818 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4819 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4820 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4821
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4822 name_cmp = gaim_utf8_strcasecmp(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4823 (my_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4824 ? gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4825 : NULL),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4826 (this_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4827 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4828 : NULL));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4829
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4830 presence_cmp = gaim_presence_compare(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4831 gaim_buddy_get_presence(my_buddy),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4832 gaim_buddy_get_presence(this_buddy));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4833
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4834 if (this_buddy == NULL ||
10860
d01d81de94d8 [gaim-migrate @ 12543]
Mark Doliner <mark@kingant.net>
parents: 10850
diff changeset
4835 (presence_cmp < 0 ||
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4836 (presence_cmp == 0 &&
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4837 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4838 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4839 if (cur != NULL)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4840 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4841 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4842 return *cur;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4843 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4844 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4845 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4846 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4847 &groupiter, &more_z);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4848 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4849 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4850 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4851
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4852 g_value_unset(&val);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4853 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4854 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4855 &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4856
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4857 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4858 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4859 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4860 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4861 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4862 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4863 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4864 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4865
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4866 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
4867 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4868 GtkTreeIter more_z, iter;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4869 GaimBlistNode *n = NULL, *n2;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4870 GValue val = {0,};
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4871
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4872 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4873 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4874
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4875 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
4876 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4877
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4878 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4879 for (n = node->child; n; n = n->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
4880 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
4881 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4882 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4883 /* 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
4884 * from the chat info in the blist, yet */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4885 if(cur)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4886 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4887
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4888 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4889 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4890 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4891 return sort_method_none(node, blist, groupiter, cur);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4892 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4893
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4894
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4895 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
4896 gtk_tree_store_insert(gtkblist->treemodel, &iter, &groupiter, 0);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4897 return iter;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4898 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4899
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4900 do {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4901 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4902
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4903 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
4904 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4905 this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4906
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4907 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4908 for (n2 = n->child; n2; n2 = n2->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
4909 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
4910 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4911 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4912 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4913 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4914
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4915 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4916
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4917 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
4918 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4919 (cmp < 0 || (cmp == 0 && node < n)))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4920 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4921 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4922 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4923 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4924 gtk_tree_store_insert_before(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4925 &groupiter, &more_z);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4926 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4927 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4928 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4929 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4930 } 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
4931
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4932 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4933 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4934 return *cur;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4935 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4936 gtk_tree_store_append(gtkblist->treemodel, &iter, &groupiter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4937 return iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4938 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4939 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4940
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4941 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4942
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4943 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4944 plugin_act(GtkObject *obk, GaimPluginAction *pam)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4945 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
4946 if (pam->callback)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
4947 pam->callback(pam);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
4948 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4949
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
4950 static GList *plugin_menu_items = NULL;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
4951 static int plugin_menu_index = 8;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
4952
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4953 static void
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4954 build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin, gpointer context)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4955 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4956 GtkWidget *menuitem = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4957 GaimPluginAction *action = NULL;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4958 GList *l, *ll;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4959
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4960 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
4961 if (l->data) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4962 action = (GaimPluginAction *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4963 action->plugin = plugin;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4964 action->context = context;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4965
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4966 menuitem = gtk_menu_item_new_with_label(action->label);
11745
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4967 if (context) {
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4968 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4969 } else {
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4970 plugin_menu_items = g_list_append(plugin_menu_items, menuitem);
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4971 plugin_menu_index++;
dd7e9ef6339f [gaim-migrate @ 14036]
Sean Egan <seanegan@gmail.com>
parents: 11742
diff changeset
4972 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
4973 }
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4974 g_signal_connect(G_OBJECT(menuitem), "activate",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4975 G_CALLBACK(plugin_act), action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4976 g_object_set_data(G_OBJECT(menuitem), "plugin_action", action);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4977 gtk_widget_show(menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4978 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4979 else
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4980 gaim_separator(menu);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4981 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4982
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4983 g_list_free(ll);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4984 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4985
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
4986
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4987 void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4988 gaim_gtk_blist_update_protocol_actions(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4989 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4990 GtkWidget *menuitem, *submenu;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4991 GList *l;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4992 GaimConnection *gc = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4993 GaimPlugin *plugin = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4994 int count = 0;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
4995
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4996 if (protomenu == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4997 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4998
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
4999 /* Clear the old Account Actions menu */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5000 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
5001 GaimPluginAction *action;
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
5002
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5003 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5004 action = (GaimPluginAction *) g_object_get_data(G_OBJECT(menuitem),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5005 "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5006 g_free(action);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5007
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5008 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5009 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5010
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5011 /* Count the number of accounts with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5012 for (l = gaim_connections_get_all(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5013 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5014 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5015
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5016 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5017 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5018
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5019 /* no need to count past 2, so don't */
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5020 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5021 break;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5022 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5023
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5024 if (count == 0) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5025 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5026 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5027 gtk_widget_set_sensitive(menuitem, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5028 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5029 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5030
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5031 else if (count == 1) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5032 /* Find the one account that has actions */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5033 for (l = gaim_connections_get_all(); l; l = l->next) {
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5034 gc = l->data;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5035 plugin = gc->prpl;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5036
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5037 if (GAIM_CONNECTION_IS_CONNECTED(gc) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5038 break;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5039 }
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5040
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5041 build_plugin_actions(protomenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5042 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5043
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5044 else {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5045 for (l = gaim_connections_get_all(); l; l = l->next) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5046 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5047 GdkPixbuf *pixbuf, *scale;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5048 GtkWidget *image;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5049 char *buf;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5050
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5051 gc = l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5052 plugin = gc->prpl;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5053
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5054 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
5055 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5056
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5057 account = gaim_connection_get_account(gc);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5058 buf = g_strconcat(gaim_account_get_username(account), " (",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5059 plugin->info->name, ")", NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5060 menuitem = gtk_image_menu_item_new_with_label(buf);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5061 g_free(buf);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5062
10884
5cda52915a1f [gaim-migrate @ 12582]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10860
diff changeset
5063 pixbuf = gaim_gtk_create_prpl_icon(account);
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5064 if (pixbuf) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5065 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5066 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5067 image = gtk_image_new_from_pixbuf(scale);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5068 g_object_unref(G_OBJECT(pixbuf));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5069 g_object_unref(G_OBJECT(scale));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5070 gtk_widget_show(image);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5071 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
5072 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5073
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5074 gtk_menu_shell_append(GTK_MENU_SHELL(protomenu), menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5075 gtk_widget_show(menuitem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5076
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5077 submenu = gtk_menu_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5078 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5079 gtk_widget_show(submenu);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5080
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5081 build_plugin_actions(submenu, plugin, gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5082 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5083 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5084 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5085
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5086 void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5087 gaim_gtk_blist_update_plugin_actions(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5088 {
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5089 GtkWidget *menuitem;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5090 GaimPlugin *plugin = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5091 GList *l;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5092 int count = 0;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5093
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5094 GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools"));
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5095
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5096 if (pluginmenu == NULL)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5097 return;
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5098
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5099 /* Clear the old Account Actions menu */
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5100 for (l = plugin_menu_items; l; l = l->next) {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5101 GaimPluginAction *action;
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5102 plugin_menu_index--;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5103 menuitem = l->data;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5104 action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5105 g_free(action);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5106
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5107 gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(menuitem));
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5108 }
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5109 g_list_free(plugin_menu_items);
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5110 plugin_menu_items = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5111
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5112 /* Count the number of plugins with actions */
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5113 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5114 plugin = (GaimPlugin *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5115
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5116 if (!GAIM_IS_PROTOCOL_PLUGIN(plugin) && GAIM_PLUGIN_HAS_ACTIONS(plugin))
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5117 count++;
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5118
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5119 /* no need to count past 2, so don't */
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5120 if (count > 1)
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5121 break;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5122 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5123
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5124 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5125
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5126 plugin = (GaimPlugin *) l->data;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5127
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5128 if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5129 continue;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5130
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5131 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5132 continue;
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5133
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5134 build_plugin_actions(pluginmenu, plugin, NULL);
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5135
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5136 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5137 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5138
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5139 void sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5140 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5141 if (gtk_check_menu_item_get_active(checkmenuitem))
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5142 gaim_gtk_blist_sort_method_set(id);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5143 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5144
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5145 void
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5146 gaim_gtk_blist_update_sort_methods(void)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5147 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5148 GtkWidget *menuitem = NULL, *activeitem = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5149 GaimGtkBlistSortMethod *method = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5150 GList *l;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5151 GSList *sl = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5152 GtkWidget *sortmenu;
11797
e6bbf34b2465 [gaim-migrate @ 14088]
Nathan Walp <nwalp@pidgin.im>
parents: 11796
diff changeset
5153 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
5154
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5155 if (gtkblist == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5156 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5157
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
5158 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
5159
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5160 if (sortmenu == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5161 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5162
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5163 /* Clear the old menu */
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5164 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
5165 menuitem = l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5166 gtk_widget_destroy(GTK_WIDGET(menuitem));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5167 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5168
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5169 for (l = gaim_gtk_blist_sort_methods; l; l = l->next) {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5170 method = (GaimGtkBlistSortMethod *) l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5171 menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5172 if (!strcmp(m, method->id))
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5173 activeitem = menuitem;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5174 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
5175 gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5176 g_signal_connect(G_OBJECT(menuitem), "toggled",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5177 G_CALLBACK(sortmethod_act), method->id);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5178 gtk_widget_show(menuitem);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5179 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5180 if (activeitem)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5181 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
5182
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5183 }