annotate src/gtkblist.c @ 13971:df8183b7fa2c

[gaim-migrate @ 16529] Make multi-column trees look nice. Show the list of users in a chat-room after you join. Add some commands (eg. /me, /help etc., all Xeroxed from gtkconv.c) committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 20 Jul 2006 17:38:09 +0000
parents 6fc412e59214
children 8bda65b88e49
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
2 * @file gtkblist.c GTK+ BuddyList API
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
3 * @ingroup gtkui
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
4 *
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8040
diff changeset
9 * source distribution.
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 */
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9778
diff changeset
26 #include "internal.h"
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 9778
diff changeset
27 #include "gtkgaim.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
28
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
29 #include "account.h"
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
30 #include "connection.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
31 #include "core.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
32 #include "debug.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
33 #include "notify.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
34 #include "prpl.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
35 #include "prefs.h"
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
36 #include "plugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
37 #include "request.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
38 #include "signals.h"
10297
ec140184437b [gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents: 10288
diff changeset
39 #include "gtkstock.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
40 #include "util.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
41
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
42 #include "gtkaccount.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
43 #include "gtkblist.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
44 #include "gtkconv.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
45 #include "gtkdebug.h"
9709
4d05b6e9e9cd [gaim-migrate @ 10570]
Mark Doliner <mark@kingant.net>
parents: 9686
diff changeset
46 #include "gtkdialogs.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
47 #include "gtkft.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
48 #include "gtklog.h"
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
49 #include "gtkmenutray.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
50 #include "gtkpounce.h"
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 11732
diff changeset
51 #include "gtkplugin.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
52 #include "gtkprefs.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
53 #include "gtkprivacy.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8089
diff changeset
54 #include "gtkroomlist.h"
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
55 #include "gtkstatusbox.h"
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
56 #include "gtkutils.h"
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
57
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 #include <gdk/gdkkeysyms.h>
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 #include <gtk/gtk.h>
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
60 #include <gdk/gdk.h>
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
61
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
62 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
63 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
64 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
65
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
66 GtkWidget *window;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
67 GtkWidget *combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
68 GtkWidget *entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
69 GtkWidget *entry_for_alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
70 GtkWidget *account_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
71
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
72 } GaimGtkAddBuddyData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
73
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
74 typedef struct
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
75 {
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
76 GaimAccount *account;
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
77 gchar *default_chat_name;
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
78
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
79 GtkWidget *window;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
80 GtkWidget *account_menu;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
81 GtkWidget *alias_entry;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
82 GtkWidget *group_combo;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
83 GtkWidget *entries_box;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
84 GtkSizeGroup *sg;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
85
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
86 GList *entries;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
87
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
88 } GaimGtkAddChatData;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
89
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
90 typedef struct
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
91 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
92 GaimAccount *account;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
93
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
94 GtkWidget *window;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
95 GtkWidget *account_menu;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
96 GtkWidget *entries_box;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
97 GtkSizeGroup *sg;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
98
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
99 GList *entries;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
100 } GaimGtkJoinChatData;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
101
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
102
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
103 static GtkWidget *accountmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
105 static guint visibility_manager_count = 0;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
106 static gboolean gtk_blist_obscured = FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
107
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
108 static GList *gaim_gtk_blist_sort_methods = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
109 static struct gaim_gtk_blist_sort_method *current_sort_method = NULL;
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
110 static void sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
111
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
112 /* The functions we use for sorting aren't available in gtk 2.0.x, and
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
113 * segfault in 2.2.0. 2.2.1 is known to work, so I'll require that */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
114 #if GTK_CHECK_VERSION(2,2,1)
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
115 static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
116 static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
117 static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
118 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
119 static GaimGtkBuddyList *gtkblist = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
121 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
122 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 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
124 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node);
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
125 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node);
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
126 static char *gaim_get_tooltip_text(GaimBlistNode *node, gboolean full);
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
127 static const 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
128 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
129 static void redo_buddy_list(GaimBuddyList *list, gboolean remove);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
130 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
131
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
132 static void gaim_gtk_blist_tooltip_destroy(void);
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
133
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
134 struct _gaim_gtk_blist_node {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
135 GtkTreeRowReference *row;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
136 gboolean contact_expanded;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
137 gboolean recent_signonoff;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
138 gint recent_signonoff_timer;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
139 };
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
140
10968
e0d5038fbb7e [gaim-migrate @ 12789]
Christopher O'Brien <siege@pidgin.im>
parents: 10924
diff changeset
141
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
142 static char dim_grey_string[8] = "";
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
143 static char *dim_grey()
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
144 {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
145 if (!gtkblist)
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
146 return "dim grey";
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
147 if (!dim_grey_string[0]) {
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
148 GtkStyle *style = gtk_widget_get_style(gtkblist->treeview);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
149 snprintf(dim_grey_string, sizeof(dim_grey_string), "#%02x%02x%02x",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
150 style->text_aa[GTK_STATE_NORMAL].red >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
151 style->text_aa[GTK_STATE_NORMAL].green >> 8,
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
152 style->text_aa[GTK_STATE_NORMAL].blue >> 8);
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
153 }
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
154 return dim_grey_string;
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
155 }
10144
757a7c088801 [gaim-migrate @ 11216]
Mark Doliner <mark@kingant.net>
parents: 10129
diff changeset
156
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 * Callbacks *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 ***************************************************/
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
160 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
161 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
162 if (event->state == GDK_VISIBILITY_FULLY_OBSCURED)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
163 gtk_blist_obscured = TRUE;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
164 else if (gtk_blist_obscured) {
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
165 gtk_blist_obscured = FALSE;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
166 gaim_gtk_blist_refresh_timer(gaim_get_blist());
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
167 }
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
168
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
169 /* continue to handle event normally */
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
170 return FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
171 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
172
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
173 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
174 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
175 if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
176 if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
177 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", FALSE);
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
178 else {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
179 gaim_prefs_set_bool("/gaim/gtk/blist/list_visible", TRUE);
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
180 gaim_gtk_blist_refresh_timer(gaim_get_blist());
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
181 }
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
182 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
183
12279
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
184 if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
185 if(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
186 gaim_prefs_set_bool("/gaim/gtk/blist/list_maximized", TRUE);
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
187 else
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
188 gaim_prefs_set_bool("/gaim/gtk/blist/list_maximized", FALSE);
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
189 }
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
190
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
191 /* Refresh gtkblist if un-iconifying */
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
192 if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
193 if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
194 gaim_gtk_blist_refresh_timer(gaim_get_blist());
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
195 }
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
196
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
197 return FALSE;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
198 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
202 if(visibility_manager_count)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
203 gaim_blist_set_visible(FALSE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
204 else
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
205 gaim_core_quit();
5228
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 /* we handle everything, event should not propogate further */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 /* unfortunately GdkEventConfigure ignores the window gravity, but *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 * 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
215 * call get_position because it does pay attention to the gravity. *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
216 * 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
217 * to work correctly. - Robot101 */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 gint x, y;
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 /* check for visibility because when we aren't visible, this will *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 * give us bogus (0,0) coordinates. - xOr */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
222 if (GTK_WIDGET_VISIBLE(w))
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
224 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
225 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
226
13766
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
227 #ifdef _WIN32
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
228 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
229 * when the window is being maximized */
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
230 if (gdk_window_get_state(w->window)
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
231 & GDK_WINDOW_STATE_MAXIMIZED) {
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
232 return FALSE;
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
233 }
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
234 #endif
e55e52d41287 [gaim-migrate @ 16178]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13755
diff changeset
235
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
236 /* don't save if nothing changed */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
237 if (x == gaim_prefs_get_int("/gaim/gtk/blist/x") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
238 y == gaim_prefs_get_int("/gaim/gtk/blist/y") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
239 event->width == gaim_prefs_get_int("/gaim/gtk/blist/width") &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
240 event->height == gaim_prefs_get_int("/gaim/gtk/blist/height")) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
241
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
242 return FALSE; /* carry on normally */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
245 /* don't save off-screen positioning */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
246 if (x + event->width < 0 ||
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
247 y + event->height < 0 ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
248 x > gdk_screen_width() ||
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
249 y > gdk_screen_height()) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
250
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
251 return FALSE; /* carry on normally */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
252 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
253
12279
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
254 /* ignore changes when maximized */
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
255 if(gaim_prefs_get_bool("/gaim/gtk/blist/list_maximized"))
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
256 return FALSE;
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
257
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
258 /* store the position */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
259 gaim_prefs_set_int("/gaim/gtk/blist/x", x);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
260 gaim_prefs_set_int("/gaim/gtk/blist/y", y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
261 gaim_prefs_set_int("/gaim/gtk/blist/width", event->width);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
262 gaim_prefs_set_int("/gaim/gtk/blist/height", event->height);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
263
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 /* continue to handle event normally */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
268 static void gtk_blist_menu_info_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 serv_get_info(b->account->gc, b->name);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
273 static void gtk_blist_menu_im_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 {
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
275 gaim_gtkdialogs_im_with_user(b->account, b->name);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
278 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
279 {
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
280 serv_send_file(b->account->gc, b->name, NULL);
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
281 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
282
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
283 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, GaimChat *chat)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
284 {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
285 gaim_blist_node_set_bool((GaimBlistNode*)chat, "gtk-autojoin",
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
286 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
287 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
288
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
289 static void gtk_blist_join_chat(GaimChat *chat)
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
290 {
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
291 GaimConversation *conv;
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
292
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
293 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
294 gaim_chat_get_name(chat),
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
295 chat->account);
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
296
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
297 if (conv != NULL)
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
298 gaim_gtkconv_present_conversation(conv);
12592
37160dd563fa [gaim-migrate @ 14922]
Richard Laager <rlaager@wiktel.com>
parents: 12589
diff changeset
299
37160dd563fa [gaim-migrate @ 14922]
Richard Laager <rlaager@wiktel.com>
parents: 12589
diff changeset
300 serv_join_chat(chat->account->gc, chat->components);
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
301 }
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
302
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
303 static void gtk_blist_menu_join_cb(GtkWidget *w, GaimChat *chat)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304 {
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
305 gtk_blist_join_chat(chat);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
306 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
307
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
308 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
309 char *arg2, gpointer nada)
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
310 {
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
311 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
312 GtkTreePath *path;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
313 GValue val;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
314 GaimBlistNode *node;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
315
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
316 path = gtk_tree_path_new_from_string (arg1);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
317 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
318 gtk_tree_path_free (path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
319 val.g_type = 0;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
320 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
321 node = g_value_get_pointer(&val);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
322 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
323 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL);
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
324
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
325 switch (node->type)
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
326 {
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
327 case GAIM_BLIST_CONTACT_NODE:
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
328 {
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
329 GaimContact *contact = (GaimContact *)node;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
330 struct _gaim_gtk_blist_node *gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
331
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
332 if (contact->alias || gtknode->contact_expanded)
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
333 gaim_blist_alias_contact(contact, arg2);
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
334 else
12478
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
335 {
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
336 GaimBuddy *buddy = gaim_contact_get_priority_buddy(contact);
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
337 gaim_blist_alias_buddy(buddy, arg2);
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
338 serv_alias_buddy(buddy);
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
339 }
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
340 }
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
341 break;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
342
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
343 case GAIM_BLIST_BUDDY_NODE:
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
344 gaim_blist_alias_buddy((GaimBuddy*)node, arg2);
12478
8489040cf97b [gaim-migrate @ 14789]
Richard Laager <rlaager@wiktel.com>
parents: 12474
diff changeset
345 serv_alias_buddy((GaimBuddy *)node);
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
346 break;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
347 case GAIM_BLIST_GROUP_NODE:
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
348 gaim_blist_rename_group((GaimGroup*)node, arg2);
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
349 break;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
350 case GAIM_BLIST_CHAT_NODE:
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
351 gaim_blist_alias_chat((GaimChat*)node, arg2);
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
352 break;
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
353 default:
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
354 break;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
355 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
356 }
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
357
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
358 static void gtk_blist_menu_alias_cb(GtkWidget *w, GaimBlistNode *node)
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
359 {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
360 GtkTreeIter iter;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
361 GtkTreePath *path;
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
362 const char *text = NULL;
13509
56abb67edec9 [gaim-migrate @ 15885]
Richard Laager <rlaager@wiktel.com>
parents: 13478
diff changeset
363 char *esc;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
364
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
365 if (!(get_iter_from_node(node, &iter))) {
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
366 /* 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
367 node = node->parent;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
368 if (!get_iter_from_node(node, &iter))
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
369 /* Now it's definitely a bug */
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
370 return;
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
371 }
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
372
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
373 switch (node->type) {
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
374 case GAIM_BLIST_BUDDY_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
375 text = gaim_buddy_get_alias((GaimBuddy *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
376 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
377 case GAIM_BLIST_CONTACT_NODE:
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
378 text = gaim_contact_get_alias((GaimContact *)node);
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
379 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
380 case GAIM_BLIST_GROUP_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
381 text = ((GaimGroup *)node)->name;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
382 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
383 case GAIM_BLIST_CHAT_NODE:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
384 text = gaim_chat_get_name((GaimChat *)node);
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
385 break;
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
386 default:
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
387 g_return_if_reached();
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
388 }
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
389
13509
56abb67edec9 [gaim-migrate @ 15885]
Richard Laager <rlaager@wiktel.com>
parents: 13478
diff changeset
390 esc = g_markup_escape_text(text, -1);
56abb67edec9 [gaim-migrate @ 15885]
Richard Laager <rlaager@wiktel.com>
parents: 13478
diff changeset
391 gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, esc, -1);
56abb67edec9 [gaim-migrate @ 15885]
Richard Laager <rlaager@wiktel.com>
parents: 13478
diff changeset
392 g_free(esc);
11258
421d91546327 [gaim-migrate @ 13433]
Sean Egan <seanegan@gmail.com>
parents: 11257
diff changeset
393
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
394 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
395 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
396 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
397 gtk_widget_grab_focus(gtkblist->treeview);
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
398 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
399 gtk_tree_path_free(path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
400 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
401
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
402 static void gtk_blist_menu_bp_cb(GtkWidget *w, GaimBuddy *b)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
403 {
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
404 gaim_gtk_pounce_editor_show(b->account, b->name, NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
405 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
406
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
407 static void gtk_blist_menu_showlog_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
408 {
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
409 GaimLogType type;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
410 GaimAccount *account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
411 char *name = NULL;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
412
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
413 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
414
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
415 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
416 GaimBuddy *b = (GaimBuddy*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
417 type = GAIM_LOG_IM;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
418 name = g_strdup(b->name);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
419 account = b->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
420 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
421 GaimChat *c = (GaimChat*) node;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
422 GaimPluginProtocolInfo *prpl_info = NULL;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
423 type = GAIM_LOG_CHAT;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
424 account = c->account;
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
425 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
426 if (prpl_info && prpl_info->get_chat_name) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
427 name = prpl_info->get_chat_name(c->components);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
428 }
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
429 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
430 gaim_gtk_log_show_contact((GaimContact *)node);
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
431 gaim_gtk_clear_cursor(gtkblist->window);
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
432 return;
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
433 } else {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
434 gaim_gtk_clear_cursor(gtkblist->window);
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
435
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
436 /* This callback should not have been registered for a node
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
437 * that doesn't match the type of one of the blocks above. */
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
438 g_return_if_reached();
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
439 }
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
440
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
441 if (name && account) {
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
442 gaim_gtk_log_show(type, name, account);
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
443 g_free(name);
12232
375f1f3817a8 [gaim-migrate @ 14534]
Richard Laager <rlaager@wiktel.com>
parents: 12226
diff changeset
444
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
445 gaim_gtk_clear_cursor(gtkblist->window);
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
446 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
447 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
448
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449 static void gtk_blist_show_systemlog_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
450 {
8573
7dcd6f26e4a7 [gaim-migrate @ 9321]
Luke Schierer <lschiere@pidgin.im>
parents: 8470
diff changeset
451 gaim_gtk_syslog_show();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
452 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
453
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
454 static void gtk_blist_show_onlinehelp_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
455 {
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10229
diff changeset
456 gaim_notify_uri(NULL, GAIM_WEBSITE "documentation.php");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
457 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
458
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
459 static void
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
460 do_join_chat(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
461 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
462 if (data)
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 GHashTable *components =
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
465 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
466 GList *tmp;
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
467 GaimChat *chat;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
468
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
469 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
470 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
471 if (g_object_get_data(tmp->data, "is_spin"))
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
472 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
473 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
474 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
475 g_strdup_printf("%d",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
476 gtk_spin_button_get_value_as_int(tmp->data)));
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 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
479 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
480 g_hash_table_replace(components,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
481 g_strdup(g_object_get_data(tmp->data, "identifier")),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
482 g_strdup(gtk_entry_get_text(tmp->data)));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
483 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
484 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
485
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
486 chat = gaim_chat_new(data->account, NULL, components);
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
487 gtk_blist_join_chat(chat);
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
488 gaim_blist_remove_chat(chat);
8303
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 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
491
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
492 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
493 do_joinchat(GtkWidget *dialog, int id, GaimGtkJoinChatData *info)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
494 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
495 switch(id)
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
496 {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
497 case GTK_RESPONSE_OK:
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
498 do_join_chat(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
499
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
500 break;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
501 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
502
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
503 gtk_widget_destroy(GTK_WIDGET(dialog));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
504 g_list_free(info->entries);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
505 g_free(info);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
506 }
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
507
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
508 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
509 * 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
510 * 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
511 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
512 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
513 joinchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
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 GaimGtkJoinChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
516 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
517 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
518 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
519 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
520
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
521 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
522
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
523 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
524 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
525 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
526 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
527 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
528 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
529 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
530 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
531 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
532 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
533
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
534 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
535 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
536
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
537 static void
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
538 rebuild_joinchat_entries(GaimGtkJoinChatData *data)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
539 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
540 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
541 GList *list = NULL, *tmp = NULL;
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
542 GHashTable *defaults = NULL;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
543 struct proto_chat_entry *pce;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
544 gboolean focus = TRUE;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
545
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
546 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
547
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
548 gc = gaim_account_get_connection(data->account);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
549
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
550 while (GTK_BOX(data->entries_box)->children)
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 gtk_container_remove(GTK_CONTAINER(data->entries_box),
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
553 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
554 }
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 if (data->entries != NULL)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
557 g_list_free(data->entries);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
558
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
559 data->entries = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
560
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
561 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
562 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
563
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
564 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
565 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
566
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
567 for (tmp = list; tmp; tmp = tmp->next)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
568 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
569 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
570 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
571 GtkWidget *input;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
572
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
573 pce = tmp->data;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
574
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
575 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
576 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
577
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
578 label = gtk_label_new_with_mnemonic(pce->label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
579 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
580 gtk_size_group_add_widget(data->sg, label);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
581 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
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 if (pce->is_int)
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
584 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
585 GtkObject *adjust;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
586 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
587 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
588 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
589 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
590 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
591 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
592 else
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
593 {
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
594 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
595 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
596 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9770
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
597 value = g_hash_table_lookup(defaults, pce->identifier);
41f302d41839 [gaim-migrate @ 10638]
Luke Schierer <lschiere@pidgin.im>
parents: 9754
diff changeset
598 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
599 gtk_entry_set_text(GTK_ENTRY(input), value);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
600 if (pce->secret)
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
601 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
602 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
603 gtk_entry_set_invisible_char(GTK_ENTRY(input), GAIM_INVISIBLE_CHAR);
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
604 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
605 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
606 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
607 G_CALLBACK(joinchat_set_sensitive_if_input_cb), data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
608 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
609
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
610 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
611 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
612 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
613 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
614 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
615 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
616 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
617 gaim_set_accessible_label(input, label);
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
618 g_object_set_data(G_OBJECT(input), "identifier", (gpointer)pce->identifier);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
619 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
620 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
621 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
622
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
623 g_free(pce);
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
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
626 g_list_free(list);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
627 g_hash_table_destroy(defaults);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
628
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
629 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
630 joinchat_set_sensitive_if_input_cb(NULL, data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
631
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
632 gtk_widget_show_all(data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
633 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
634
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
635 static void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
636 joinchat_select_account_cb(GObject *w, GaimAccount *account,
13559
bbbde2f5c03b [gaim-migrate @ 15938]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13545
diff changeset
637 GaimGtkJoinChatData *data)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
638 {
13559
bbbde2f5c03b [gaim-migrate @ 15938]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13545
diff changeset
639 data->account = account;
bbbde2f5c03b [gaim-migrate @ 15938]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13545
diff changeset
640 rebuild_joinchat_entries(data);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
641 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
642
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
643 static gboolean
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
644 chat_account_filter_func(GaimAccount *account)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
645 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
646 GaimConnection *gc = gaim_account_get_connection(account);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
647 GaimPluginProtocolInfo *prpl_info = NULL;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
648
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
649 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
650
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
651 return (prpl_info->chat_info != NULL);
8303
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
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
654 gboolean
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
655 gaim_gtk_blist_joinchat_is_showable()
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
656 {
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
657 GList *c;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
658 GaimConnection *gc;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
659
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
660 for (c = gaim_connections_get_all(); c != NULL; c = c->next) {
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
661 gc = c->data;
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
662
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
663 if (chat_account_filter_func(gaim_connection_get_account(gc)))
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
664 return TRUE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
665 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
666
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
667 return FALSE;
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
668 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
669
8305
57bdd25752c1 [gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents: 8303
diff changeset
670 void
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
671 gaim_gtk_blist_joinchat_show(void)
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
672 {
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
673 GtkWidget *hbox, *vbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
674 GtkWidget *rowbox;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
675 GtkWidget *label;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
676 GaimGtkBuddyList *gtkblist;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
677 GtkWidget *img = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
678 GaimGtkJoinChatData *data = NULL;
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
679
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
680 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
681 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
682 GTK_ICON_SIZE_DIALOG);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
683 data = g_new0(GaimGtkJoinChatData, 1);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
684
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
685 data->window = gtk_dialog_new_with_buttons(_("Join a Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
686 NULL, GTK_DIALOG_NO_SEPARATOR,
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
687 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
8308
34e8ad866f12 [gaim-migrate @ 9032]
Mark Doliner <mark@kingant.net>
parents: 8305
diff changeset
688 GAIM_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
689 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
690 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
691 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
692 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
693 gtk_container_set_border_width(
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
694 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
695 gtk_window_set_role(GTK_WINDOW(data->window), "join_chat");
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
696
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
697 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
698 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
699 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
700 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
701
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
702 vbox = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
703 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
704 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
705
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
706 label = gtk_label_new(_("Please enter the appropriate information "
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
707 "about the chat you would like to join.\n"));
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
708 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
709 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
710 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
711
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
712 rowbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
713 gtk_box_pack_start(GTK_BOX(vbox), rowbox, TRUE, TRUE, 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
714
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
715 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
716
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
717 label = gtk_label_new_with_mnemonic(_("_Account:"));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
718 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
719 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
720 gtk_size_group_add_widget(data->sg, label);
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
721
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
722 data->account_menu = gaim_gtk_account_option_menu_new(NULL, FALSE,
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
723 G_CALLBACK(joinchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
724 chat_account_filter_func, data);
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
725 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
726 gtk_label_set_mnemonic_widget(GTK_LABEL(label),
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
727 GTK_WIDGET(data->account_menu));
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
728 gaim_set_accessible_label (data->account_menu, label);
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
729
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
730 data->entries_box = gtk_vbox_new(FALSE, 5);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
731 gtk_container_add(GTK_CONTAINER(vbox), data->entries_box);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
732 gtk_container_set_border_width(GTK_CONTAINER(data->entries_box), 0);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
733
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
734 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
735
8303
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
736 rebuild_joinchat_entries(data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
737
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
738 g_signal_connect(G_OBJECT(data->window), "response",
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
739 G_CALLBACK(do_joinchat), data);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
740
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
741 g_object_unref(data->sg);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
742
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
743 gtk_widget_show_all(data->window);
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
744 }
4eb4b2a6c604 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
745
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
746 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
747 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
748 GValue val;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
749
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
750 val.g_type = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
751 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
752
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
753 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
754
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
755 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
756 gaim_blist_node_set_bool(node, "collapsed", FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
757 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
758 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
759
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
760 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
761 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
762 GValue val;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
763
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
764 val.g_type = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
765 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
766
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
767 node = g_value_get_pointer(&val);
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 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
770 gaim_blist_node_set_bool(node, "collapsed", TRUE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
771 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
772 gaim_gtk_blist_collapse_contact_cb(NULL, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
773 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
774 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
775
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
776 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
777 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
778 GtkTreeIter iter;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
779 GValue val;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
780
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
781 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
782
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
783 val.g_type = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
784 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
785 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
786
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
787 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
788 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
789
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
790 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
791 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
792 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
793 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
794
9728
8be2c406a1f1 [gaim-migrate @ 10589]
Mark Doliner <mark@kingant.net>
parents: 9714
diff changeset
795 gaim_gtkdialogs_im_with_user(buddy->account, buddy->name);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
796 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
12576
1246935dd047 [gaim-migrate @ 14898]
Richard Laager <rlaager@wiktel.com>
parents: 12569
diff changeset
797 gtk_blist_join_chat((GaimChat *)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
798 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
799 if (gtk_tree_view_row_expanded(tv, path))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
800 gtk_tree_view_collapse_row(tv, path);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
801 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
802 gtk_tree_view_expand_row(tv,path,FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
803 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
804 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
805
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
806 static void gaim_gtk_blist_add_chat_cb()
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
807 {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
808 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
809 GtkTreeIter iter;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
810 GaimBlistNode *node;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
811
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
812 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
813 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
814 if (GAIM_BLIST_NODE_IS_BUDDY(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
815 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
816 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
817 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
818 else if (GAIM_BLIST_NODE_IS_GROUP(node))
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
819 gaim_blist_request_add_chat(NULL, (GaimGroup*)node, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
820 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
821 else {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
822 gaim_blist_request_add_chat(NULL, NULL, NULL, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
823 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
824 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
825
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
826 static void gaim_gtk_blist_add_buddy_cb()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
827 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
828 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
829 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
830 GaimBlistNode *node;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
831
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
832 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
833 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
834 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
835 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
836 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
837 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
838 || GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
839 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
840 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
841 gaim_blist_request_add_buddy(NULL, NULL, ((GaimGroup*)node)->name, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
842 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
843 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
844 else {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
845 gaim_blist_request_add_buddy(NULL, NULL, NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
846 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
847 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
848
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
849 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
850 gaim_gtk_blist_remove_cb (GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
851 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
852 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
853 gaim_gtkdialogs_remove_buddy((GaimBuddy*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
854 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
855 gaim_gtkdialogs_remove_chat((GaimChat*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
856 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
857 gaim_gtkdialogs_remove_group((GaimGroup*)node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
858 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
9730
c9ac1976ef01 [gaim-migrate @ 10591]
Mark Doliner <mark@kingant.net>
parents: 9728
diff changeset
859 gaim_gtkdialogs_remove_contact((GaimContact*)node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
860 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
861 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
862
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
863 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
864 gaim_gtk_blist_expand_contact_cb(GtkWidget *w, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
865 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
866 struct _gaim_gtk_blist_node *gtknode;
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
867 GtkTreeIter iter, parent;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
868 GaimBlistNode *bnode;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
869 GtkTreePath *path;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
870
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
871 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
872 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
873
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
874 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
875
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
876 gtknode->contact_expanded = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
877
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
878 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
879 gaim_gtk_blist_update(NULL, bnode);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
880 }
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
881
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
882 /* 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
883 get_iter_from_node(node, &parent);
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
884 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
885 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
886 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
887 /* Let the treeview draw so it knows where to scroll */
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
888 while (gtk_events_pending())
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
889 gtk_main_iteration();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
890 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
891
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
892 gaim_gtk_blist_update_contact(NULL, node->child);
9632
885bba4f9d3b [gaim-migrate @ 10476]
Sean Egan <seanegan@gmail.com>
parents: 9620
diff changeset
893 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
894 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
895
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
896 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
897 gaim_gtk_blist_collapse_contact_cb(GtkWidget *w, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
898 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
899 GaimBlistNode *bnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
900 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
901
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
902 if(!GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
903 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
904
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
905 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
906
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
907 gtknode->contact_expanded = FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
908
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
909 for(bnode = node->child; bnode; bnode = bnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
910 gaim_gtk_blist_update(NULL, bnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
911 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
912 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
913
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
914 void
10662
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
915 gaim_gtk_append_blist_node_proto_menu(GtkWidget *menu, GaimConnection *gc,
54ac161a876e [gaim-migrate @ 12199]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10643
diff changeset
916 GaimBlistNode *node)
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
917 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
918 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
919 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
920
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
921 if(!prpl_info || !prpl_info->blist_node_menu)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
922 return;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
923
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
924 for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12883
diff changeset
925 GaimMenuAction *act = (GaimMenuAction *) l->data;
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12883
diff changeset
926 gaim_gtk_append_menu_action(menu, act, node);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
927 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
928 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
929 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
930
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
931 void
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12883
diff changeset
932 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
933 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
934 GList *l, *ll;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
935
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
936 for(l = ll = gaim_blist_node_get_extended_menu(node); l; l = l->next) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12883
diff changeset
937 GaimMenuAction *act = (GaimMenuAction *) l->data;
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12883
diff changeset
938 gaim_gtk_append_menu_action(menu, act, node);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
939 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
940 g_list_free(ll);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
941 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
942
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
943 void
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
944 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
945 GaimPluginProtocolInfo *prpl_info;
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
946 GaimContact *contact;
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
947 gboolean contact_expanded = FALSE;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
948
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
949 g_return_if_fail(menu);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
950 g_return_if_fail(buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
951
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
952 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(buddy->account->gc->prpl);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
953
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
954 contact = gaim_buddy_get_contact(buddy);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
955 if (contact) {
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
956 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
957 }
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
958
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
959 if (prpl_info && prpl_info->get_info) {
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
960 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
961 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
962 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
963 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
964 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
965 if (prpl_info && prpl_info->send_file) {
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
966 if (!prpl_info->can_receive_file ||
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
967 prpl_info->can_receive_file(buddy->account->gc, buddy->name))
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
968 {
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
969 gaim_new_item_from_stock(menu, _("_Send File"),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
970 GAIM_STOCK_FILE_TRANSFER,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
971 G_CALLBACK(gtk_blist_menu_send_file_cb),
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
972 buddy, 0, 0, NULL);
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
973 }
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9460
diff changeset
974 }
12024
e67993da8a22 [gaim-migrate @ 14317]
Sean Egan <seanegan@gmail.com>
parents: 12016
diff changeset
975
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
976 gaim_new_item_from_stock(menu, _("Add Buddy _Pounce"), GAIM_STOCK_POUNCE,
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
977 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
978
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
979 if(((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
980 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
981 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
982 contact, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
983 } else if (!sub) {
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
984 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
985 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
986 }
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
987
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
988 gaim_gtk_append_blist_node_proto_menu(menu, buddy->account->gc,
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
989 (GaimBlistNode *)buddy);
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
990 gaim_gtk_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
991
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
992 if (((GaimBlistNode*)buddy)->parent->child->next && !sub && !contact_expanded) {
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
993 gaim_separator(menu);
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
994
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
995 gaim_new_item_from_stock(menu, _("Alias..."), GAIM_STOCK_ALIAS,
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
996 G_CALLBACK(gtk_blist_menu_alias_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
997 contact, 0, 0, NULL);
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
998 gaim_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
999 G_CALLBACK(gaim_gtk_blist_remove_cb),
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1000 contact, 0, 0, NULL);
12319
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
1001 } else if (!sub || contact_expanded) {
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
1002 gaim_separator(menu);
7630a95f3b8b [gaim-migrate @ 14623]
Richard Laager <rlaager@wiktel.com>
parents: 12302
diff changeset
1003
9925
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1004 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1005 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1006 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1007 G_CALLBACK(gaim_gtk_blist_remove_cb), buddy,
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1008 0, 0, NULL);
4e7590473515 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1009 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1010 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1011
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1012 static gboolean
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1013 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
1014 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1015 GValue val;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1016 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1017 GtkTreeSelection *sel;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1018
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1019 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1020 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1021 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1022
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1023 val.g_type = 0;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1024 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1025 NODE_COLUMN, &val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1026 node = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1027
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1028 if(event->state & GDK_CONTROL_MASK &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1029 (event->keyval == 'o' || event->keyval == 'O')) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1030 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1031
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1032 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1033 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1034 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1035 buddy = (GaimBuddy*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1036 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1037 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1038 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1039 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1040 serv_get_info(buddy->account->gc, buddy->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1041 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1042
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1043 return FALSE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1044 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1045
9013
d494fd1bd90b [gaim-migrate @ 9789]
Luke Schierer <lschiere@pidgin.im>
parents: 8986
diff changeset
1046
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1047 static GtkWidget *
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1048 create_group_menu (GaimBlistNode *node, GaimGroup *g)
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1049 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1050 GtkWidget *menu;
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1051 GtkWidget *item;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1052
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1053 menu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1054 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
1055 G_CALLBACK(gaim_gtk_blist_add_buddy_cb), node, 0, 0, NULL);
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1056 item = gaim_new_item_from_stock(menu, _("Add a C_hat"), GTK_STOCK_ADD,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1057 G_CALLBACK(gaim_gtk_blist_add_chat_cb), node, 0, 0, NULL);
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
1058 gtk_widget_set_sensitive(item, gaim_gtk_blist_joinchat_is_showable());
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1059 gaim_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1060 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1061 gaim_new_item_from_stock(menu, _("_Rename"), NULL,
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
1062 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
1063
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1064 gaim_gtk_append_blist_node_extended_menu(menu, node);
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1065
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1066 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1067 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1068
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1069
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1070 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1071 create_chat_menu(GaimBlistNode *node, GaimChat *c) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1072 GtkWidget *menu;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1073 gboolean autojoin;
8143
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 menu = gtk_menu_new();
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1076 autojoin = (gaim_blist_node_get_bool(node, "gtk-autojoin") ||
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1077 (gaim_blist_node_get_string(node, "gtk-autojoin") != NULL));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1078
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1079 gaim_new_item_from_stock(menu, _("_Join"), GAIM_STOCK_CHAT,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1080 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
1081 gaim_new_check_item(menu, _("Auto-Join"),
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1082 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1083 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9869
diff changeset
1084 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
1085
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1086 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
1087 gaim_gtk_append_blist_node_extended_menu(menu, node);
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1088
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1089 gaim_separator(menu);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9019
diff changeset
1090
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1091 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1092 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1093 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1094 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
1095
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1096 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1097 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1098
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1099 static GtkWidget *
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1100 create_contact_menu (GaimBlistNode *node)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1101 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1102 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1103
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1104 menu = gtk_menu_new();
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1105
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
1106 gaim_new_item_from_stock(menu, _("View _Log"), GAIM_STOCK_LOG,
10663
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1107 G_CALLBACK(gtk_blist_menu_showlog_cb),
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1108 node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1109
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1110 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1111
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8259
diff changeset
1112 gaim_new_item_from_stock(menu, _("_Alias..."), GAIM_STOCK_ALIAS,
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1113 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
1114 gaim_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1115 G_CALLBACK(gaim_gtk_blist_remove_cb), node, 0, 0, NULL);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1116
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1117 gaim_separator(menu);
241d2e62bed2 [gaim-migrate @ 12202]
Sean Egan <seanegan@gmail.com>
parents: 10662
diff changeset
1118
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1119 gaim_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1120 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1121 node, 0, 0, NULL);
9051
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1122
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1123 gaim_gtk_append_blist_node_extended_menu(menu, node);
826013efffcb [gaim-migrate @ 9827]
Luke Schierer <lschiere@pidgin.im>
parents: 9030
diff changeset
1124
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1125 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1126 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1127
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1128 static GtkWidget *
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1129 create_buddy_menu(GaimBlistNode *node, GaimBuddy *b) {
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1130 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
1131 GtkWidget *menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1132 GtkWidget *menuitem;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1133 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
1134
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1135 menu = gtk_menu_new();
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1136 gaim_gtk_blist_make_buddy_menu(menu, b, FALSE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1137
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1138 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1139 gaim_separator(menu);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1140
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1141 if(gtknode->contact_expanded) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1142 gaim_new_item_from_stock(menu, _("_Collapse"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1143 GTK_STOCK_ZOOM_OUT,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1144 G_CALLBACK(gaim_gtk_blist_collapse_contact_cb),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1145 node, 0, 0, NULL);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1146 } else {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1147 gaim_new_item_from_stock(menu, _("_Expand"),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1148 GTK_STOCK_ZOOM_IN,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1149 G_CALLBACK(gaim_gtk_blist_expand_contact_cb), node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1150 0, 0, NULL);
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 if(node->child->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1153 GaimBlistNode *bnode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1154
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1155 for(bnode = node->child; bnode; bnode = bnode->next) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1156 GaimBuddy *buddy = (GaimBuddy*)bnode;
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1157 GdkPixbuf *buf;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1158 GtkWidget *submenu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1159 GtkWidget *image;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1160
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1161 if(buddy == b)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1162 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1163 if(!buddy->account->gc)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1164 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1165 if(!show_offline && !GAIM_BUDDY_IS_ONLINE(buddy))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1166 continue;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1167
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1168 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
9340
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1169 buf = gaim_gtk_blist_get_status_icon(bnode,
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1170 GAIM_STATUS_ICON_SMALL);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1171 image = gtk_image_new_from_pixbuf(buf);
7fa8eff579b5 [gaim-migrate @ 10148]
Tim Ringenbach <marv@pidgin.im>
parents: 9337
diff changeset
1172 g_object_unref(G_OBJECT(buf));
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1173 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
1174 image);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1175 gtk_widget_show(image);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1176 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1177 gtk_widget_show(menuitem);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1178
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1179 submenu = gtk_menu_new();
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1180 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1181 gtk_widget_show(submenu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1182
10484
ec82cbb21fe8 [gaim-migrate @ 11774]
Nathan Walp <nwalp@pidgin.im>
parents: 10483
diff changeset
1183 gaim_gtk_blist_make_buddy_menu(submenu, buddy, TRUE);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1184 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1185 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1186 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1187 return menu;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1188 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1189
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1190 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1191 gaim_gtk_blist_show_context_menu(GaimBlistNode *node,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1192 GtkMenuPositionFunc func,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1193 GtkWidget *tv,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1194 guint button,
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1195 guint32 time)
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 struct _gaim_gtk_blist_node *gtknode;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1198 GtkWidget *menu = NULL;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1199 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1200
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1201 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1202
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1203 /* Create a menu based on the thing we right-clicked on */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1204 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1205 GaimGroup *g = (GaimGroup *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1206
8952
e3f4657fa555 [gaim-migrate @ 9724]
Luke Schierer <lschiere@pidgin.im>
parents: 8945
diff changeset
1207 menu = create_group_menu(node, g);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1208 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
8586
5af95c2b1179 [gaim-migrate @ 9336]
Ethan Blanton <elb@pidgin.im>
parents: 8573
diff changeset
1209 GaimChat *c = (GaimChat *)node;
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1210
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1211 menu = create_chat_menu(node, c);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1212 } else if ((GAIM_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1213 menu = create_contact_menu(node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1214 } 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
1215 GaimBuddy *b;
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 if (GAIM_BLIST_NODE_IS_CONTACT(node))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1218 b = gaim_contact_get_priority_buddy((GaimContact*)node);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1219 else
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1220 b = (GaimBuddy *)node;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1221
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
1222 menu = create_buddy_menu(node, b);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1223 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1224
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1225 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1226 /* 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
1227 * 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
1228 This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1229 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1230 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1231 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1232 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1233 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1234
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1235 /* Now display the menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1236 if (menu != NULL) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1237 gtk_widget_show_all(menu);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1238 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
1239 handled = TRUE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1240 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1241
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1242 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1243 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1244
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1245 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
1246 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1247 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1248 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1249 GValue val;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1250 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1251 GtkTreeSelection *sel;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1252 GaimPlugin *prpl = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1253 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1254 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1255 gboolean handled = FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1256
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1257 /* Here we figure out which node was clicked */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1258 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
1259 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1260 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1261 val.g_type = 0;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1262 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
1263 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1264 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1265
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1266 /* Right click draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1267 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1268 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
1269
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1270 /* CTRL+middle click expands or collapse a contact */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1271 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1272 (event->state & GDK_CONTROL_MASK) && (GAIM_BLIST_NODE_IS_CONTACT(node))) {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1273 if (gtknode->contact_expanded)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1274 gaim_gtk_blist_collapse_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1275 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1276 gaim_gtk_blist_expand_contact_cb(NULL, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1277 handled = TRUE;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1278
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1279 /* Double middle click gets info */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1280 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1281 ((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
1282 GaimBuddy *b;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1283 if(GAIM_BLIST_NODE_IS_CONTACT(node))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1284 b = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1285 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1286 b = (GaimBuddy *)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1287
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
1288 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1289 if (prpl != NULL)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1290 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1291
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1292 if (prpl && prpl_info->get_info)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1293 serv_get_info(b->account->gc, b->name);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1294 handled = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1295 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1296
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1297 #if (1)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1298 /*
10814
364a2ef907ae [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
1299 * 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
1300 * FALSE here, as would be normal the event propoagates down and
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1301 * somehow gets interpreted as the start of a drag event.
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 * 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
1304 * was handled? --Mark
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1305 */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1306 if(handled) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1307 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1308 gtk_tree_selection_select_path(sel, path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1309 gtk_tree_path_free(path);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1310 return TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1311 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1312 #endif
7753
f1fda2e85015 [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1313 gtk_tree_path_free(path);
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1314
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1315 return FALSE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1316 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1317
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1318 static gboolean
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1319 gaim_gtk_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1320 {
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1321 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1322 GValue val;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1323 GtkTreeIter iter;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1324 GtkTreeSelection *sel;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1325 gboolean handled = FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1326
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1327 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1328 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1329 return FALSE;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1330
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1331 val.g_type = 0;
8143
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1332 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel),
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1333 &iter, NODE_COLUMN, &val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1334 node = g_value_get_pointer(&val);
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1335
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1336 /* Shift+F10 draws a context menu */
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1337 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
1338
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1339 return handled;
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1340 }
8633dc570442 [gaim-migrate @ 8851]
Mark Doliner <mark@kingant.net>
parents: 8137
diff changeset
1341
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1342 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
1343 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1344 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
12569
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1345
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1346 gaim_prefs_set_bool("/gaim/gtk/blist/show_buddy_icons",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1347 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
12569
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1348
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1349 gaim_gtk_clear_cursor(gtkblist->window);
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1350 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
1351
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1352 static void gaim_gtk_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item)
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1353 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1354 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1355
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1356 gaim_prefs_set_bool("/gaim/gtk/blist/show_idle_time",
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1357 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1358
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1359 gaim_gtk_clear_cursor(gtkblist->window);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1360 }
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
1361
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1362 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
1363 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1364 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
12569
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1365
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1366 gaim_prefs_set_bool("/gaim/gtk/blist/show_empty_groups",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1367 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
12569
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1368
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1369 gaim_gtk_clear_cursor(gtkblist->window);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1370 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1371
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1372 static void gaim_gtk_blist_edit_mode_cb(gpointer callback_data, guint callback_action,
12569
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1373 GtkWidget *checkitem)
853e85b6d98c [gaim-migrate @ 14888]
Richard Laager <rlaager@wiktel.com>
parents: 12530
diff changeset
1374 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1375 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1376
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1377 gaim_prefs_set_bool("/gaim/gtk/blist/show_offline_buddies",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1378 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1379
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
1380 gaim_gtk_clear_cursor(gtkblist->window);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1381 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1382
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1383 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
1384 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1385 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
1386 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1387
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1388 static void
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1389 gaim_gtk_blist_mute_pref_cb(const char *name, GaimPrefType type,
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1390 gconstpointer value, gpointer data)
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1391 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1392 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
1393 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1394 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1395
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1396 static void
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1397 gaim_gtk_blist_sound_method_pref_cb(const char *name, GaimPrefType type,
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
1398 gconstpointer value, gpointer data)
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1399 {
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1400 gboolean sensitive = TRUE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1401
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1402 if(!strcmp(value, "none"))
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1403 sensitive = FALSE;
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1404
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1405 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
1406 }
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
1407
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1408 static void
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1409 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
1410 const char *alias)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1411 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1412 GList *l;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1413 GaimAccount *account = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1414 GaimConnection *gc;
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 if (list == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1417 return;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1418
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1419 for (l = gaim_connections_get_all(); l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1420 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1421 gc = (GaimConnection *)l->data;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1422 account = gaim_connection_get_account(gc);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1423
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1424 if (!strcmp(gaim_account_get_protocol_id(account), prpl_id))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1425 break;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1426
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1427 account = NULL;
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
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1430 if (account != NULL)
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 for (l = list; l != NULL; l = l->next)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1433 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1434 gaim_blist_request_add_buddy(account, l->data,
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1435 (group ? group->name : NULL),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1436 alias);
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 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1439
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1440 g_list_foreach(list, (GFunc)g_free, NULL);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1441 g_list_free(list);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1442 }
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 static gboolean
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1445 parse_vcard(const char *vcard, GaimGroup *group)
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 char *temp_vcard;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1448 char *s, *c;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1449 char *alias = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1450 GList *aims = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1451 GList *icqs = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1452 GList *yahoos = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1453 GList *msns = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1454 GList *jabbers = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1455
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1456 s = temp_vcard = g_strdup(vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1457
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1458 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1459 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1460 char *field, *value;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1461
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1462 field = s;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1463
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1464 /* Grab the field */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1465 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1466 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1467
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1468 if (*s == '\r') s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1469 if (*s == '\n')
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 s++;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1472 continue;
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 if (*s != '\0') *s++ = '\0';
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 ((c = strchr(field, ';')) != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1478 *c = '\0';
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 /* Proceed to the end of the line */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1481 value = s;
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 while (*s != '\r' && *s != '\n' && *s != '\0')
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1484 s++;
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 if (*s == '\r') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1487 if (*s == '\n') *s++ = '\0';
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1488
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1489 /* We only want to worry about a few fields here. */
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1490 if (!strcmp(field, "FN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1491 alias = g_strdup(value);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1492 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1493 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1494 !strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1495 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1496 char **values = g_strsplit(value, ":", 0);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1497 char **im;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1498
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1499 for (im = values; *im != NULL; im++)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1500 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1501 if (!strcmp(field, "X-AIM"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1502 aims = g_list_append(aims, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1503 else if (!strcmp(field, "X-ICQ"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1504 icqs = g_list_append(icqs, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1505 else if (!strcmp(field, "X-YAHOO"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1506 yahoos = g_list_append(yahoos, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1507 else if (!strcmp(field, "X-MSN"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1508 msns = g_list_append(msns, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1509 else if (!strcmp(field, "X-JABBER"))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1510 jabbers = g_list_append(jabbers, g_strdup(*im));
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1511 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1512
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1513 g_strfreev(values);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1514 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1515 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1516
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1517 g_free(temp_vcard);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1518
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1519 if (aims == NULL && icqs == NULL && yahoos == NULL &&
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1520 msns == NULL && jabbers == NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1521 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1522 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1523 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1524
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1525 return FALSE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1526 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1527
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1528 add_buddies_from_vcard("prpl-oscar", group, aims, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1529 add_buddies_from_vcard("prpl-oscar", group, icqs, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1530 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1531 add_buddies_from_vcard("prpl-msn", group, msns, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1532 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1533
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1534 if (alias != NULL)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1535 g_free(alias);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1536
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1537 return TRUE;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1538 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1539
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1540 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1541 static void gaim_gtk_blist_drag_begin(GtkWidget *widget,
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1542 GdkDragContext *drag_context, gpointer user_data)
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1543 {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1544 gaim_gtk_blist_tooltip_destroy();
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1545
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1546
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1547 /* 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
1548 * to appear and obscure the dragging operation.
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1549 * This is a workaround for GTK+ bug 107320. */
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1550 if (gtkblist->timeout) {
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1551 g_source_remove(gtkblist->timeout);
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1552 gtkblist->timeout = 0;
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1553 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1554 }
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1555 #endif
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1556
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1557 static void gaim_gtk_blist_drag_data_get_cb(GtkWidget *widget,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1558 GdkDragContext *dc,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1559 GtkSelectionData *data,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1560 guint info,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
1561 guint time,
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1562 gpointer null)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1563 {
11059
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
1564
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1565 if (data->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1566 {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1567 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
1568 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1569 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1570 GaimBlistNode *node = NULL;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1571 GValue val;
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1572 if(!sourcerow)
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1573 return;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1574 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1575 val.g_type = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1576 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
1577 node = g_value_get_pointer(&val);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1578 gtk_selection_data_set (data,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1579 gdk_atom_intern ("GAIM_BLIST_NODE", FALSE),
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1580 8, /* bits */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1581 (void*)&node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1582 sizeof (node));
5273
2e1238f4b4e3 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
1583
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1584 gtk_tree_path_free(sourcerow);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1585 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1586 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
1587 {
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1588 GtkTreeRowReference *ref;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1589 GtkTreePath *sourcerow;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1590 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1591 GaimBlistNode *node = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1592 GaimBuddy *buddy;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1593 GaimConnection *gc;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1594 GValue val;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1595 GString *str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1596 const char *protocol;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1597 char *mime_str;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1598
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1599 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
1600 sourcerow = gtk_tree_row_reference_get_path(ref);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1601
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1602 if (!sourcerow)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1603 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1604
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1605 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1606 sourcerow);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1607 val.g_type = 0;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1608 gtk_tree_model_get_value(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1609 NODE_COLUMN, &val);
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 node = g_value_get_pointer(&val);
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 if (GAIM_BLIST_NODE_IS_CONTACT(node))
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 buddy = gaim_contact_get_priority_buddy((GaimContact *)node);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1616 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1617 else if (!GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1618 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1619 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1620 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1621 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1622 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1623 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1624 buddy = (GaimBuddy *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1625 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1626
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1627 gc = gaim_account_get_connection(buddy->account);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1628
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1629 if (gc == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1630 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1631 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1632 return;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1633 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1634
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1635 protocol =
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1636 GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1637 buddy);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1638
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1639 str = g_string_new(NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1640 g_string_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1641 "MIME-Version: 1.0\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1642 "Content-Type: application/x-im-contact\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1643 "X-IM-Protocol: %s\r\n"
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1644 "X-IM-Username: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1645 protocol,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1646 buddy->name);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1647
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1648 if (buddy->alias != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1649 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1650 g_string_append_printf(str,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1651 "X-IM-Alias: %s\r\n",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1652 buddy->alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1653 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1654
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1655 str = g_string_append(str, "\r\n");
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1656
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1657 mime_str = g_string_free(str, FALSE);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1658
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1659 gtk_selection_data_set(data,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1660 gdk_atom_intern("application/x-im-contact", FALSE),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1661 8, /* bits */
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1662 (const guchar *)mime_str,
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1663 strlen(mime_str) + 1);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1664
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1665 g_free(mime_str);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1666 gtk_tree_path_free(sourcerow);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1667 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1668 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1669
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1670 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
1671 GtkSelectionData *sd, guint info, guint t)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1672 {
13832
d1fdde7cfc0a [gaim-migrate @ 16281]
Richard Laager <rlaager@wiktel.com>
parents: 13819
diff changeset
1673 if (gtkblist->drag_timeout) {
d1fdde7cfc0a [gaim-migrate @ 16281]
Richard Laager <rlaager@wiktel.com>
parents: 13819
diff changeset
1674 g_source_remove(gtkblist->drag_timeout);
d1fdde7cfc0a [gaim-migrate @ 16281]
Richard Laager <rlaager@wiktel.com>
parents: 13819
diff changeset
1675 gtkblist->drag_timeout = 0;
d1fdde7cfc0a [gaim-migrate @ 16281]
Richard Laager <rlaager@wiktel.com>
parents: 13819
diff changeset
1676 }
d1fdde7cfc0a [gaim-migrate @ 16281]
Richard Laager <rlaager@wiktel.com>
parents: 13819
diff changeset
1677
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1678 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE) && sd->data) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1679 GaimBlistNode *n = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1680 GtkTreePath *path = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1681 GtkTreeViewDropPosition position;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1682 memcpy(&n, sd->data, sizeof(n));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1683 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
1684 /* 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
1685 GtkTreeIter iter;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1686 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1687 GValue val;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1688 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1689
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1690 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1691 &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1692 val.g_type = 0;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1693 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1694 &iter, NODE_COLUMN, &val);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1695 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1696 gtknode = node->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1697
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1698 if (GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1699 GaimContact *c = (GaimContact*)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1700 if (GAIM_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1701 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1702 } else if (GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1703 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1704 switch(position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1705 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1706 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1707 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1708 node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1709 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1710 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1711 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1712 gaim_blist_add_contact(c, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1713 node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1714 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1715 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1716 } else if(GAIM_BLIST_NODE_IS_GROUP(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1717 gaim_blist_add_contact(c, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1718 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1719 gaim_blist_merge_contact(c, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1720 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1721 } else if (GAIM_BLIST_NODE_IS_BUDDY(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1722 GaimBuddy *b = (GaimBuddy*)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_buddy(b, (GaimContact*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1728 (GaimGroup*)node->parent->parent, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1729 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1730 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1731 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1732 gaim_blist_add_buddy(b, (GaimContact*)node->parent,
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);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1735 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1736 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1737 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1738 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node->parent,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1739 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1740 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1741 gaim_blist_add_buddy(b, NULL, (GaimGroup*)node, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1742 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1743 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1744 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1745 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1746 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1747 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1748 gaim_blist_add_buddy(b, (GaimContact*)node,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1749 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1750 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1751 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1752 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1753 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1754 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1755 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1756 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1757 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1758 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1759 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1760 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1761 (GaimGroup*)node->parent, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1762 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1763 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1764 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1765 gaim_blist_add_buddy(b, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1766 (GaimGroup*)node->parent, node->prev);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1767 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1768 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1769 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1770 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1771 } else if (GAIM_BLIST_NODE_IS_CHAT(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1772 GaimChat *chat = (GaimChat *)n;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1773 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1774 switch(position) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1775 case GTK_TREE_VIEW_DROP_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1776 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1777 case GTK_TREE_VIEW_DROP_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1778 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1779 gaim_blist_add_chat(chat,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1780 (GaimGroup*)node->parent->parent,
13542
2235ada6c746 [gaim-migrate @ 15919]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13540
diff changeset
1781 node->parent);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1782 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1783 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1784 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1785 GAIM_BLIST_NODE_IS_CHAT(node)) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1786 switch(position) {
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1787 case GTK_TREE_VIEW_DROP_AFTER:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1788 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1789 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1790 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1791 case GTK_TREE_VIEW_DROP_BEFORE:
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1792 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1793 gaim_blist_add_chat(chat, (GaimGroup*)node->parent, node->prev);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1794 break;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1795 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1796 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1797 gaim_blist_add_chat(chat, (GaimGroup*)node, NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1798 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1799 } else if (GAIM_BLIST_NODE_IS_GROUP(n)) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1800 GaimGroup *g = (GaimGroup*)n;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1801 if (GAIM_BLIST_NODE_IS_GROUP(node)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1802 switch (position) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1803 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1804 case GTK_TREE_VIEW_DROP_AFTER:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1805 gaim_blist_add_group(g, node);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1806 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1807 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1808 case GTK_TREE_VIEW_DROP_BEFORE:
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1809 gaim_blist_add_group(g, node->prev);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1810 break;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1811 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1812 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1813 gaim_blist_add_group(g, node->parent->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1814 } else if(GAIM_BLIST_NODE_IS_CONTACT(node) ||
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1815 GAIM_BLIST_NODE_IS_CHAT(node)) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1816 gaim_blist_add_group(g, node->parent);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1817 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1818 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1819
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1820 gtk_tree_path_free(path);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
1821 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1822 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1823 }
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1824 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1825 FALSE) && sd->data)
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 GaimGroup *group = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1828 GtkTreePath *path = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1829 GtkTreeViewDropPosition position;
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1830 GaimAccount *account;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1831 char *protocol = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1832 char *username = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1833 char *alias = NULL;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1834
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1835 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
1836 x, y, &path, &position))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1837 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1838 GtkTreeIter iter;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1839 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1840 GValue val;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1841
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1842 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1843 &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1844 val.g_type = 0;
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1845 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1846 &iter, NODE_COLUMN, &val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1847 node = g_value_get_pointer(&val);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1848
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1849 if (GAIM_BLIST_NODE_IS_BUDDY(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1850 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1851 group = (GaimGroup *)node->parent->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1852 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1853 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1854 GAIM_BLIST_NODE_IS_CONTACT(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1855 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1856 group = (GaimGroup *)node->parent;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1857 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1858 else if (GAIM_BLIST_NODE_IS_GROUP(node))
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1859 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1860 group = (GaimGroup *)node;
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1861 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1862 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1863
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1864 if (gaim_gtk_parse_x_im_contact((const char *)sd->data, FALSE, &account,
7712
2823111061ba [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
1865 &protocol, &username, &alias))
7706
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1866 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1867 if (account == NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1868 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1869 gaim_notify_error(NULL, NULL,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1870 _("You are not currently signed on with an account that "
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1871 "can add that buddy."), NULL);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1872 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1873 else
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1874 {
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1875 gaim_blist_request_add_buddy(account, username,
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1876 (group ? group->name : NULL),
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1877 alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1878 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1879 }
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1880
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1881 if (username != NULL) g_free(username);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1882 if (protocol != NULL) g_free(protocol);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1883 if (alias != NULL) g_free(alias);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1884
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1885 if (path != NULL)
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1886 gtk_tree_path_free(path);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1887
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1888 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e6244f1a19a5 [gaim-migrate @ 8351]
Sean Egan <seanegan@gmail.com>
parents: 7693
diff changeset
1889 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1890 else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data)
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1891 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1892 gboolean result;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1893 GaimGroup *group = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1894 GtkTreePath *path = NULL;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1895 GtkTreeViewDropPosition position;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1896
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1897 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1898 x, y, &path, &position))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1899 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1900 GtkTreeIter iter;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1901 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1902 GValue val;
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1903
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1904 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1905 &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1906 val.g_type = 0;
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1907 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1908 &iter, NODE_COLUMN, &val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1909 node = g_value_get_pointer(&val);
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1910
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1911 if (GAIM_BLIST_NODE_IS_BUDDY(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1912 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1913 group = (GaimGroup *)node->parent->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1914 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1915 else if (GAIM_BLIST_NODE_IS_CHAT(node) ||
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1916 GAIM_BLIST_NODE_IS_CONTACT(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1917 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1918 group = (GaimGroup *)node->parent;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1919 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1920 else if (GAIM_BLIST_NODE_IS_GROUP(node))
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1921 {
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1922 group = (GaimGroup *)node;
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1923 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1924 }
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1925
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1926 result = parse_vcard((const gchar *)sd->data, group);
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1927
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1928 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
1929 } 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
1930 GtkTreePath *path = NULL;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1931 GtkTreeViewDropPosition position;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1932
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1933 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
1934 x, y, &path, &position))
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1935 {
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1936 GtkTreeIter iter;
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1937 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1938 GValue val;
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1939
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1940 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1941 &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
1942 val.g_type = 0;
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1943 gtk_tree_model_get_value (GTK_TREE_MODEL(gtkblist->treemodel),
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1944 &iter, NODE_COLUMN, &val);
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1945 node = g_value_get_pointer(&val);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1946
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1947 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
1948 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
1949 gaim_dnd_file_manage(sd, b->account, b->name);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1950 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1951 } else {
9aa0b6d11bbf [gaim-migrate @ 11364]
Sean Egan <seanegan@gmail.com>
parents: 10222
diff changeset
1952 gtk_drag_finish(dc, FALSE, FALSE, t);
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
1953 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
1954 }
8089
35db601609e3 [gaim-migrate @ 8788]
Sean Egan <seanegan@gmail.com>
parents: 8083
diff changeset
1955 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1956 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1957
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1958 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(GaimBlistNode *node,
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1959 gboolean scaled, gboolean greyed)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1960 {
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
1961 GdkPixbuf *buf, *ret = NULL;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1962 GdkPixbufLoader *loader;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1963 GaimBuddyIcon *icon;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1964 const guchar *data;
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11134
diff changeset
1965 gsize len;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1966 GaimBuddy *buddy = (GaimBuddy *)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1967
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1968 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1969 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1970 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1971 buddy = (GaimBuddy*)node;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1972 } else {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1973 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1974 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1975
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1976 #if 0
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1977 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1978 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1979 #endif
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1980
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1981 if (!(icon = gaim_buddy_get_icon(buddy)))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1982 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
1983 return NULL;
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1984
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1985 loader = gdk_pixbuf_loader_new();
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1986 data = gaim_buddy_icon_get_data(icon, &len);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1987 gdk_pixbuf_loader_write(loader, data, len, NULL);
12601
e63fb8e9f4ac [gaim-migrate @ 14935]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
1988 gdk_pixbuf_loader_close(loader, NULL);
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1989 buf = gdk_pixbuf_loader_get_pixbuf(loader);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1990 if (buf)
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1991 g_object_ref(G_OBJECT(buf));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1992 g_object_unref(G_OBJECT(loader));
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1993
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
1994 if (buf) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1995 GaimAccount *account = gaim_buddy_get_account(buddy);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1996 GaimPluginProtocolInfo *prpl_info = NULL;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1997 int orig_width, orig_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1998 int scale_width, scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
1999
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2000 if(account && account->gc)
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2001 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2002
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2003 if (greyed) {
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2004 GaimPresence *presence = gaim_buddy_get_presence(buddy);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2005 if (!GAIM_BUDDY_IS_ONLINE(buddy))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2006 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2007 if (gaim_presence_is_idle(presence))
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2008 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2009 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2010
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2011 /* 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
2012 * 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
2013 * purposes */
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2014 scale_width = orig_width = gdk_pixbuf_get_width(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2015 scale_height = orig_height = gdk_pixbuf_get_height(buf);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2016
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2017 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
2018
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2019 if (scaled) {
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2020 if(scale_height > scale_width) {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2021 scale_width = 30.0 * (double)scale_width / (double)scale_height;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2022 scale_height = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2023 } else {
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2024 scale_height = 30.0 * (double)scale_height / (double)scale_width;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2025 scale_width = 30;
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2026 }
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2027
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2028 ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 30, 30);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2029 gdk_pixbuf_fill(ret, 0x00000000);
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2030 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
2031 } else {
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2032 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
2033 }
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
2034 g_object_unref(G_OBJECT(buf));
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2035 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2036
10483
748aa3c6de36 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2037 return ret;
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2038 }
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2039
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2040 struct tooltip_data {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2041 PangoLayout *layout;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2042 GdkPixbuf *status_icon;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2043 GdkPixbuf *avatar;
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2044 int avatar_width;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2045 int width;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2046 int height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2047 };
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2048
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2049 static struct tooltip_data * create_tip_for_node(GaimBlistNode *node, gboolean full)
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2050 {
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2051 char *tooltip_text = NULL;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2052 struct tooltip_data *td = g_new0(struct tooltip_data, 1);
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2053
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2054 td->status_icon = gaim_gtk_blist_get_status_icon(node, GAIM_STATUS_ICON_LARGE);
12971
7bd4dbf26c00 [gaim-migrate @ 15324]
Richard Laager <rlaager@wiktel.com>
parents: 12970
diff changeset
2055 td->avatar = gaim_gtk_blist_get_buddy_icon(node, !full, FALSE);
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2056 tooltip_text = gaim_get_tooltip_text(node, full);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2057 td->layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL);
12940
b25f48c9f6d7 [gaim-migrate @ 15293]
Richard Laager <rlaager@wiktel.com>
parents: 12919
diff changeset
2058 pango_layout_set_markup(td->layout, tooltip_text, -1);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2059 pango_layout_set_wrap(td->layout, PANGO_WRAP_WORD);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2060 pango_layout_set_width(td->layout, 300000);
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
2061
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2062 pango_layout_get_size (td->layout, &td->width, &td->height);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2063 td->width = PANGO_PIXELS(td->width) + 38 + 8;
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2064 td->height = MAX(PANGO_PIXELS(td->height + 4) + 8, 38);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2065
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2066 if(td->avatar) {
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2067 td->avatar_width = gdk_pixbuf_get_width(td->avatar);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2068 td->width += td->avatar_width + 8;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2069 td->height = MAX(td->height, gdk_pixbuf_get_height(td->avatar) + 8);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2070 }
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2071
12649
773f694e83bf [gaim-migrate @ 14987]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12601
diff changeset
2072 g_free(tooltip_text);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2073 return td;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2074 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2075
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2076 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
2077 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2078 GtkStyle *style;
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2079 int current_height, max_width;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2080 GList *l;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2081
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2082 if(gtkblist->tooltipdata == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2083 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2084
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2085 style = gtkblist->tipwindow->style;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2086 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2087 NULL, gtkblist->tipwindow, "tooltip", 0, 0, -1, -1);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2088
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2089 max_width = 0;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2090 for(l = gtkblist->tooltipdata; l; l = l->next)
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2091 {
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2092 struct tooltip_data *td = l->data;
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2093 max_width = MAX(max_width, td->width);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2094 }
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2095
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2096 current_height = 4;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2097 for(l = gtkblist->tooltipdata; l; l = l->next)
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
2098 {
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2099 struct tooltip_data *td = l->data;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2100
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2101 #if GTK_CHECK_VERSION(2,2,0)
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2102 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2103 0, 0, 4, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2104 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2105 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2106 td->avatar, 0, 0, max_width - (td->avatar_width + 4), current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2107 #else
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2108 gdk_pixbuf_render_to_drawable(td->status_icon, GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0, 4, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2109 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2110 gdk_pixbuf_render_to_drawable(td->avatar,
11983
39f2aa4350d8 [gaim-migrate @ 14276]
Tim Ringenbach <marv@pidgin.im>
parents: 11924
diff changeset
2111 GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, 0, 0,
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2112 max_width - (td->avatar_width + 4),
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2113 current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2114 #endif
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2115
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2116 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
12519
e63a80be5227 [gaim-migrate @ 14831]
Sean Egan <seanegan@gmail.com>
parents: 12479
diff changeset
2117 NULL, gtkblist->tipwindow, "tooltip", 38 + 4, current_height, td->layout);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2118
11895
589f290eb8cd [gaim-migrate @ 14186]
Nathan Walp <nwalp@pidgin.im>
parents: 11894
diff changeset
2119 current_height += td->height;
589f290eb8cd [gaim-migrate @ 14186]
Nathan Walp <nwalp@pidgin.im>
parents: 11894
diff changeset
2120
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2121 if(l->next)
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2122 gtk_paint_hline(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, NULL, NULL, NULL, 4, max_width - 4, current_height-6);
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2123
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2124 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2125 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2126
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2127 static void gaim_gtk_blist_tooltip_destroy()
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2128 {
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2129 while(gtkblist->tooltipdata) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2130 struct tooltip_data *td = gtkblist->tooltipdata->data;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2131
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2132 if(td->avatar)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2133 g_object_unref(td->avatar);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2134 if(td->status_icon)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2135 g_object_unref(td->status_icon);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2136 g_object_unref(td->layout);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2137 g_free(td);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2138 gtkblist->tooltipdata = g_list_delete_link(gtkblist->tooltipdata, gtkblist->tooltipdata);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2139 }
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2140
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2141 if (gtkblist->tipwindow == NULL)
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2142 return;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2143
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2144 gtk_widget_destroy(gtkblist->tipwindow);
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2145 gtkblist->tipwindow = NULL;
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2146 }
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2147
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2148 static gboolean gaim_gtk_blist_expand_timeout(GtkWidget *tv)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2149 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2150 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2151 GtkTreeIter iter;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2152 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2153 GValue val;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2154 struct _gaim_gtk_blist_node *gtknode;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2155
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2156 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
2157 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2158 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2159 val.g_type = 0;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2160 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
2161 node = g_value_get_pointer(&val);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2162
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2163 if(!GAIM_BLIST_NODE_IS_CONTACT(node)) {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2164 gtk_tree_path_free(path);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2165 return FALSE;
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2166 }
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2167
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2168 gtknode = node->ui_data;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2169
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2170 if (!gtknode->contact_expanded) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2171 GtkTreeIter i;
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2172
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2173 gaim_gtk_blist_expand_contact_cb(NULL, node);
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2174
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2175 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
2176 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
2177 gtkblist->mouseover_contact = node;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2178 gtk_tree_path_down (path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2179 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
2180 GdkRectangle rect;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2181 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
2182 gtkblist->contact_rect.height += rect.height;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2183 gtk_tree_path_next(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2184 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2185 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2186 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2187 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2188 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2189
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2190 static gboolean buddy_is_displayable(GaimBuddy *buddy)
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2191 {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2192 struct _gaim_gtk_blist_node *gtknode;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2193
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2194 if(!buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2195 return FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2196
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2197 gtknode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2198
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2199 return (gaim_account_is_connected(buddy->account) &&
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2200 (gaim_presence_is_online(buddy->presence) ||
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2201 (gtknode && gtknode->recent_signonoff) ||
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2202 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies") ||
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2203 gaim_blist_node_get_bool((GaimBlistNode*)buddy, "show_offline")));
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2204 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2205
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2206 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2207 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2208 GtkTreePath *path;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2209 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2210 GaimBlistNode *node;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2211 GValue val;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2212 int scr_w, scr_h, w, h, x, y;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2213 #if GTK_CHECK_VERSION(2,2,0)
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2214 int mon_num;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2215 GdkScreen *screen = NULL;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2216 #endif
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2217 gboolean tooltip_top = FALSE;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2218 struct _gaim_gtk_blist_node *gtknode;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2219 GdkRectangle mon_size;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2220
11636
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2221 /*
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2222 * Attempt to free the previous tooltip. I have a feeling
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2223 * this is never needed... but just in case.
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2224 */
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2225 gaim_gtk_blist_tooltip_destroy();
2f7558b0c01b [gaim-migrate @ 13912]
Mark Doliner <mark@kingant.net>
parents: 11634
diff changeset
2226
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2227 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
2228 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2229 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2230 val.g_type = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2231 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
2232 node = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2233
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2234 gtk_tree_path_free(path);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
2235
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2236 gtkblist->tipwindow = gtk_window_new(GTK_WINDOW_POPUP);
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2237
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2238 if(GAIM_BLIST_NODE_IS_CHAT(node) || GAIM_BLIST_NODE_IS_BUDDY(node)) {
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2239 struct tooltip_data *td = create_tip_for_node(node, TRUE);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2240 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2241 w = td->width;
12941
586f2b04e0c5 [gaim-migrate @ 15294]
Richard Laager <rlaager@wiktel.com>
parents: 12940
diff changeset
2242 h = td->height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2243 } else if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2244 GaimBlistNode *child;
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2245 GaimBuddy *b = gaim_contact_get_priority_buddy((GaimContact *)node);
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2246 w = h = 0;
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2247 for(child = node->child; child; child = child->next)
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2248 {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2249 if(GAIM_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((GaimBuddy*)child)) {
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2250 struct tooltip_data *td = create_tip_for_node(child, (b == (GaimBuddy*)child));
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2251 if (b == (GaimBuddy *)child) {
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2252 gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td);
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2253 } else {
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2254 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
2255 }
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2256 w = MAX(w, td->width);
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2257 h += td->height;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2258 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2259 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2260 } else {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2261 gtk_widget_destroy(gtkblist->tipwindow);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2262 gtkblist->tipwindow = NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2263 return FALSE;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2264 }
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2265
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2266 if (gtkblist->tooltipdata == NULL) {
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2267 gtk_widget_destroy(gtkblist->tipwindow);
11892
31d3cdab1690 [gaim-migrate @ 14183]
Nathan Walp <nwalp@pidgin.im>
parents: 11890
diff changeset
2268 gtkblist->tipwindow = NULL;
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2269 return FALSE;
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2270 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2271
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2272 gtknode = node->ui_data;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2273
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2274 gtk_widget_set_app_paintable(gtkblist->tipwindow, TRUE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2275 gtk_window_set_resizable(GTK_WINDOW(gtkblist->tipwindow), FALSE);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2276 gtk_widget_set_name(gtkblist->tipwindow, "gtk-tooltips");
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2277 g_signal_connect(G_OBJECT(gtkblist->tipwindow), "expose_event",
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2278 G_CALLBACK(gaim_gtk_blist_paint_tip), NULL);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2279 gtk_widget_ensure_style (gtkblist->tipwindow);
7837
d20f729d3f18 [gaim-migrate @ 8490]
Nathan Walp <nwalp@pidgin.im>
parents: 7811
diff changeset
2280
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2281
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2282 #if GTK_CHECK_VERSION(2,2,0)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2283 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
2284 mon_num = gdk_screen_get_monitor_at_point(screen, x, y);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2285 gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size);
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2286
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2287 scr_w = mon_size.width + mon_size.x;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2288 scr_h = mon_size.height + mon_size.y;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2289 #else
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2290 scr_w = gdk_screen_width();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2291 scr_h = gdk_screen_height();
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2292 gdk_window_get_pointer(NULL, &x, &y, NULL);
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2293 mon_size.x = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2294 mon_size.y = 0;
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2295 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2296
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2297 #if GTK_CHECK_VERSION(2,2,0)
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2298 if (w > mon_size.width)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2299 w = mon_size.width - 10;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2300
10046
dcdda2857ca8 [gaim-migrate @ 11007]
Mark Doliner <mark@kingant.net>
parents: 10036
diff changeset
2301 if (h > mon_size.height)
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2302 h = mon_size.height - 10;
9869
348636e6ba89 [gaim-migrate @ 10748]
Mark Doliner <mark@kingant.net>
parents: 9834
diff changeset
2303 #endif
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2304
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2305 if (GTK_WIDGET_NO_WINDOW(gtkblist->window))
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2306 y+=gtkblist->window->allocation.y;
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2307
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2308 x -= ((w >> 1) + 4);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2309
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2310 if ((y + h + 4) > scr_h || tooltip_top)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2311 y = y - h - 5;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2312 else
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2313 y = y + 6;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2314
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2315 if (y < mon_size.y)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2316 y = mon_size.y;
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2317
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2318 if (y != mon_size.y) {
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2319 if ((x + w) > scr_w)
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2320 x -= (x + w + 5) - scr_w;
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2321 else if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2322 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2323 } else {
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2324 x -= (w / 2 + 10);
9773
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2325 if (x < mon_size.x)
09f18996c2ea [gaim-migrate @ 10641]
Mark Doliner <mark@kingant.net>
parents: 9770
diff changeset
2326 x = mon_size.x;
7719
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2327 }
853ef377a850 [gaim-migrate @ 8364]
Sean Egan <seanegan@gmail.com>
parents: 7712
diff changeset
2328
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2329 gtk_widget_set_size_request(gtkblist->tipwindow, w, h);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2330 gtk_window_move(GTK_WINDOW(gtkblist->tipwindow), x, y);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2331 gtk_widget_show(gtkblist->tipwindow);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2332
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2333 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2334 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2335
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2336 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
2337 gint x, gint y, guint time, gpointer user_data)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2338 {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2339 GtkTreePath *path;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2340 int delay;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2341
12679
b18738b03b35 [gaim-migrate @ 15022]
Mark Doliner <mark@kingant.net>
parents: 12656
diff changeset
2342 /*
b18738b03b35 [gaim-migrate @ 15022]
Mark Doliner <mark@kingant.net>
parents: 12656
diff changeset
2343 * When dragging a buddy into a contact, this is the delay before
b18738b03b35 [gaim-migrate @ 15022]
Mark Doliner <mark@kingant.net>
parents: 12656
diff changeset
2344 * the contact auto-expands.
b18738b03b35 [gaim-migrate @ 15022]
Mark Doliner <mark@kingant.net>
parents: 12656
diff changeset
2345 */
b18738b03b35 [gaim-migrate @ 15022]
Mark Doliner <mark@kingant.net>
parents: 12656
diff changeset
2346 delay = 900;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2347
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2348 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2349 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
2350 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2351 /* 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
2352 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2353 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2355 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
2356 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
2357
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2358 if (path)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2359 gtk_tree_path_free(path);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2360 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
2361
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2362 if (gtkblist->mouseover_contact) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2363 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
2364 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2365 gtkblist->mouseover_contact = NULL;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2366 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2367 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2368
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2369 return FALSE;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2370 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2371
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2372 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
2373 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2374 GtkTreePath *path;
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2375 int delay;
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2376
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2377 delay = gaim_prefs_get_int("/gaim/gtk/blist/tooltip_delay");
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2378
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2379 if (delay == 0)
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2380 return FALSE;
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2381
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2382 if (gtkblist->timeout) {
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2383 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
2384 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2385 /* 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
2386 gaim_gtk_blist_tooltip_destroy();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2387 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2388 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2389
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2390 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
2391 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
2392
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2393 if (path)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2394 gtk_tree_path_free(path);
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2395 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
2396
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2397 if (gtkblist->mouseover_contact) {
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2398 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
2399 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2400 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2401 }
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2402 }
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2403
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2404 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2405 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2406
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2407 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
2408 {
8083
08d993c1d843 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
2409
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2410 if (gtkblist->timeout) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2411 g_source_remove(gtkblist->timeout);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2412 gtkblist->timeout = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2413 }
10382
9f28196ed769 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2414
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2415 if (gtkblist->drag_timeout) {
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2416 g_source_remove(gtkblist->drag_timeout);
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2417 gtkblist->drag_timeout = 0;
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2418 }
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
2419
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
2420 gaim_gtk_blist_tooltip_destroy();
7720
5fe29daf52d7 [gaim-migrate @ 8365]
Sean Egan <seanegan@gmail.com>
parents: 7719
diff changeset
2421
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2422 if (gtkblist->mouseover_contact &&
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
2423 !((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
2424 (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
2425 gaim_gtk_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2426 gtkblist->mouseover_contact = NULL;
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
2427 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2428 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2429
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2430 static void
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2431 toggle_debug(void)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2432 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2433 gaim_prefs_set_bool("/gaim/gtk/debug/enabled",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2434 !gaim_prefs_get_bool("/gaim/gtk/debug/enabled"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2435 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2436
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2437
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2438 /***************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2439 * Crap *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2440 ***************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2441 static GtkItemFactoryEntry blist_menu[] =
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2442 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2443 /* Buddies menu */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2444 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL },
9714
2273790bb518 [gaim-migrate @ 10575]
Mark Doliner <mark@kingant.net>
parents: 9713
diff changeset
2445 { 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
2446 { 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
2447 { N_("/Buddies/Get User _Info..."), "<CTL>I", gaim_gtkdialogs_info, 0, "<StockItem>", GAIM_STOCK_INFO },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2448 { N_("/Buddies/View User _Log..."), "<CTL>L", gaim_gtkdialogs_log, 0, "<StockItem>", GAIM_STOCK_LOG },
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2449 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL },
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2450 { N_("/Buddies/Show _Offline Buddies"), NULL, gaim_gtk_blist_edit_mode_cb, 1, "<CheckItem>", NULL },
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2451 { N_("/Buddies/Show _Empty Groups"), NULL, gaim_gtk_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL },
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2452 { N_("/Buddies/Show Buddy _Details"), NULL, gaim_gtk_blist_buddy_details_cb, 1, "<CheckItem>", NULL },
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
2453 { N_("/Buddies/Show Idle _Times"), NULL, gaim_gtk_blist_show_idle_time_cb, 1, "<CheckItem>", NULL },
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2454 { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>", NULL },
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2455 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL },
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
2456 { 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
2457 { 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
2458 { N_("/Buddies/Add _Group..."), NULL, gaim_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
12799
6234099a4b37 [gaim-migrate @ 15146]
Mark Doliner <mark@kingant.net>
parents: 12797
diff changeset
2459 { "/Buddies/sep3", NULL, NULL, 0, "<Separator>", NULL },
12300
6487e68dcef9 [gaim-migrate @ 14604]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12298
diff changeset
2460 { N_("/Buddies/_Quit"), "<CTL>Q", gaim_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
6487e68dcef9 [gaim-migrate @ 14604]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12298
diff changeset
2461
6487e68dcef9 [gaim-migrate @ 14604]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12298
diff changeset
2462 /* Accounts menu */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2463 { N_("/_Accounts"), NULL, NULL, 0, "<Branch>", NULL },
12348
4f7797a3024b [gaim-migrate @ 14652]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12341
diff changeset
2464 { N_("/Accounts/Add\\/Edit"), "<CTL>A", gaim_gtk_accounts_window_show, 0, "<StockItem>", GAIM_STOCK_ACCOUNTS },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2465
8470
9949b752d1ab [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2466 /* Tools */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2467 { N_("/_Tools"), NULL, NULL, 0, "<Branch>", NULL },
12191
bc2b9f925979 [gaim-migrate @ 14493]
Richard Laager <rlaager@wiktel.com>
parents: 12179
diff changeset
2468 { N_("/Tools/Buddy _Pounces"), NULL, gaim_gtk_pounces_manager_show, 0, "<StockItem>", GAIM_STOCK_POUNCE },
12163
f6f08fd1841a [gaim-migrate @ 14464]
Richard Laager <rlaager@wiktel.com>
parents: 12136
diff changeset
2469 { N_("/Tools/Plu_gins"), "<CTL>U", gaim_gtk_plugin_dialog_show, 0, "<StockItem>", GAIM_STOCK_PLUGIN },
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
2470 { N_("/Tools/Pr_eferences"), "<CTL>P", gaim_gtk_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
10694
06f68443e6e5 [gaim-migrate @ 12246]
Mark Doliner <mark@kingant.net>
parents: 10664
diff changeset
2471 { N_("/Tools/Pr_ivacy"), NULL, gaim_gtk_privacy_dialog_show, 0, "<StockItem>", GTK_STOCK_DIALOG_ERROR },
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2472 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL },
10019
8cc6f0bfa215 [gaim-migrate @ 10943]
Luke Schierer <lschiere@pidgin.im>
parents: 10018
diff changeset
2473 { 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
2474 { N_("/Tools/R_oom List"), NULL, gaim_gtk_roomlist_dialog_show, 0, "<StockItem>", GTK_STOCK_INDEX },
12334
2823118073fa [gaim-migrate @ 14638]
Mark Doliner <mark@kingant.net>
parents: 12333
diff changeset
2475 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 0, "<StockItem>", GAIM_STOCK_LOG },
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2476 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL },
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2477 { N_("/Tools/Mute _Sounds"), "<CTL>S", gaim_gtk_blist_mute_sounds_cb, 0, "<CheckItem>", NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2478
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2479 /* Help */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
2480 { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL },
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2481 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
2482 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<StockItem>", GAIM_STOCK_DEBUG },
9753
60705fd4f411 [gaim-migrate @ 10620]
Mark Doliner <mark@kingant.net>
parents: 9749
diff changeset
2483 { 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
2484 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2485
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2486 /*********************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2487 * Private Utility functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2488 *********************************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2489
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2490 static char *gaim_get_tooltip_text(GaimBlistNode *node, gboolean full)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2491 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2492 GString *str = g_string_new("");
5237
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2493 GaimPlugin *prpl;
757d680f923d [gaim-migrate @ 5607]
Nathan Walp <nwalp@pidgin.im>
parents: 5234
diff changeset
2494 GaimPluginProtocolInfo *prpl_info = NULL;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2495 char *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2496
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2497 if (GAIM_BLIST_NODE_IS_CHAT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2498 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2499 GaimChat *chat;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2500 GList *cur;
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2501 struct proto_chat_entry *pce;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2502 char *name, *value;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2503
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2504 chat = (GaimChat *)node;
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2505 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
2506 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2507
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2508 tmp = g_markup_escape_text(gaim_chat_get_name(chat), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2509 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
2510 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2511
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2512 if (g_list_length(gaim_connections_get_all()) > 1)
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 tmp = g_markup_escape_text(chat->account->username, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2515 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2516 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2517 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2518
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
2519 if (prpl_info->chat_info != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2520 cur = prpl_info->chat_info(chat->account->gc);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2521 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2522 cur = NULL;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2523
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2524 while (cur != NULL)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2525 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2526 pce = cur->data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2527
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2528 if (!pce->secret && (!pce->required &&
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2529 g_hash_table_lookup(chat->components, pce->identifier) == NULL))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2530 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2531 tmp = gaim_text_strip_mnemonic(pce->label);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2532 name = g_markup_escape_text(tmp, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2533 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2534 value = g_markup_escape_text(g_hash_table_lookup(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2535 chat->components, pce->identifier), -1);
10924
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2536 g_string_append_printf(str, "\n<b>%s</b> %s",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2537 name ? name : "",
7a82d86ab44a [gaim-migrate @ 12695]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10918
diff changeset
2538 value ? value : "");
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2539 g_free(name);
8020
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2540 g_free(value);
35c2526dba16 [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
2541 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2542
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2543 g_free(pce);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2544 cur = g_list_remove(cur, pce);
5274
ad299f62b9b6 [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
2545 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2546 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2547 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
2548 {
12942
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2549 /* NOTE: THIS FUNCTION IS NO LONGER CALLED FOR CONTACTS
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2550 * See create_tip_for_node(). */
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2551
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2552 GaimContact *c;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2553 GaimBuddy *b;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2554 GaimPresence *presence;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2555 char *tmp;
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2556 time_t idle_secs, signon;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2557
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2558 if (GAIM_BLIST_NODE_IS_CONTACT(node))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2559 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2560 c = (GaimContact *)node;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2561 b = gaim_contact_get_priority_buddy(c);
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 else
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2564 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2565 b = (GaimBuddy *)node;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2566 c = gaim_buddy_get_contact(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2567 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2568
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2569 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
2570 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2571
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2572 presence = gaim_buddy_get_presence(b);
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 /* Buddy Name */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2575 tmp = g_markup_escape_text(gaim_buddy_get_name(b), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2576 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
2577 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2578
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2579 /* Account */
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2580 if (full && g_list_length(gaim_connections_get_all()) > 1)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2581 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2582 tmp = g_markup_escape_text(gaim_account_get_username(
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2583 gaim_buddy_get_account(b)), -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2584 g_string_append_printf(str, _("\n<b>Account:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2585 g_free(tmp);
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
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2588 /* Alias */
12942
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2589 /* If there's not a contact alias, the node is being displayed with
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2590 * this alias, so there's no point in showing it in the tooltip. */
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2591 if (full && b->alias != NULL && b->alias[0] != '\0' &&
13217
502a4de3365c [gaim-migrate @ 15581]
Richard Laager <rlaager@wiktel.com>
parents: 13201
diff changeset
2592 (c->alias != NULL && c->alias[0] != '\0') &&
502a4de3365c [gaim-migrate @ 15581]
Richard Laager <rlaager@wiktel.com>
parents: 13201
diff changeset
2593 strcmp(c->alias, b->alias) != 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2594 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2595 tmp = g_markup_escape_text(b->alias, -1);
12942
432894b3bdad [gaim-migrate @ 15295]
Richard Laager <rlaager@wiktel.com>
parents: 12941
diff changeset
2596 g_string_append_printf(str, _("\n<b>Buddy Alias:</b> %s"), tmp);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2597 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2598 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2599
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2600 /* Nickname/Server Alias */
12966
03679a4db953 [gaim-migrate @ 15319]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2601 /* I'd like to only show this if there's a contact or buddy
03679a4db953 [gaim-migrate @ 15319]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2602 * alias, but many people on MSN set long nicknames, which
03679a4db953 [gaim-migrate @ 15319]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2603 * get ellipsized, so the only way to see the whole thing is
03679a4db953 [gaim-migrate @ 15319]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2604 * to look at the tooltip. */
03679a4db953 [gaim-migrate @ 15319]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2605 if (full && b->server_alias != NULL && b->server_alias[0] != '\0')
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2606 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2607 tmp = g_markup_escape_text(b->server_alias, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2608 g_string_append_printf(str, _("\n<b>Nickname:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2609 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2610 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2611
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2612 /* Logged In */
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2613 signon = gaim_presence_get_login_time(presence);
12530
74f449e10d88 [gaim-migrate @ 14843]
Nathan Walp <nwalp@pidgin.im>
parents: 12522
diff changeset
2614 if (full && GAIM_BUDDY_IS_ONLINE(b) && signon > 0)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2615 {
10567
54f7939df8e3 [gaim-migrate @ 11951]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10544
diff changeset
2616 tmp = gaim_str_seconds_to_string(time(NULL) - signon);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2617 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
2618 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2619 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2620
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2621 /* Idle */
12979
78f8ef7f0f6d [gaim-migrate @ 15332]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12971
diff changeset
2622 if (gaim_presence_is_idle(presence))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2623 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2624 idle_secs = gaim_presence_get_idle_time(presence);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2625 if (idle_secs > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2626 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2627 tmp = gaim_str_seconds_to_string(time(NULL) - idle_secs);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2628 g_string_append_printf(str, _("\n<b>Idle:</b> %s"), tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2629 g_free(tmp);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2630 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2631 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2632
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2633 /* Last Seen */
12883
d486bb706e82 [gaim-migrate @ 15235]
Richard Laager <rlaager@wiktel.com>
parents: 12849
diff changeset
2634 if (full && !GAIM_BUDDY_IS_ONLINE(b))
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2635 {
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2636 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode *)c)->ui_data;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2637 GaimBlistNode *bnode;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2638 int lastseen = 0;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2639
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2640 if (!gtknode->contact_expanded || GAIM_BLIST_NODE_IS_CONTACT(node))
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2641 {
11437
1c20849fc716 [gaim-migrate @ 13674]
Richard Laager <rlaager@wiktel.com>
parents: 11436
diff changeset
2642 /* 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
2643 * an expanded contact itself so we show the most recent
11023
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2644 * (largest) last_seen time for any of the buddies under
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2645 * the contact. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2646 for (bnode = ((GaimBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2647 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2648 int value = gaim_blist_node_get_int(bnode, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2649 if (value > lastseen)
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2650 lastseen = value;
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2651 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2652 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2653 else
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2654 {
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2655 /* We're dealing with a buddy under an expanded contact,
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2656 * so we show the last_seen time for the buddy. */
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2657 lastseen = gaim_blist_node_get_int(&b->node, "last_seen");
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2658 }
9a99b0815459 [gaim-migrate @ 12895]
Mark Doliner <mark@kingant.net>
parents: 11018
diff changeset
2659
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2660 if (lastseen > 0)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2661 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2662 tmp = gaim_str_seconds_to_string(time(NULL) - lastseen);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2663 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
2664 g_free(tmp);
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2665 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2666 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2667
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2668
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2669 /* Offline? */
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12966
diff changeset
2670 /* FIXME: Why is this status special-cased by the core? -- rlaager */
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2671 if (!GAIM_BUDDY_IS_ONLINE(b)) {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2672 g_string_append_printf(str, _("\n<b>Status:</b> Offline"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2673 }
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2674
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10968
diff changeset
2675 if (prpl_info && prpl_info->tooltip_text)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2676 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2677 /* Additional text from the PRPL */
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12966
diff changeset
2678 prpl_info->tooltip_text(b, str, full);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2679 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2680
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2681 /* These are Easter Eggs. Patches to remove them will be rejected. */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2682 if (!g_ascii_strcasecmp(b->name, "robflynn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2683 g_string_append(str, _("\n<b>Description:</b> Spooky"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2684 if (!g_ascii_strcasecmp(b->name, "seanegn"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2685 g_string_append(str, _("\n<b>Status:</b> Awesome"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2686 if (!g_ascii_strcasecmp(b->name, "chipx86"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2687 g_string_append(str, _("\n<b>Status:</b> Rockin'"));
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2688 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2689
8824
f08245ed03aa [gaim-migrate @ 9587]
Sean Egan <seanegan@gmail.com>
parents: 8823
diff changeset
2690 gaim_signal_emit(gaim_gtk_blist_get_handle(),
12713
d7043c3c793d [gaim-migrate @ 15057]
Richard Laager <rlaager@wiktel.com>
parents: 12679
diff changeset
2691 "drawing-tooltip", node, str, full);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2692
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
2693 return g_string_free(str, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2694 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2695
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2696 struct _emblem_data {
9954
a9fb4493ae22 [gaim-migrate @ 10851]
Nathan Walp <nwalp@pidgin.im>
parents: 9949
diff changeset
2697 const char *filename;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2698 int x;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2699 int y;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2700 };
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2701
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2702 GdkPixbuf *
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2703 gaim_gtk_blist_get_status_icon(GaimBlistNode *node, GaimStatusIconSize size)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2704 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2705 GdkPixbuf *scale, *status = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2706 int i, scalesize = 30;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2707 char *filename;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2708 const char *protoname = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2709 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2710 struct _gaim_gtk_blist_node *gtkbuddynode = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2711 struct _emblem_data emblems[4] = {{NULL, 15, 15}, {NULL, 0, 15},
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2712 {NULL, 0, 0}, {NULL, 15, 0}};
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2713 GaimPresence *presence = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2714 GaimBuddy *buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2715 GaimChat *chat = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2716
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2717 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2718 if(!gtknode->contact_expanded) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2719 buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2720 gtkbuddynode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2721 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2722 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2723 buddy = (GaimBuddy*)node;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
2724 gtkbuddynode = node->ui_data;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2725 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2726 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2727 } else {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2728 return NULL;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2729 }
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2730
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2731 if(buddy || chat) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2732 GaimAccount *account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2733 GaimPlugin *prpl;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2734 GaimPluginProtocolInfo *prpl_info;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2735
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2736 if(buddy)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2737 account = buddy->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2738 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2739 account = chat->account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2740
7956
1b8261f374ea [gaim-migrate @ 8631]
Nathan Walp <nwalp@pidgin.im>
parents: 7950
diff changeset
2741 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2742 if(!prpl)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2743 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2744
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2745 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2746
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2747 if(prpl_info && prpl_info->list_icon) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2748 protoname = prpl_info->list_icon(account, buddy);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2749 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2750 if(prpl_info && prpl_info->list_emblems && buddy) {
11924
ced9410eeb73 [gaim-migrate @ 14215]
Mark Doliner <mark@kingant.net>
parents: 11923
diff changeset
2751 if(gtknode && !gtknode->recent_signonoff)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2752 prpl_info->list_emblems(buddy, &emblems[0].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2753 &emblems[1].filename, &emblems[2].filename,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2754 &emblems[3].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2755 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2756 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2757
12744
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2758 if(buddy) {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2759 GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2760 gaim_buddy_get_name(buddy),
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2761 gaim_buddy_get_account(buddy));
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2762 if(conv != NULL) {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2763 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION(conv);
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2764 if(gtkconv != NULL && gaim_gtkconv_is_hidden(gtkconv)) {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2765 /* add pending emblem */
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2766 if(size == GAIM_STATUS_ICON_SMALL) {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2767 emblems[0].filename="pending";
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2768 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2769 else {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2770 emblems[3].filename=emblems[2].filename;
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2771 emblems[2].filename="pending";
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2772 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2773 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2774 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2775 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
2776
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2777 if(size == GAIM_STATUS_ICON_SMALL) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2778 scalesize = 15;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2779 /* So that only the se icon will composite */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2780 emblems[1].filename = emblems[2].filename = emblems[3].filename = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2781 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2782
11917
5d9172e67615 [gaim-migrate @ 14208]
Nathan Walp <nwalp@pidgin.im>
parents: 11915
diff changeset
2783 if(buddy && GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2784 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "login.png", NULL);
11917
5d9172e67615 [gaim-migrate @ 14208]
Nathan Walp <nwalp@pidgin.im>
parents: 11915
diff changeset
2785 } else if(buddy && !GAIM_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2786 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
2787 } else if(buddy || chat) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2788 char *image = g_strdup_printf("%s.png", protoname);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2789 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2790 g_free(image);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2791 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2792 /* gaim dude */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2793 filename = g_build_filename(DATADIR, "pixmaps", "gaim.png", NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2794 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2795
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2796 status = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2797 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2798
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2799 if(!status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2800 return NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2801
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2802 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2803 GDK_INTERP_BILINEAR);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2804 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2805
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2806 for(i=0; i<4; i++) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2807 if(emblems[i].filename) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2808 GdkPixbuf *emblem;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2809 char *image = g_strdup_printf("%s.png", emblems[i].filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2810 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2811 g_free(image);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2812 emblem = gdk_pixbuf_new_from_file(filename, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2813 g_free(filename);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2814 if(emblem) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2815 if(i == 0 && size == GAIM_STATUS_ICON_SMALL) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2816 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2817 scale, 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2818 10, 10,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2819 5, 5,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2820 .6, .6,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2821 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2822 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2823 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2824 gdk_pixbuf_composite(emblem,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2825 scale, emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2826 15, 15,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2827 emblems[i].x, emblems[i].y,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2828 1, 1,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2829 GDK_INTERP_BILINEAR,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2830 255);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2831 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2832 g_object_unref(emblem);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2833 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2834 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2835 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2836
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2837 if(buddy) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2838 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2839
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2840 if (!GAIM_BUDDY_IS_ONLINE(buddy))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2841 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE);
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2842 else if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2843 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2844 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.25, FALSE);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2845 }
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2846
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2847 if (!gaim_privacy_check(buddy->account, gaim_buddy_get_name(buddy)))
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2848 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2849 GdkPixbuf *emblem;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2850 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
2851
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2852 emblem = gdk_pixbuf_new_from_file(filename, NULL);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2853 g_free(filename);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2854
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2855 if (emblem)
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2856 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2857 gdk_pixbuf_composite(emblem, scale,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2858 0, 0, scalesize, scalesize,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2859 0, 0,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2860 (double)scalesize / gdk_pixbuf_get_width(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2861 (double)scalesize / gdk_pixbuf_get_height(emblem),
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2862 GDK_INTERP_BILINEAR,
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2863 224);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2864 g_object_unref(emblem);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2865 }
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11059
diff changeset
2866 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2867 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2868
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2869 return scale;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2870 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2871
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2872 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
2873 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2874 const char *name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2875 char *esc, *text = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2876 GaimPlugin *prpl;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2877 GaimPluginProtocolInfo *prpl_info = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2878 GaimContact *contact;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2879 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2880 struct _gaim_gtk_blist_node *gtkcontactnode = NULL;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
2881 char *idletime = NULL, *statustext = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2882 time_t t;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2883 /* XXX Good luck cleaning up this crap */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2884
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2885 contact = (GaimContact*)((GaimBlistNode*)b)->parent;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2886 if(contact)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2887 gtkcontactnode = ((GaimBlistNode*)contact)->ui_data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2888
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2889 if(gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2890 name = contact->alias;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2891 else
9620
c001be3c330e [gaim-migrate @ 10464]
Mark Doliner <mark@kingant.net>
parents: 9606
diff changeset
2892 name = gaim_buddy_get_alias(b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2893 esc = g_markup_escape_text(name, strlen(name));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2894
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2895 presence = gaim_buddy_get_presence(b);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2896
13034
615c84e94745 [gaim-migrate @ 15392]
Richard Laager <rlaager@wiktel.com>
parents: 13030
diff changeset
2897 if (!gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
615c84e94745 [gaim-migrate @ 15392]
Richard Laager <rlaager@wiktel.com>
parents: 13030
diff changeset
2898 {
13038
4005ad2b3ca9 [gaim-migrate @ 15397]
Richard Laager <rlaager@wiktel.com>
parents: 13034
diff changeset
2899 if (!selected && gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2900 {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2901 text = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
2902 dim_grey(), esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2903 g_free(esc);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2904 return text;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2905 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
2906 else
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2907 return esc;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2908 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2909
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2910 prpl = gaim_find_prpl(gaim_account_get_protocol_id(b->account));
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2911
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2912 if (prpl != NULL)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2913 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2914
8122
36674144c510 [gaim-migrate @ 8826]
Christian Hammond <chipx86@chipx86.com>
parents: 8113
diff changeset
2915 if (prpl_info && prpl_info->status_text && b->account->gc) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2916 char *tmp = prpl_info->status_text(b);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2917 const char *end;
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 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2920 char *new = g_strndup(tmp,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2921 g_utf8_pointer_to_offset(tmp, end));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2922 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2923 tmp = new;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2924 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2925
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2926 #if !GTK_CHECK_VERSION(2,6,0)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2927 if(tmp) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2928 char buf[32];
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2929 char *c = tmp;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2930 int length = 0, vis=0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2931 gboolean inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2932 g_strdelimit(tmp, "\n", ' ');
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11917
diff changeset
2933 gaim_str_strip_char(tmp, '\r');
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2934
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2935 while(*c && vis < 20) {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2936 if(*c == '&')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2937 inside = TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2938 else if(*c == ';')
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2939 inside = FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2940 if(!inside)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2941 vis++;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2942 c = g_utf8_next_char(c); /* this is fun */
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2943 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2944
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2945 length = c - tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
2946
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2947 if(vis == 20)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2948 g_snprintf(buf, sizeof(buf), "%%.%ds...", length);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2949 else
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2950 g_snprintf(buf, sizeof(buf), "%%s ");
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2951
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2952 statustext = g_strdup_printf(buf, tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2953
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2954 g_free(tmp);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2955 }
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2956 #else
13790
e744943e749c [gaim-migrate @ 16202]
Richard Laager <rlaager@wiktel.com>
parents: 13766
diff changeset
2957 if(tmp) {
12437
92df64b6985b [gaim-migrate @ 14744]
Nathan Walp <nwalp@pidgin.im>
parents: 12436
diff changeset
2958 g_strdelimit(tmp, "\n", ' ');
13790
e744943e749c [gaim-migrate @ 16202]
Richard Laager <rlaager@wiktel.com>
parents: 13766
diff changeset
2959 gaim_str_strip_char(tmp, '\r');
e744943e749c [gaim-migrate @ 16202]
Richard Laager <rlaager@wiktel.com>
parents: 13766
diff changeset
2960 }
10288
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2961 statustext = tmp;
627b081e9617 [gaim-migrate @ 11462]
Nathan Walp <nwalp@pidgin.im>
parents: 10287
diff changeset
2962 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2963 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2964
13034
615c84e94745 [gaim-migrate @ 15392]
Richard Laager <rlaager@wiktel.com>
parents: 13030
diff changeset
2965 if(!gaim_presence_is_online(presence) && !statustext)
615c84e94745 [gaim-migrate @ 15392]
Richard Laager <rlaager@wiktel.com>
parents: 13030
diff changeset
2966 statustext = g_strdup(_("Offline"));
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2967 else if (!statustext)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2968 text = g_strdup(esc);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2969
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2970 if (gaim_presence_is_idle(presence)) {
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2971 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time")) {
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2972 time_t idle_secs = gaim_presence_get_idle_time(presence);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2973
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2974 if (idle_secs > 0) {
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2975 int ihrs, imin;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2976
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2977 time(&t);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2978 ihrs = (t - idle_secs) / 3600;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2979 imin = ((t - idle_secs) / 60) % 60;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2980
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2981 if (ihrs)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2982 idletime = g_strdup_printf(_("Idle %dh %02dm"), ihrs, imin);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2983 else
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2984 idletime = g_strdup_printf(_("Idle %dm"), imin);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2985 }
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2986 else
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2987 idletime = g_strdup(_("Idle"));
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2988
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2989 if (!selected)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2990 text = g_strdup_printf("<span color='%s'>%s</span>\n"
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2991 "<span color='%s' size='smaller'>%s%s%s</span>",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2992 dim_grey(), esc, dim_grey(),
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2993 idletime != NULL ? idletime : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2994 (idletime != NULL && statustext != NULL) ? " - " : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2995 statustext != NULL ? statustext : "");
13034
615c84e94745 [gaim-migrate @ 15392]
Richard Laager <rlaager@wiktel.com>
parents: 13030
diff changeset
2996 }
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2997 else if (!selected && !statustext) /* We handle selected text later */
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2998 text = g_strdup_printf("<span color='%s'>%s</span>", dim_grey(), esc);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
2999 else if (!selected && !text)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3000 text = g_strdup_printf("<span color='%s'>%s</span>\n"
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3001 "<span color='%s' size='smaller'>%s%s%s</span>",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3002 dim_grey(), esc, dim_grey(),
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3003 idletime != NULL ? idletime : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3004 (idletime != NULL && statustext != NULL) ? " - " : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3005 statustext != NULL ? statustext : "");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3006 }
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3007
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3008 /* Not idle and not selected */
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3009 else if (!selected && !text)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3010 {
13201
6ff5271afedc [gaim-migrate @ 15564]
Richard Laager <rlaager@wiktel.com>
parents: 13196
diff changeset
3011 text = g_strdup_printf("%s\n"
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3012 "<span color='%s' size='smaller'>%s%s%s</span>",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3013 esc, dim_grey(),
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3014 idletime != NULL ? idletime : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3015 (idletime != NULL && statustext != NULL) ? " - " : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3016 statustext != NULL ? statustext : "");
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3017 }
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3018
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3019 /* It is selected. */
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3020 if ((selected && !text) || (selected && idletime))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3021 text = g_strdup_printf("%s\n"
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3022 "<span size='smaller'>%s%s%s</span>",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3023 esc,
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3024 idletime != NULL ? idletime : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3025 (idletime != NULL && statustext != NULL) ? " - " : "",
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3026 statustext != NULL ? statustext : "");
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3027
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3028 g_free(idletime);
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3029 g_free(statustext);
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3030 g_free(esc);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3031
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3032 return text;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3033 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3034
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3035 static void gaim_gtk_blist_restore_position()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3036 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3037 int blist_x, blist_y, blist_width, blist_height;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3038
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3039 blist_width = gaim_prefs_get_int("/gaim/gtk/blist/width");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3040
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3041 /* 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
3042 * position is sane... */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3043 if (gtkblist && gtkblist->window &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3044 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3045
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3046 blist_x = gaim_prefs_get_int("/gaim/gtk/blist/x");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3047 blist_y = gaim_prefs_get_int("/gaim/gtk/blist/y");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3048 blist_height = gaim_prefs_get_int("/gaim/gtk/blist/height");
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3049
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3050 /* ...check position is on screen... */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3051 if (blist_x >= gdk_screen_width())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3052 blist_x = gdk_screen_width() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3053 else if (blist_x + blist_width < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3054 blist_x = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3055
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3056 if (blist_y >= gdk_screen_height())
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3057 blist_y = gdk_screen_height() - 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3058 else if (blist_y + blist_height < 0)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3059 blist_y = 100;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3060
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3061 /* ...and move it back. */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3062 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3063 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
12279
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
3064 if (gaim_prefs_get_bool("/gaim/gtk/blist/list_maximized"))
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
3065 gtk_window_maximize(GTK_WINDOW(gtkblist->window));
5228
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 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3068
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3069 static gboolean gaim_gtk_blist_refresh_timer(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3070 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3071 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3072
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3073 if (gtk_blist_obscured || !GTK_WIDGET_VISIBLE(gtkblist->window))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3074 return TRUE;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3075
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3076 for(gnode = list->root; gnode; gnode = gnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3077 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3078 continue;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3079 for(cnode = gnode->child; cnode; cnode = cnode->next) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3080 if(GAIM_BLIST_NODE_IS_CONTACT(cnode)) {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3081 GaimBuddy *buddy;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3082
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
3083 buddy = gaim_contact_get_priority_buddy((GaimContact*)cnode);
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3084
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3085 if (buddy &&
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
3086 gaim_presence_is_idle(gaim_buddy_get_presence(buddy)))
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3087 gaim_gtk_blist_update_contact(list, (GaimBlistNode*)buddy);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3088 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3089 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3090 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3091
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3092 /* keep on going */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3093 return TRUE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3094 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3095
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3096 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
3097 {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3098 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
3099 GtkTreeIter iter;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3100
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3101 if (!gtknode || !gtknode->row || !gtkblist)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3102 return;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3103
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3104 if(gtkblist->selected_node == node)
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3105 gtkblist->selected_node = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3106
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3107 if (get_iter_from_node(node, &iter)) {
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3108 gtk_tree_store_remove(gtkblist->treemodel, &iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3109 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
3110 || GAIM_BLIST_NODE_IS_CHAT(node)) {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3111 gaim_gtk_blist_update(list, node->parent);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3112 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3113 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3114 gtk_tree_row_reference_free(gtknode->row);
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3115 gtknode->row = NULL;
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3116 }
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3117
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3118 static const char *require_connection[] =
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3119 {
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3120 N_("/Buddies/New Instant Message..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3121 N_("/Buddies/Join a Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3122 N_("/Buddies/Get User Info..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3123 N_("/Buddies/Add Buddy..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3124 N_("/Buddies/Add Chat..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3125 N_("/Buddies/Add Group..."),
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3126 };
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3127
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3128 static const int require_connection_size = sizeof(require_connection)
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3129 / sizeof(*require_connection);
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3130
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3131 /**
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3132 * Rebuild dynamic menus and make menu items sensitive/insensitive
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3133 * where appropriate.
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3134 */
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3135 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3136 update_menu_bar(GaimGtkBuddyList *gtkblist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3137 {
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3138 GtkWidget *widget;
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3139 gboolean sensitive;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3140 int i;
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3141
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3142 g_return_if_fail(gtkblist != NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3143
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
3144 gaim_gtk_blist_update_accounts_menu();
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3145
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3146 sensitive = (gaim_connections_get_all() != NULL);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3147
10357
6bd4921bb85e [gaim-migrate @ 11575]
Mark Doliner <mark@kingant.net>
parents: 10354
diff changeset
3148 for (i = 0; i < require_connection_size; i++)
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3149 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3150 widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3151 gtk_widget_set_sensitive(widget, sensitive);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3152 }
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3153
8940
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3154 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
3155 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
b875f5d57b81 [gaim-migrate @ 9710]
Mark Doliner <mark@kingant.net>
parents: 8939
diff changeset
3156
11988
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3157 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Add Chat..."));
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3158 gtk_widget_set_sensitive(widget, gaim_gtk_blist_joinchat_is_showable());
9ccbd9f8e8c6 [gaim-migrate @ 14281]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11986
diff changeset
3159
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3160 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Buddy Pounces"));
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3161 gtk_widget_set_sensitive(widget, (gaim_connections_get_all() != NULL));
8938
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3162
88ec59dec95a [gaim-migrate @ 9708]
Mark Doliner <mark@kingant.net>
parents: 8937
diff changeset
3163 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
13001
4bbd39576c52 [gaim-migrate @ 15354]
Richard Laager <rlaager@wiktel.com>
parents: 12979
diff changeset
3164 gtk_widget_set_sensitive(widget, (gaim_connections_get_all() != NULL));
12136
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3165
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3166 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
370f9d7868f9 [gaim-migrate @ 14436]
Richard Laager <rlaager@wiktel.com>
parents: 12133
diff changeset
3167 gtk_widget_set_sensitive(widget, gaim_gtk_roomlist_is_showable());
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3168 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3169
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3170 static void
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3171 sign_on_off_cb(GaimConnection *gc, GaimBuddyList *blist)
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3172 {
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3173 GaimGtkBuddyList *gtkblist = GAIM_GTK_BLIST(blist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3174
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3175 update_menu_bar(gtkblist);
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3176 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3177
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3178 static void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3179 plugin_changed_cb(GaimPlugin *p, gpointer *data)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3180 {
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3181 gaim_gtk_blist_update_plugin_actions();
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3182 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3183
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3184 static void
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3185 unseen_conv_menu()
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3186 {
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3187 static GtkWidget *menu = NULL;
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3188 GList *convs = NULL;
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3189
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3190 if (menu)
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3191 gtk_widget_destroy(menu);
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3192
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3193 menu = gtk_menu_new();
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3194
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3195 convs = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT, TRUE, 0);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3196 if (!convs) {
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3197 /* no conversations added, don't show the menu */
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3198 gtk_widget_destroy(menu);
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3199 return;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3200 }
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3201 gaim_gtk_conversations_fill_menu(menu, convs);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3202 g_list_free(convs);
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3203 gtk_widget_show_all(menu);
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3204 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3,
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3205 gtk_get_current_event_time());
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3206 }
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3207
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3208 static gboolean
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3209 menutray_press_cb(GtkWidget *widget, GdkEventButton *event)
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3210 {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3211 GList *convs;
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3212
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3213 switch (event->button) {
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3214 case 1:
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3215 convs = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM,
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3216 GAIM_UNSEEN_TEXT, TRUE, 1);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3217 if (convs) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3218 gaim_gtkconv_present_conversation((GaimConversation*)convs->data);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3219 g_list_free(convs);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3220 }
12133
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3221 break;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3222 case 3:
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3223 unseen_conv_menu();
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3224 break;
8254bb99f929 [gaim-migrate @ 14433]
Richard Laager <rlaager@wiktel.com>
parents: 12124
diff changeset
3225 }
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3226 return TRUE;
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3227 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3228
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3229 static void
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3230 conversation_updated_cb(GaimConversation *conv, GaimConvUpdateType type,
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3231 GaimGtkBuddyList *gtkblist)
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3232 {
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3233 GList *convs = NULL;
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3234 GList *l = NULL;
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3235
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3236 if (type != GAIM_CONV_UPDATE_UNSEEN)
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3237 return;
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3238
12744
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3239 if(conv->account != NULL && conv->name != NULL) {
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3240 GaimBuddy *buddy = gaim_find_buddy(conv->account, conv->name);
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3241 if(buddy != NULL)
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3242 gaim_gtk_blist_update_buddy(NULL, (GaimBlistNode *)buddy);
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3243 }
fcd9477e4476 [gaim-migrate @ 15091]
Luke Schierer <lschiere@pidgin.im>
parents: 12713
diff changeset
3244
12175
a655bdeb561d [gaim-migrate @ 14477]
Richard Laager <rlaager@wiktel.com>
parents: 12163
diff changeset
3245 if (gtkblist->menutrayicon) {
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3246 gtk_widget_destroy(gtkblist->menutrayicon);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3247 gtkblist->menutrayicon = NULL;
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3248 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3249
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3250 convs = gaim_gtk_conversations_find_unseen_list(GAIM_CONV_TYPE_IM, GAIM_UNSEEN_TEXT, TRUE, 0);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3251 if (convs) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3252 GtkWidget *img = NULL;
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3253 GString *tooltip_text = NULL;
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3254
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3255 tooltip_text = g_string_new("");
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3256 l = convs;
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3257 while (l != NULL) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3258 if (GAIM_IS_GTK_CONVERSATION(l->data)) {
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3259 GaimGtkConversation *gtkconv = GAIM_GTK_CONVERSATION((GaimConversation *)l->data);
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3260
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3261 g_string_append_printf(tooltip_text,
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3262 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3263 gtkconv->unseen_count,
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3264 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label)));
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3265 }
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3266 l = l->next;
12117
cb77957d644c [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
3267 }
12239
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3268 if(tooltip_text->len > 0) {
12302
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3269 /* get rid of the last newline */
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3270 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len -1);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3271 img = gtk_image_new_from_stock(GAIM_STOCK_PENDING, GTK_ICON_SIZE_MENU);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3272
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3273 gtkblist->menutrayicon = gtk_event_box_new();
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3274 gtk_container_add(GTK_CONTAINER(gtkblist->menutrayicon), img);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3275 gtk_widget_show(img);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3276 gtk_widget_show(gtkblist->menutrayicon);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3277 g_signal_connect(G_OBJECT(gtkblist->menutrayicon), "button-press-event", G_CALLBACK(menutray_press_cb), NULL);
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3278
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3279 gaim_gtk_menu_tray_append(GAIM_GTK_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, tooltip_text->str);
12239
36d3b1eaf20e [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
3280 }
12302
1b6167be6e58 [gaim-migrate @ 14606]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12301
diff changeset
3281 g_string_free(tooltip_text, TRUE);
12468
6faefbebcd24 [gaim-migrate @ 14778]
Richard Laager <rlaager@wiktel.com>
parents: 12466
diff changeset
3282 g_list_free(convs);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3283 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3284 }
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3285
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3286 static void
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3287 conversation_deleting_cb(GaimConversation *conv, GaimGtkBuddyList *gtkblist)
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3288 {
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3289 conversation_updated_cb(conv, GAIM_CONV_UPDATE_UNSEEN, gtkblist);
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3290 }
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3291
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3292 /**********************************************************************************
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3293 * Public API Functions *
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3294 **********************************************************************************/
9774
ec6ff57d7b06 [gaim-migrate @ 10642]
Luke Schierer <lschiere@pidgin.im>
parents: 9773
diff changeset
3295
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3296 static void gaim_gtk_blist_new_list(GaimBuddyList *blist)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3297 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3298 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3299
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3300 gtkblist = g_new0(GaimGtkBuddyList, 1);
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3301 gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash,
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3302 g_direct_equal, NULL, g_free);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3303 blist->ui_data = gtkblist;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3304 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3305
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3306 static void gaim_gtk_blist_new_node(GaimBlistNode *node)
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3307 {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3308 node->ui_data = g_new0(struct _gaim_gtk_blist_node, 1);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3309 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3310
11018
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3311 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3312 {
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3313 if GAIM_BLIST_NODE_IS_BUDDY(node)
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3314 node = node->parent;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3315
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3316 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
3317
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3318 return ((struct _gaim_gtk_blist_node *)node->ui_data)->contact_expanded;
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3319 }
04f280376f06 [gaim-migrate @ 12888]
Mark Doliner <mark@kingant.net>
parents: 11016
diff changeset
3320
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3321 void gaim_gtk_blist_update_columns()
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3322 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3323 if(!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3324 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3325
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3326 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")) {
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3327 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, TRUE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3328 gtk_tree_view_column_set_visible(gtkblist->idle_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3329 } else {
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3330 gtk_tree_view_column_set_visible(gtkblist->idle_column,
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3331 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3332 gtk_tree_view_column_set_visible(gtkblist->buddy_icon_column, FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3333 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3334 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3335
12326
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3336 static void
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3337 show_buddy_icons_pref_cb(const char *name, GaimPrefType type,
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
3338 gconstpointer val, gpointer data)
12326
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3339 {
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3340 gaim_gtk_blist_update_columns();
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3341 }
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3342
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3343 enum {
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3344 DRAG_BUDDY,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3345 DRAG_ROW,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3346 DRAG_VCARD,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3347 DRAG_TEXT,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3348 DRAG_URI,
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3349 NUM_TARGETS
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3350 };
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3351
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
3352 static const char *
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3353 item_factory_translate_func (const char *path, gpointer func_data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3354 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3355 return _((char *)path);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3356 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3357
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3358 void gaim_gtk_blist_setup_sort_methods()
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3359 {
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3360 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
3361 #if GTK_CHECK_VERSION(2,2,1)
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
3362 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
3363 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
3364 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
3365 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3366 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
3367 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3368
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3369 static void _prefs_change_redo_list()
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3370 {
13510
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3371 GtkTreeSelection *sel;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3372 GtkTreeIter iter;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3373 GaimBlistNode *node = NULL;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3374
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3375 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3376 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3377 {
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3378 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3379 }
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3380
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3381 redo_buddy_list(gaim_get_blist(), TRUE);
13161
02268b52ced3 [gaim-migrate @ 15524]
Richard Laager <rlaager@wiktel.com>
parents: 13146
diff changeset
3382 #if GTK_CHECK_VERSION(2,6,0)
02268b52ced3 [gaim-migrate @ 15524]
Richard Laager <rlaager@wiktel.com>
parents: 13146
diff changeset
3383 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
02268b52ced3 [gaim-migrate @ 15524]
Richard Laager <rlaager@wiktel.com>
parents: 13146
diff changeset
3384 #endif
13510
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3385
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3386 if (node)
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3387 {
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3388 struct _gaim_gtk_blist_node *gtknode;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3389 GtkTreePath *path;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3390
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3391 gtknode = node->ui_data;
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3392 if (gtknode && gtknode->row)
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3393 {
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3394 path = gtk_tree_row_reference_get_path(gtknode->row);
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3395 gtk_tree_selection_select_path(sel, path);
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3396 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0);
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3397 gtk_tree_path_free(path);
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3398 }
65486b7e8e45 [gaim-migrate @ 15886]
Richard Laager <rlaager@wiktel.com>
parents: 13509
diff changeset
3399 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3400 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3401
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3402 static void _prefs_change_sort_method(const char *pref_name, GaimPrefType type,
12816
ff267281e882 [gaim-migrate @ 15164]
Mark Doliner <mark@kingant.net>
parents: 12799
diff changeset
3403 gconstpointer val, gpointer data)
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3404 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3405 if(!strcmp(pref_name, "/gaim/gtk/blist/sort_type"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3406 gaim_gtk_blist_sort_method_set(val);
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
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3409 /*
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3410 * "This is so dead sexy."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3411 * "Two thumbs up."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3412 * "Best movie of the year."
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3413 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3414 * 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
3415 * It finds the top-most buddy/group/chat/whatever containing the
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3416 * entered string.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3417 *
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3418 * 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
3419 * "name" column of the buddy list (because the GtkTreeModel does not
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3420 * 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
3421 * 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
3422 * used rarely, so it shouldn't matter TOO much.
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3423 */
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3424 static gboolean
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3425 _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
3426 {
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3427 gchar *enteredstring;
13612
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3428 gchar *tmp;
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3429 gchar *withmarkup;
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3430 gchar *nomarkup;
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3431 gchar *normalized;
13478
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3432 gboolean result;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3433 size_t i;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3434 size_t len;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3435 PangoLogAttr *log_attrs;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3436 gchar *word;
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3437
13968
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3438 if (strcasecmp(key, "Global Thermonuclear War") == 0)
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3439 {
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3440 gaim_notify_info(NULL, "WOPR",
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3441 "Wouldn't you prefer a nice game of chess?", NULL);
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3442 return FALSE;
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3443 }
6fc412e59214 [gaim-migrate @ 16525]
Mark Doliner <mark@kingant.net>
parents: 13921
diff changeset
3444
10435
341d4932f89e [gaim-migrate @ 11692]
Mark Doliner <mark@kingant.net>
parents: 10433
diff changeset
3445 gtk_tree_model_get(model, iter, column, &withmarkup, -1);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3446
13612
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3447 tmp = g_utf8_normalize(key, -1, G_NORMALIZE_DEFAULT);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3448 enteredstring = g_utf8_casefold(tmp, -1);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3449 g_free(tmp);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3450
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3451 nomarkup = gaim_markup_strip_html(withmarkup);
13612
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3452 tmp = g_utf8_normalize(nomarkup, -1, G_NORMALIZE_DEFAULT);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3453 g_free(nomarkup);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3454 normalized = g_utf8_casefold(tmp, -1);
dd03aa8a28ad [gaim-migrate @ 15998]
Richard Laager <rlaager@wiktel.com>
parents: 13559
diff changeset
3455 g_free(tmp);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3456
13478
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3457 if (gaim_str_has_prefix(normalized, enteredstring))
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3458 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3459 g_free(withmarkup);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3460 g_free(enteredstring);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3461 g_free(normalized);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3462 return FALSE;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3463 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3464
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3465
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3466 /* Use Pango to separate by words. */
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3467 len = g_utf8_strlen(normalized, -1);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3468 log_attrs = g_new(PangoLogAttr, len + 1);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3469
13684
a104ce6e2cca [gaim-migrate @ 16087]
Richard Laager <rlaager@wiktel.com>
parents: 13674
diff changeset
3470 pango_get_log_attrs(normalized, strlen(normalized), -1, NULL, log_attrs, len + 1);
13478
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3471
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3472 word = normalized;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3473 result = TRUE;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3474 for (i = 0; i < (len - 1) ; i++)
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3475 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3476 if (log_attrs[i].is_word_start &&
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3477 gaim_str_has_prefix(word, enteredstring))
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3478 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3479 result = FALSE;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3480 break;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3481 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3482 word = g_utf8_next_char(word);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3483 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3484 g_free(log_attrs);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3485
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3486 /* The non-Pango version. */
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3487 #if 0
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3488 word = normalized;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3489 result = TRUE;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3490 while (word[0] != '\0')
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3491 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3492 gunichar c = g_utf8_get_char(word);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3493 if (!g_unichar_isalnum(c))
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3494 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3495 word = g_utf8_find_next_char(word, NULL);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3496 if (gaim_str_has_prefix(word, enteredstring))
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3497 {
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3498 result = FALSE;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3499 break;
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3500 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3501 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3502 else
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3503 word = g_utf8_find_next_char(word, NULL);
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3504 }
38dcde2c8c4b [gaim-migrate @ 15854]
Richard Laager <rlaager@wiktel.com>
parents: 13450
diff changeset
3505 #endif
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3506
10439
911530134bf8 [gaim-migrate @ 11697]
Mark Doliner <mark@kingant.net>
parents: 10435
diff changeset
3507 g_free(withmarkup);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3508 g_free(enteredstring);
11490
1ae1454204cd [gaim-migrate @ 13733]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11438
diff changeset
3509 g_free(normalized);
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3510
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3511 return result;
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3512 }
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3513
12522
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3514 static void account_modified(GaimAccount *account, GaimGtkBuddyList *gtkblist)
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3515 {
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3516 if (!gtkblist)
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3517 return;
12589
42ea8c3de6de [gaim-migrate @ 14918]
Mark Doliner <mark@kingant.net>
parents: 12583
diff changeset
3518
12522
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3519 update_menu_bar(gtkblist);
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3520 }
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3521
12766
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3522 static void
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3523 account_status_changed(GaimAccount *account, GaimStatus *old,
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3524 GaimStatus *new, GaimGtkBuddyList *gtkblist)
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3525 {
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3526 if (!gtkblist)
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3527 return;
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3528
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3529 update_menu_bar(gtkblist);
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3530 }
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3531
12124
9c123e27e2f6 [gaim-migrate @ 14424]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12119
diff changeset
3532 static gboolean
12461
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3533 gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, GaimGtkBuddyList *gtkblist)
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3534 {
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3535 GtkWidget *imhtml;
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3536
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3537 if (!gtkblist)
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3538 return FALSE;
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3539
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3540 imhtml = gtk_window_get_focus(GTK_WINDOW(gtkblist->window));
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3541
12474
24beec3e42ad [gaim-migrate @ 14785]
Luke Schierer <lschiere@pidgin.im>
parents: 12473
diff changeset
3542 if (GTK_IS_IMHTML(imhtml) && gtk_bindings_activate(GTK_OBJECT(imhtml), event->keyval, event->state))
12461
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3543 return TRUE;
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3544 return FALSE;
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3545 }
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3546
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3547 /***********************************/
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3548 /* Connection error handling stuff */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3549 /***********************************/
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3550
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3551 static void
13315
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3552 ce_modify_account_cb(GaimAccount *account)
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3553 {
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3554 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account);
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3555 }
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3556
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3557 static void
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3558 ce_enable_account_cb(GaimAccount *account)
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3559 {
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3560 gaim_account_set_enabled(account, gaim_core_get_ui(), TRUE);
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3561 }
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3562
d65250edebe0 [gaim-migrate @ 15681]
Richard Laager <rlaager@wiktel.com>
parents: 13293
diff changeset
3563 static void
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3564 connection_error_button_clicked_cb(GtkButton *widget, gpointer user_data)
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3565 {
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3566 GaimAccount *account;
13023
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13022
diff changeset
3567 char *primary;
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13022
diff changeset
3568 const char *text;
13730
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3569 gboolean enabled;
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3570
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3571 account = user_data;
13023
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13022
diff changeset
3572 primary = g_strdup_printf(_("%s disconnected"),
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13022
diff changeset
3573 gaim_account_get_username(account));
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3574 text = g_hash_table_lookup(gtkblist->connection_errors, account);
13375
a6b846c71358 [gaim-migrate @ 15748]
Mark Doliner <mark@kingant.net>
parents: 13336
diff changeset
3575
13730
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3576 enabled = gaim_account_get_enabled(account, gaim_core_get_ui());
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3577 gaim_request_action(account, _("Connection Error"), primary, text, 2,
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3578 account, 3,
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3579 _("OK"), NULL,
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3580 _("Modify Account"), GAIM_CALLBACK(ce_modify_account_cb),
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3581 enabled ? _("Connect") : _("Re-enable Account"),
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3582 enabled ? GAIM_CALLBACK(gaim_account_connect) :
2eea3265dbe6 [gaim-migrate @ 16141]
Mark Doliner <mark@kingant.net>
parents: 13689
diff changeset
3583 GAIM_CALLBACK(ce_enable_account_cb));
13629
3275a0f675e2 [gaim-migrate @ 16016]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13612
diff changeset
3584 g_free(primary);
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3585 gtk_widget_destroy(GTK_WIDGET(widget));
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3586 g_hash_table_remove(gtkblist->connection_errors, account);
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3587 }
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3588
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3589 /* Add some buttons that show connection errors */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3590 static void
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3591 create_connection_error_buttons(gpointer key, gpointer value,
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3592 gpointer user_data)
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3593 {
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3594 GaimAccount *account;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3595 GaimStatusType *status_type;
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3596 gchar *escaped, *text;
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3597 GtkWidget *button, *label, *image, *hbox;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3598 GdkPixbuf *pixbuf;
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3599
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3600 account = key;
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3601 escaped = g_markup_escape_text((const gchar *)value, -1);
13023
e8adf8183cf4 [gaim-migrate @ 15376]
Mark Doliner <mark@kingant.net>
parents: 13022
diff changeset
3602 text = g_strdup_printf(_("<span color=\"red\">%s disconnected: %s</span>"),
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3603 gaim_account_get_username(account),
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3604 escaped);
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3605 g_free(escaped);
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3606
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3607 hbox = gtk_hbox_new(FALSE, 0);
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3608
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3609 /* Create the icon */
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3610 status_type = gaim_account_get_status_type_with_primitive(account,
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3611 GAIM_STATUS_OFFLINE);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3612 pixbuf = gaim_gtk_create_prpl_icon_with_status(account, status_type, 0.5);
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3613 if (pixbuf != NULL) {
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
3614 image = gtk_image_new_from_pixbuf(pixbuf);
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3615 g_object_unref(pixbuf);
13030
d09b19783b8d [gaim-migrate @ 15383]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
3616
d09b19783b8d [gaim-migrate @ 15383]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
3617 gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE,
d09b19783b8d [gaim-migrate @ 15383]
Mark Doliner <mark@kingant.net>
parents: 13023
diff changeset
3618 GAIM_HIG_BOX_SPACE);
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3619 }
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3620
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3621 /* Create the text */
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3622 label = gtk_label_new("");
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3623 gtk_label_set_markup(GTK_LABEL(label), text);
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3624 g_free(text);
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3625 #if GTK_CHECK_VERSION(2,6,0)
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3626 g_object_set(label, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3627 #endif
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3628 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE,
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3629 GAIM_HIG_BOX_SPACE);
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3630
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3631 /* Create the actual button and put the icon and text on it */
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3632 button = gtk_button_new();
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3633 gtk_container_add(GTK_CONTAINER(button), hbox);
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3634 g_signal_connect(G_OBJECT(button), "clicked",
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3635 G_CALLBACK(connection_error_button_clicked_cb),
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3636 account);
13049
97fa7332b034 [gaim-migrate @ 15410]
Mark Doliner <mark@kingant.net>
parents: 13038
diff changeset
3637 gtk_widget_show_all(button);
13022
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3638 gtk_box_pack_end(GTK_BOX(gtkblist->error_buttons), button,
228b1f95e5b4 [gaim-migrate @ 15375]
Etan Reisner <pidgin@unreliablesource.net>
parents: 13016
diff changeset
3639 FALSE, FALSE, 0);
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3640 }
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3641
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3642 void
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3643 gaim_gtk_blist_update_account_error_state(GaimAccount *account, const char *text)
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3644 {
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3645 GList *l;
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3646
13016
8acf409a2d5f [gaim-migrate @ 15369]
Mark Doliner <mark@kingant.net>
parents: 13015
diff changeset
3647 if (text == NULL)
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3648 g_hash_table_remove(gtkblist->connection_errors, account);
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3649 else
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3650 g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text));
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3651
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3652 /* Remove the old error buttons */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3653 for (l = gtk_container_get_children(GTK_CONTAINER(gtkblist->error_buttons));
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3654 l != NULL;
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3655 l = l->next)
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3656 {
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3657 gtk_widget_destroy(GTK_WIDGET(l->data));
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3658 }
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3659
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3660 /* Add new error buttons */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3661 g_hash_table_foreach(gtkblist->connection_errors,
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3662 create_connection_error_buttons, NULL);
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3663 }
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3664
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3665 /******************************************/
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3666 /* End of connection error handling stuff */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3667 /******************************************/
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3668
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3669 static void gaim_gtk_blist_show(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3670 {
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3671 void *handle;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3672 GtkCellRenderer *rend;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3673 GtkTreeViewColumn *column;
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3674 GtkWidget *menu;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3675 GtkWidget *sw;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3676 GtkAccelGroup *accel_group;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3677 GtkTreeSelection *selection;
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3678 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
3679 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
960e3fd1da94 [gaim-migrate @ 10321]
Sean Egan <seanegan@gmail.com>
parents: 9466
diff changeset
3680 {"text/x-vcard", 0, DRAG_VCARD },
9525
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3681 {"text/uri-list", 0, DRAG_URI},
a3be930b7fad [gaim-migrate @ 10352]
Sean Egan <seanegan@gmail.com>
parents: 9498
diff changeset
3682 {"text/plain", 0, DRAG_TEXT}};
9556
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3683 GtkTargetEntry ste[] = {{"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3684 {"application/x-im-contact", 0, DRAG_BUDDY},
75fe1ace4ae4 [gaim-migrate @ 10392]
Sean Egan <seanegan@gmail.com>
parents: 9533
diff changeset
3685 {"text/x-vcard", 0, DRAG_VCARD }};
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3686 if (gtkblist && gtkblist->window) {
12119
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3687 gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3688 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3689 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3690
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3691 gtkblist = GAIM_GTK_BLIST(list);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3692
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3693 gtkblist->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3694 gtk_window_set_role(GTK_WINDOW(gtkblist->window), "buddy_list");
9746
3a71d70e3945 [gaim-migrate @ 10611]
Luke Schierer <lschiere@pidgin.im>
parents: 9737
diff changeset
3695 gtk_window_set_title(GTK_WINDOW(gtkblist->window), _("Buddy List"));
12328
cdb0e57f4a76 [gaim-migrate @ 14632]
Nathan Walp <nwalp@pidgin.im>
parents: 12326
diff changeset
3696 GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3697
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3698 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3699 gtk_widget_show(gtkblist->vbox);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3700 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->vbox);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3701
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3702 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3703 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3704 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3705 g_signal_connect(G_OBJECT(gtkblist->window), "window_state_event", G_CALLBACK(gtk_blist_window_state_cb), NULL);
12461
27671f780081 [gaim-migrate @ 14771]
Richard Laager <rlaager@wiktel.com>
parents: 12458
diff changeset
3706 g_signal_connect(G_OBJECT(gtkblist->window), "key_press_event", G_CALLBACK(gtk_blist_window_key_press_cb), gtkblist);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3707 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3708
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3709 /******************************* Menu bar *************************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3710 accel_group = gtk_accel_group_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3711 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3712 g_object_unref(accel_group);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3713 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
3714 gtk_item_factory_set_translate_func(gtkblist->ift,
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
3715 (GtkTranslateFunc)item_factory_translate_func,
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3716 NULL, NULL);
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3717 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
3718 blist_menu, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3719 gaim_gtk_load_accels();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3720 g_signal_connect(G_OBJECT(accel_group), "accel-changed",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3721 G_CALLBACK(gaim_gtk_save_accels_cb), NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3722 menu = gtk_item_factory_get_widget(gtkblist->ift, "<GaimMain>");
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3723 gtkblist->menutray = gaim_gtk_menu_tray_new();
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3724 gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3725 gtk_widget_show(gtkblist->menutray);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3726 gtk_widget_show(menu);
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3727 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
3728
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
3729 accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts"));
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
3730
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3731 /****************************** GtkTreeView **********************************/
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3732 sw = gtk_scrolled_window_new(NULL,NULL);
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3733 gtk_widget_show(sw);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3734 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
3735 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
3736
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3737 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3738 GDK_TYPE_PIXBUF, G_TYPE_BOOLEAN,
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
3739 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
3740
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3741 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
3742 gtk_widget_show(gtkblist->treeview);
9176
7dc10a14c568 [gaim-migrate @ 9971]
Luke Schierer <lschiere@pidgin.im>
parents: 9113
diff changeset
3743 gtk_widget_set_name(gtkblist->treeview, "gaim_gtkblist_treeview");
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3744
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3745 /* Set up selection stuff */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3746 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3747 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
3748
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3749 /* Set up dnd */
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3750 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
3751 GDK_BUTTON1_MASK, ste, 3,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3752 GDK_ACTION_COPY);
7650
6db061321ec4 [gaim-migrate @ 8293]
Mark Doliner <mark@kingant.net>
parents: 7642
diff changeset
3753 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
3754 dte, 5,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3755 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
01c1b3ea70c6 [gaim-migrate @ 8278]
Sean Egan <seanegan@gmail.com>
parents: 7628
diff changeset
3756
10544
bc7352b57a99 [gaim-migrate @ 11910]
Nathan Walp <nwalp@pidgin.im>
parents: 10515
diff changeset
3757 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
3758 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
3759 #ifdef _WIN32
c86d423df757 [gaim-migrate @ 13012]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11038
diff changeset
3760 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
3761 #endif
10433
f7f06cb69d5e [gaim-migrate @ 11689]
Mark Doliner <mark@kingant.net>
parents: 10418
diff changeset
3762
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
3763 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
3764
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3765 /* Tooltips */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3766 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
3767 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
3768
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3769 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3770
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3771 gtkblist->text_column = column = gtk_tree_view_column_new ();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3772
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3773 rend = gtk_cell_renderer_pixbuf_new();
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3774 gtk_tree_view_column_pack_start(column, rend, FALSE);
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3775 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3776 "pixbuf", STATUS_ICON_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3777 "visible", STATUS_ICON_VISIBLE_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3778 NULL);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3779 g_object_set(rend, "xalign", 0.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3780
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3781 gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3782 gtk_tree_view_column_pack_start (column, rend, TRUE);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3783 gtk_tree_view_column_set_attributes(column, rend,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3784 "markup", NAME_COLUMN,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
3785 NULL);
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3786 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
3787 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3788 #if GTK_CHECK_VERSION(2,6,0)
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3789 gtk_tree_view_column_set_expand (column, TRUE);
10501
4806967e093e [gaim-migrate @ 11793]
Sean Egan <seanegan@gmail.com>
parents: 10499
diff changeset
3790 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
10285
810613c79589 [gaim-migrate @ 11456]
Sean Egan <seanegan@gmail.com>
parents: 10282
diff changeset
3791 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3792 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3793
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3794 rend = gtk_cell_renderer_text_new();
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3795 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
3796 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
3797 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3798
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3799 rend = gtk_cell_renderer_pixbuf_new();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3800 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
3801 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3802 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
3803
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3804 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
3805 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
3806 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
3807 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
3808 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
3809 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
3810
5419
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3811 /* Enable CTRL+F searching */
ab1cb8b5e42b [gaim-migrate @ 5798]
Mark Doliner <mark@kingant.net>
parents: 5398
diff changeset
3812 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
3813 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
3814
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3815 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3816 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3817 gaim_gtk_blist_update_columns();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3818
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3819 /* Create an empty vbox used for showing connection errors */
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3820 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0);
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3821 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0);
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3822
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
3823 /* Add the statusbox */
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3824 gtkblist->statusbox = gtk_gaim_status_box_new();
12592
37160dd563fa [gaim-migrate @ 14922]
Richard Laager <rlaager@wiktel.com>
parents: 12589
diff changeset
3825 gtk_widget_set_name(gtkblist->statusbox, "gaim_gtkblist_statusbox");
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3826
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3827 gtk_widget_show(gtkblist->statusbox);
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3828 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3829
10178
96a850ab30c8 [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
3830
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3831 /* set the Show Offline Buddies option. must be done
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3832 * after the treeview or faceprint gets mad. -Robot101
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3833 */
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3834 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
3835 gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"));
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3836
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
3837 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
3838 gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"));
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3839
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3840 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
3841 gaim_prefs_get_bool("/gaim/gtk/sound/mute"));
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3842
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3843 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Buddy Details"))),
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11917
diff changeset
3844 gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"));
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3845
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3846 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show Idle Times"))),
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3847 gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time"));
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3848
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3849 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
3850 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
3851
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3852 /* Update some dynamic things */
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3853 update_menu_bar(gtkblist);
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3854 gaim_gtk_blist_update_plugin_actions();
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
3855 gaim_gtk_blist_update_sort_methods();
10353
fc7168f9ecb0 [gaim-migrate @ 11570]
Mark Doliner <mark@kingant.net>
parents: 10352
diff changeset
3856
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3857 /* OK... let's show this bad boy. */
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3858 gaim_gtk_blist_refresh(list);
12119
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3859 gaim_gtk_blist_restore_position();
312efb43c49a [gaim-migrate @ 14419]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12117
diff changeset
3860 gtk_widget_show_all(GTK_WIDGET(gtkblist->window));
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
3861 gaim_blist_set_visible(gaim_prefs_get_bool("/gaim/gtk/blist/list_visible"));
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3862
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3863 /* start the refresh timer */
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3864 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
3865
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3866 handle = gaim_gtk_blist_get_handle();
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3867
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3868 /* things that affect how buddies are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3869 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3870 _prefs_change_redo_list, NULL);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3871 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_idle_time",
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3872 _prefs_change_redo_list, NULL);
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3873 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_empty_groups",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3874 _prefs_change_redo_list, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3875 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_offline_buddies",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3876 _prefs_change_redo_list, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3877
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3878 /* sorting */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3879 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/sort_type",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3880 _prefs_change_sort_method, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3881
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3882 /* things that affect what columns are displayed */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3883 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_buddy_icons",
12326
a0b0e0e95ed0 [gaim-migrate @ 14630]
Mark Doliner <mark@kingant.net>
parents: 12319
diff changeset
3884 show_buddy_icons_pref_cb, NULL);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3885 gaim_prefs_connect_callback(handle, "/gaim/gtk/blist/show_idle_time",
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
3886 show_buddy_icons_pref_cb, NULL);
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3887
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3888 /* menus */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3889 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/mute",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3890 gaim_gtk_blist_mute_pref_cb, NULL);
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3891 gaim_prefs_connect_callback(handle, "/gaim/gtk/sound/method",
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3892 gaim_gtk_blist_sound_method_pref_cb, NULL);
10074
2e225cd35615 [gaim-migrate @ 11054]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10046
diff changeset
3893
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
3894 /* Setup some gaim signal handlers. */
12522
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3895 gaim_signal_connect(gaim_accounts_get_handle(), "account-enabled",
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3896 gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3897 gaim_signal_connect(gaim_accounts_get_handle(), "account-disabled",
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3898 gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
12226
df0e16ecfb2a [gaim-migrate @ 14528]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12208
diff changeset
3899 gaim_signal_connect(gaim_accounts_get_handle(), "account-removed",
12583
301e9f0841d7 [gaim-migrate @ 14911]
Sean Egan <seanegan@gmail.com>
parents: 12576
diff changeset
3900 gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
12766
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3901 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed",
42af52cb61f7 [gaim-migrate @ 15113]
Mark Doliner <mark@kingant.net>
parents: 12744
diff changeset
3902 gtkblist, GAIM_CALLBACK(account_status_changed), gtkblist);
12522
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3903
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3904 gaim_signal_connect(gaim_gtk_account_get_handle(), "account-modified",
560ddc8d26f3 [gaim-migrate @ 14834]
Richard Laager <rlaager@wiktel.com>
parents: 12519
diff changeset
3905 gtkblist, GAIM_CALLBACK(account_modified), gtkblist);
12070
e4666705944b [gaim-migrate @ 14365]
Tim Ringenbach <marv@pidgin.im>
parents: 12043
diff changeset
3906
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3907 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3908 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3909 gaim_signal_connect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
3910 gtkblist, GAIM_CALLBACK(sign_on_off_cb), list);
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3911
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3912 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3913 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3914 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload",
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3915 gtkblist, GAIM_CALLBACK(plugin_changed_cb), NULL);
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
3916
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3917 gaim_signal_connect(gaim_conversations_get_handle(), "conversation-updated",
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3918 gtkblist, GAIM_CALLBACK(conversation_updated_cb),
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3919 gtkblist);
12208
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3920 gaim_signal_connect(gaim_conversations_get_handle(), "deleting-conversation",
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3921 gtkblist, GAIM_CALLBACK(conversation_deleting_cb),
ddcd92a32eeb [gaim-migrate @ 14510]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12191
diff changeset
3922 gtkblist);
12116
e75ef7aa913e [gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents: 12115
diff changeset
3923
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
3924 /* emit our created signal */
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
3925 gaim_signal_emit(handle, "gtkblist-created", list);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3926 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3927
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3928 static void redo_buddy_list(GaimBuddyList *list, gboolean remove)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3929 {
12112
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3930 GaimBlistNode *node = list->root;
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3931
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3932 while (node)
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3933 {
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
3934 if (remove && !GAIM_BLIST_NODE_IS_GROUP(node))
12112
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3935 gaim_gtk_blist_hide_node(list, node);
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3936
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3937 gaim_gtk_blist_update(list, node);
875f59f9c0bb [gaim-migrate @ 14412]
Sean Egan <seanegan@gmail.com>
parents: 12080
diff changeset
3938 node = gaim_blist_node_next(node, FALSE);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3939 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3940 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3941
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3942 void gaim_gtk_blist_refresh(GaimBuddyList *list)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3943 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3944 redo_buddy_list(list, FALSE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3945 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
3946
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3947 void
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3948 gaim_gtk_blist_update_refresh_timeout()
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3949 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3950 GaimBuddyList *blist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3951 GaimGtkBuddyList *gtkblist;
5297
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3952
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3953 blist = gaim_get_blist();
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3954 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3955
10351
7fcdd669eb49 [gaim-migrate @ 11566]
Sean Egan <seanegan@gmail.com>
parents: 10325
diff changeset
3956 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
3957 }
d4c9c5491812 [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
3958
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3959 static gboolean get_iter_from_node(GaimBlistNode *node, GtkTreeIter *iter) {
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3960 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
3961 GtkTreePath *path;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3962
5263
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3963 if (!gtknode) {
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3964 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3965 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3966
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3967 if (!gtkblist) {
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
3968 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
3969 return FALSE;
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3970 }
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3971
b476a30ef4e3 [gaim-migrate @ 5635]
Luke Schierer <lschiere@pidgin.im>
parents: 5260
diff changeset
3972 if (!gtknode->row)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3973 return FALSE;
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
3974
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3975
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3976 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3977 return FALSE;
11016
6417b2f5de4e [gaim-migrate @ 12885]
Sean Egan <seanegan@gmail.com>
parents: 10992
diff changeset
3978
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3979 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
3980 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3981 return FALSE;
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3982 }
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3983 gtk_tree_path_free(path);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
3984 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3985 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3986
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3987 static void gaim_gtk_blist_remove(GaimBuddyList *list, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3988 {
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3989 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3990
10222
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3991 gaim_request_close_with_handle(node);
224c9f244a3a [gaim-migrate @ 11351]
Sean Egan <seanegan@gmail.com>
parents: 10209
diff changeset
3992
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
3993 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3994
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3995 if(node->parent)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3996 gaim_gtk_blist_update(list, node->parent);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
3997
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3998 /* There's something I don't understand here - Ethan */
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10501
diff changeset
3999 /* 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
4000 * 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
4001 * 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
4002 * comment it out again. Stu */
10510
1044c0930e03 [gaim-migrate @ 11808]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10504
diff changeset
4003 /* 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
4004 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4005 /* I think it's fixed now. Stu. */
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4006
11915
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4007 if(gtknode) {
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4008 if(gtknode->recent_signonoff_timer > 0)
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4009 gaim_timeout_remove(gtknode->recent_signonoff_timer);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4010
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4011 g_free(node->ui_data);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4012 node->ui_data = NULL;
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
4013 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4014 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4015
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4016 static gboolean do_selection_changed(GaimBlistNode *new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4017 {
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
4018 GaimBlistNode *old_selection = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4019
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
4020 /* 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
4021 if (gtkblist && new_selection != gtkblist->selected_node) {
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
4022 old_selection = gtkblist->selected_node;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4023 gtkblist->selected_node = new_selection;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4024 if(new_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4025 gaim_gtk_blist_update(NULL, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4026 if(old_selection)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4027 gaim_gtk_blist_update(NULL, old_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4028 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4029
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4030 return FALSE;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4031 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4032
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4033 static void gaim_gtk_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4034 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4035 GaimBlistNode *new_selection = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4036 GtkTreeIter iter;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4037
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4038 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4039 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4040 NODE_COLUMN, &new_selection, -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4041 }
5254
d1e1ca490894 [gaim-migrate @ 5626]
Luke Schierer <lschiere@pidgin.im>
parents: 5241
diff changeset
4042
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4043 /* we set this up as a timeout, otherwise the blist flickers */
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4044 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4045 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4046
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4047 static gboolean insert_node(GaimBuddyList *list, GaimBlistNode *node, GtkTreeIter *iter)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4048 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4049 GtkTreeIter parent_iter, cur, *curptr = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4050 struct _gaim_gtk_blist_node *gtknode = node->ui_data;
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4051 GtkTreePath *newpath;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4052
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4053 if(!iter)
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4054 return FALSE;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4055
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4056 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
4057 return FALSE;
7620
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(get_iter_from_node(node, &cur))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4060 curptr = &cur;
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 if(GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node)) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
4063 current_sort_method->func(node, list, parent_iter, curptr, iter);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4064 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
4065 sort_method_none(node, list, parent_iter, curptr, iter);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4066 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4067
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4068 if(gtknode != NULL) {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4069 gtk_tree_row_reference_free(gtknode->row);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4070 } else {
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4071 gaim_gtk_blist_new_node(node);
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4072 gtknode = (struct _gaim_gtk_blist_node *)node->ui_data;
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4073 }
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4074
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4075 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4076 iter);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4077 gtknode->row =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4078 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4079 newpath);
11494
3314953511de [gaim-migrate @ 13738]
Tim Ringenbach <marv@pidgin.im>
parents: 11490
diff changeset
4080
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4081 gtk_tree_path_free(newpath);
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
4082
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4083 gtk_tree_store_set(gtkblist->treemodel, iter,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4084 NODE_COLUMN, node,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4085 -1);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4086
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4087 if(node->parent) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4088 GtkTreePath *expand = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4089 struct _gaim_gtk_blist_node *gtkparentnode = node->parent->ui_data;
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 if(GAIM_BLIST_NODE_IS_GROUP(node->parent)) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
4092 if(!gaim_blist_node_get_bool(node->parent, "collapsed"))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4093 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
4094 } else if(GAIM_BLIST_NODE_IS_CONTACT(node->parent) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4095 gtkparentnode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4096 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
4097 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4098 if(expand) {
7693
1d0314b99747 [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
4099 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
4100 gtk_tree_path_free(expand);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4101 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4102 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4103
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4104 return TRUE;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4105 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4106
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4107 /*This version of gaim_gtk_blist_update_group can take the original buddy
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4108 or a group, but has much better algorithmic performance with a pre-known buddy*/
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4109 static void gaim_gtk_blist_update_group(GaimBuddyList *list, GaimBlistNode *node)
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 GaimGroup *group;
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
4112 int count;
12341
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4113 gboolean show = FALSE;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4114 GaimBlistNode* gnode;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4115
13920
73cd68ae7c43 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon>
parents: 13889
diff changeset
4116 g_return_if_fail(node != NULL);
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4117
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4118 if (GAIM_BLIST_NODE_IS_GROUP(node))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4119 gnode = node;
13921
dc4db4925249 [gaim-migrate @ 16434]
Aaron Sheldon <aaronsheldon>
parents: 13920
diff changeset
4120 else if (GAIM_BLIST_NODE_IS_BUDDY(node))
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4121 gnode = node->parent->parent;
13921
dc4db4925249 [gaim-migrate @ 16434]
Aaron Sheldon <aaronsheldon>
parents: 13920
diff changeset
4122 else if (GAIM_BLIST_NODE_IS_CONTACT(node) || GAIM_BLIST_NODE_IS_CHAT(node))
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4123 gnode = node->parent;
13920
73cd68ae7c43 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon>
parents: 13889
diff changeset
4124 else
73cd68ae7c43 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon>
parents: 13889
diff changeset
4125 return;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4126
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4127 group = (GaimGroup*)gnode;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4128
8203
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
4129 if(gaim_prefs_get_bool("/gaim/gtk/blist/show_offline_buddies"))
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
4130 count = gaim_blist_get_group_size(group, FALSE);
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
4131 else
72311ba4ad8b [gaim-migrate @ 8926]
Mark Doliner <mark@kingant.net>
parents: 8198
diff changeset
4132 count = gaim_blist_get_group_online_count(group);
13195
c242836ff793 [gaim-migrate @ 15558]
Mark Doliner <mark@kingant.net>
parents: 13161
diff changeset
4133
12341
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4134 if (count > 0 || gaim_prefs_get_bool("/gaim/gtk/blist/show_empty_groups"))
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4135 show = TRUE;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4136 else if (GAIM_BLIST_NODE_IS_BUDDY(node)){ /* Or chat? */
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4137 if (buddy_is_displayable((GaimBuddy*)node))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4138 show = TRUE;}
12341
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4139
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4140 if (show) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4141 char *mark, *esc;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4142 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4143
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4144 if(!insert_node(list, gnode, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4145 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4146
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4147 esc = g_markup_escape_text(group->name, -1);
8945
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
4148 mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)",
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
4149 esc, gaim_blist_get_group_online_count(group),
6d7b403b11bb [gaim-migrate @ 9717]
Mark Doliner <mark@kingant.net>
parents: 8940
diff changeset
4150 gaim_blist_get_group_size(group, FALSE));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4151 g_free(esc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4152
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4153 gtk_tree_store_set(gtkblist->treemodel, &iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4154 STATUS_ICON_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4155 STATUS_ICON_VISIBLE_COLUMN, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4156 NAME_COLUMN, mark,
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4157 NODE_COLUMN, gnode,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4158 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4159 g_free(mark);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4160 } else {
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4161 gaim_gtk_blist_hide_node(list, gnode);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4162 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4163 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4164
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4165 static void buddy_node(GaimBuddy *buddy, GtkTreeIter *iter, GaimBlistNode *node)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4166 {
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4167 GaimPresence *presence;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4168 GdkPixbuf *status, *avatar;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4169 char *mark;
11257
90be432e8385 [gaim-migrate @ 13432]
Sean Egan <seanegan@gmail.com>
parents: 11256
diff changeset
4170 char *idle = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4171 gboolean selected = (gtkblist->selected_node == node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4172
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4173 presence = gaim_buddy_get_presence(buddy);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4174
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4175 status = gaim_gtk_blist_get_status_icon((GaimBlistNode*)buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4176 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons")
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4177 ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4178
10482
1ac8f10ce68d [gaim-migrate @ 11772]
Sean Egan <seanegan@gmail.com>
parents: 10477
diff changeset
4179 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
4180 mark = gaim_gtk_blist_get_name_markup(buddy, selected);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4181
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
4182 if (gaim_prefs_get_bool("/gaim/gtk/blist/show_idle_time") &&
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4183 gaim_presence_is_idle(presence) &&
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4184 !gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons"))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4185 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4186 time_t idle_secs = gaim_presence_get_idle_time(presence);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4187
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4188 if (idle_secs > 0)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4189 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4190 time_t t;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4191 int ihrs, imin;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4192 time(&t);
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4193 ihrs = (t - idle_secs) / 3600;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4194 imin = ((t - idle_secs) / 60) % 60;
13819
f41a515307a9 [gaim-migrate @ 16251]
Richard Laager <rlaager@wiktel.com>
parents: 13790
diff changeset
4195 idle = g_strdup_printf("%d:%02d", ihrs, imin);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4196 }
7620
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
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4199 if (gaim_presence_is_idle(presence))
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4200 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
4201 if (idle && !selected) {
10118
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4202 char *i2 = g_strdup_printf("<span color='%s'>%s</span>",
ab8e8069b71e [gaim-migrate @ 11155]
Sean Egan <seanegan@gmail.com>
parents: 10087
diff changeset
4203 dim_grey(), idle);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4204 g_free(idle);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4205 idle = i2;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4206 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4207 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4208
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4209 gtk_tree_store_set(gtkblist->treemodel, iter,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4210 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4211 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4212 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4213 IDLE_COLUMN, idle,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4214 BUDDY_ICON_COLUMN, avatar,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4215 -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4216
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4217 g_free(mark);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
4218 g_free(idle);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4219 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4220 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4221 if(avatar)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4222 g_object_unref(avatar);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4223 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4224
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4225 /* This is a variation on the original gtk_blist_update_contact. Here we
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4226 can know in advance which buddy has changed so we can just update that */
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4227 static void gaim_gtk_blist_update_contact(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4228 {
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4229 GaimBlistNode *cnode;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4230 GaimContact *contact;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4231 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4232 struct _gaim_gtk_blist_node *gtknode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4233
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4234 if (GAIM_BLIST_NODE_IS_BUDDY(node))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4235 cnode = node->parent;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4236 else
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4237 cnode = node;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4238
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4239 g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(cnode));
7620
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 /* First things first, update the group */
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4242 if (GAIM_BLIST_NODE_IS_BUDDY(node))
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4243 gaim_gtk_blist_update_group(list, node);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4244 else
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4245 gaim_gtk_blist_update_group(list, cnode->parent);
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4246
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4247 contact = (GaimContact*)cnode;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4248 buddy = gaim_contact_get_priority_buddy(contact);
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4249
11890
fdb78734e2ae [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
4250 if (buddy_is_displayable(buddy))
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4251 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4252 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4253
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4254 if(!insert_node(list, cnode, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4255 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4256
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4257 gtknode = (struct _gaim_gtk_blist_node *)cnode->ui_data;
10515
ef9b6ef0c858 [gaim-migrate @ 11816]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10510
diff changeset
4258
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4259 if(gtknode->contact_expanded) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4260 GdkPixbuf *status;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4261 char *mark;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4262
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4263 status = gaim_gtk_blist_get_status_icon(cnode,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4264 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4265 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4266
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4267 mark = g_markup_escape_text(gaim_contact_get_alias(contact), -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4268
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4269 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4270 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4271 STATUS_ICON_VISIBLE_COLUMN, TRUE,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4272 NAME_COLUMN, mark,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4273 IDLE_COLUMN, NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4274 BUDDY_ICON_COLUMN, NULL,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4275 -1);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4276 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4277 if(status)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4278 g_object_unref(status);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4279 } else {
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4280 buddy_node(buddy, &iter, cnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4281 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4282 } else {
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4283 gaim_gtk_blist_hide_node(list, cnode);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4284 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4285 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4286
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4287
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4288
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4289 static void gaim_gtk_blist_update_buddy(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4290 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4291 GaimBuddy *buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4292 struct _gaim_gtk_blist_node *gtkparentnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4293
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4294 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4295
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4296 if (node->parent == NULL)
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4297 return;
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4298
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4299 buddy = (GaimBuddy*)node;
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4300
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4301 /* First things first, update the contact */
13889
085b15c33ca4 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon>
parents: 13880
diff changeset
4302 gaim_gtk_blist_update_contact(list, node);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4303
10918
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4304 gtkparentnode = (struct _gaim_gtk_blist_node *)node->parent->ui_data;
893921a6cc6e [gaim-migrate @ 12681]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10884
diff changeset
4305
12341
eea31c8cc9f7 [gaim-migrate @ 14645]
Mark Doliner <mark@kingant.net>
parents: 12338
diff changeset
4306 if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy))
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4307 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4308 GtkTreeIter iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4309
10006
9baedaca25c7 [gaim-migrate @ 10923]
Mark Doliner <mark@kingant.net>
parents: 9993
diff changeset
4310 if (!insert_node(list, node, &iter))
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4311 return;
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4312
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4313 buddy_node(buddy, &iter, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4314
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4315 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4316 gaim_gtk_blist_hide_node(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4317 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4318
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4319 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4320
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4321 static void gaim_gtk_blist_update_chat(GaimBuddyList *list, GaimBlistNode *node)
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 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4324
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4325 g_return_if_fail(GAIM_BLIST_NODE_IS_CHAT(node));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4326
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4327 /* First things first, update the group */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4328 gaim_gtk_blist_update_group(list, node->parent);
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 chat = (GaimChat*)node;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4331
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4332 if(gaim_account_is_connected(chat->account)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4333 GtkTreeIter iter;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4334 GdkPixbuf *status;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4335 char *mark;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4336
8252
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4337 if(!insert_node(list, node, &iter))
10a41e67a800 [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
4338 return;
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4339
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4340 status = gaim_gtk_blist_get_status_icon(node,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4341 (gaim_prefs_get_bool("/gaim/gtk/blist/show_buddy_icons") ?
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4342 GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4343
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4344 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
4345
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4346 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4347 STATUS_ICON_COLUMN, status,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4348 STATUS_ICON_VISIBLE_COLUMN, TRUE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4349 NAME_COLUMN, mark,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4350 -1);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4351
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4352 g_free(mark);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4353 if(status)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4354 g_object_unref(status);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4355 } else {
5260
5331d5f11089 [gaim-migrate @ 5632]
Luke Schierer <lschiere@pidgin.im>
parents: 5256
diff changeset
4356 gaim_gtk_blist_hide_node(list, node);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4357 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4358 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4359
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4360 static void gaim_gtk_blist_update(GaimBuddyList *list, GaimBlistNode *node)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4361 {
12797
eda1572c788b [gaim-migrate @ 15144]
Richard Laager <rlaager@wiktel.com>
parents: 12766
diff changeset
4362 if(!gtkblist || !node)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4363 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4364
13195
c242836ff793 [gaim-migrate @ 15558]
Mark Doliner <mark@kingant.net>
parents: 13161
diff changeset
4365 if (node->ui_data == NULL)
c242836ff793 [gaim-migrate @ 15558]
Mark Doliner <mark@kingant.net>
parents: 13161
diff changeset
4366 gaim_gtk_blist_new_node(node);
c242836ff793 [gaim-migrate @ 15558]
Mark Doliner <mark@kingant.net>
parents: 13161
diff changeset
4367
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4368 switch(node->type) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4369 case GAIM_BLIST_GROUP_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4370 gaim_gtk_blist_update_group(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4371 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4372 case GAIM_BLIST_CONTACT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4373 gaim_gtk_blist_update_contact(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4374 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4375 case GAIM_BLIST_BUDDY_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4376 gaim_gtk_blist_update_buddy(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4377 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4378 case GAIM_BLIST_CHAT_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4379 gaim_gtk_blist_update_chat(list, node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4380 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4381 case GAIM_BLIST_OTHER_NODE:
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4382 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4383 }
5234
890b29f00b68 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4384
13146
a3c1112bb190 [gaim-migrate @ 15509]
Richard Laager <rlaager@wiktel.com>
parents: 13140
diff changeset
4385 #if !GTK_CHECK_VERSION(2,6,0)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4386 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
13146
a3c1112bb190 [gaim-migrate @ 15509]
Richard Laager <rlaager@wiktel.com>
parents: 13140
diff changeset
4387 #endif
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4388 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4389
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4390
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4391 static void gaim_gtk_blist_destroy(GaimBuddyList *list)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4392 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4393 if (!gtkblist)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4394 return;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4395
8937
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4396 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-on",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4397 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4398 gaim_signal_disconnect(gaim_connections_get_handle(), "signed-off",
fd1a4ff1f7ed [gaim-migrate @ 9707]
Mark Doliner <mark@kingant.net>
parents: 8911
diff changeset
4399 gtkblist, GAIM_CALLBACK(sign_on_off_cb));
8259
4f9f68ab8770 [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
4400
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4401 gtk_widget_destroy(gtkblist->window);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4402
8254
8a9a6eb3ded0 [gaim-migrate @ 8977]
Mark Doliner <mark@kingant.net>
parents: 8252
diff changeset
4403 gaim_gtk_blist_tooltip_destroy();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4404
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4405 if (gtkblist->refresh_timer)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4406 g_source_remove(gtkblist->refresh_timer);
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4407 if (gtkblist->timeout)
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4408 g_source_remove(gtkblist->timeout);
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4409 if (gtkblist->drag_timeout)
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4410 g_source_remove(gtkblist->drag_timeout);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4411
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
4412 g_hash_table_destroy(gtkblist->connection_errors);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4413 gtkblist->refresh_timer = 0;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4414 gtkblist->timeout = 0;
10354
0c985021a1d8 [gaim-migrate @ 11571]
Sean Egan <seanegan@gmail.com>
parents: 10353
diff changeset
4415 gtkblist->drag_timeout = 0;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4416 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4417 gtkblist->treemodel = NULL;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4418 gtkblist->idle_column = NULL;
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
4419 gtkblist->buddy_icon_column = NULL;
5427
04e1e40b99b0 [gaim-migrate @ 5806]
Mark Doliner <mark@kingant.net>
parents: 5422
diff changeset
4420 g_object_unref(G_OBJECT(gtkblist->ift));
13015
2d71d4081e06 [gaim-migrate @ 15368]
Mark Doliner <mark@kingant.net>
parents: 13001
diff changeset
4421 g_free(gtkblist);
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
4422 accountmenu = NULL;
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4423 gtkblist = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4424
10087
9fdbfe832fac [gaim-migrate @ 11098]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10079
diff changeset
4425 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle());
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4426 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4427
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4428 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4429 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4430 if (!(gtkblist && gtkblist->window))
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4431 return;
10325
1657438d537b [gaim-migrate @ 11532]
Mark Doliner <mark@kingant.net>
parents: 10320
diff changeset
4432
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4433 if (show) {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4434 if(!GAIM_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window))
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4435 gaim_signal_emit(gaim_gtk_blist_get_handle(), "gtkblist-unhiding", gtkblist);
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4436 gaim_gtk_blist_restore_position();
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4437 gtk_window_present(GTK_WINDOW(gtkblist->window));
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4438 } else {
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4439 if(visibility_manager_count) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4440 gaim_signal_emit(gaim_gtk_blist_get_handle(), "gtkblist-hiding", gtkblist);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4441 gtk_widget_hide(gtkblist->window);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4442 } else {
12479
53e2dc07d9e2 [gaim-migrate @ 14790]
Richard Laager <rlaager@wiktel.com>
parents: 12478
diff changeset
4443 if (!GTK_WIDGET_VISIBLE(gtkblist->window))
53e2dc07d9e2 [gaim-migrate @ 14790]
Richard Laager <rlaager@wiktel.com>
parents: 12478
diff changeset
4444 gtk_widget_show(gtkblist->window);
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4445 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
4446 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4447 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4448 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4449
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4450 static GList *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4451 groups_tree(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4452 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4453 GList *tmp = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4454 char *tmp2;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4455 GaimGroup *g;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4456 GaimBlistNode *gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4457
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4458 if (gaim_get_blist()->root == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4459 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4460 tmp2 = g_strdup(_("Buddies"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4461 tmp = g_list_append(tmp, tmp2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4462 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4463 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4464 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4465 for (gnode = gaim_get_blist()->root;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4466 gnode != NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4467 gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4468 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4469 if (GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4470 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4471 g = (GaimGroup *)gnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4472 tmp2 = g->name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4473 tmp = g_list_append(tmp, tmp2);
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 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4476 }
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 return tmp;
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_buddy_select_account_cb(GObject *w, GaimAccount *account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4483 GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4484 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4485 /* Save our account */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4486 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4487 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4488
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4489 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4490 destroy_add_buddy_dialog_cb(GtkWidget *win, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4491 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4492 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4493 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4494
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4495 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4496 add_buddy_cb(GtkWidget *w, int resp, GaimGtkAddBuddyData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4497 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4498 const char *grp, *who, *whoalias;
13880
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4499 GaimGroup *g;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4500 GaimBuddy *b;
13880
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4501 GaimConversation *c;
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4502 GaimBuddyIcon *icon;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4503
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4504 if (resp == GTK_RESPONSE_OK)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4505 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4506 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4507 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
4508 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
4509 if (*whoalias == '\0')
0b570eec4eca [gaim-migrate @ 10506]
Mark Doliner <mark@kingant.net>
parents: 9646
diff changeset
4510 whoalias = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4511
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4512 if ((g = gaim_find_group(grp)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4513 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4514 g = gaim_group_new(grp);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4515 gaim_blist_add_group(g, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4516 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4517
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4518 b = gaim_buddy_new(data->account, who, whoalias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4519 gaim_blist_add_buddy(b, NULL, g, NULL);
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4520 gaim_account_add_buddy(data->account, b);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4521
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4522 /*
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4523 * XXX
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4524 * 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
4525 * gaim_account_add_buddy() and gaim_conversation_update() were done in
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4526 * blist.c, possibly in the gaim_blist_add_buddy() function. Maybe
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4527 * gaim_account_add_buddy() should be renamed to
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4528 * 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
4529 * gaim_blist_add_buddy() after it creates it. --Mark
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4530 *
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
4531 * 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
4532 * 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
4533 * gaim_account_add_buddy and gaim_blist_add_buddy().
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11638
diff changeset
4534 * Or something. --Mark
7887
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4535 */
4b43a3f9de73 [gaim-migrate @ 8545]
Mark Doliner <mark@kingant.net>
parents: 7879
diff changeset
4536
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11258
diff changeset
4537 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
4538 if (c != NULL) {
13880
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4539 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(c));
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4540 if (icon != NULL)
b869ab32cccc [gaim-migrate @ 16358]
Mark Doliner <mark@kingant.net>
parents: 13832
diff changeset
4541 gaim_buddy_icon_update(icon);
7620
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 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4544
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4545 gtk_widget_destroy(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4546 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4547
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4548 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4549 gaim_gtk_blist_request_add_buddy(GaimAccount *account, const char *username,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4550 const char *group, const char *alias)
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 GtkWidget *table;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4553 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4554 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4555 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4556 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4557 GaimGtkBuddyList *gtkblist;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4558 GaimGtkAddBuddyData *data = g_new0(GaimGtkAddBuddyData, 1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4559
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4560 data->account =
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4561 (account != NULL
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4562 ? account
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4563 : gaim_connection_get_account(gaim_connections_get_all()->data));
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 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4566 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4567
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4568 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4569
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4570 data->window = gtk_dialog_new_with_buttons(_("Add Buddy"),
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4571 NULL, GTK_DIALOG_NO_SEPARATOR,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4572 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4573 GTK_STOCK_ADD, GTK_RESPONSE_OK,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4574 NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4575
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4576 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
4577 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
4578 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4579 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
4580 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
4581 gtk_window_set_role(GTK_WINDOW(data->window), "add_buddy");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4582 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4583 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4584
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4585 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4586 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4587 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4588 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4589
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4590 vbox = gtk_vbox_new(FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4591 gtk_container_add(GTK_CONTAINER(hbox), vbox);
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 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4594 _("Please enter the screen name of the person you would like "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4595 "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
4596 "or nickname, for the buddy. The alias will be displayed in "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4597 "place of the screen name whenever possible.\n"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4598
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4599 gtk_widget_set_size_request(GTK_WIDGET(label), 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4600 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4601 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4602 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4603
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4604 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4605 gtk_container_add(GTK_CONTAINER(vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4606
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4607 g_signal_connect(G_OBJECT(data->window), "destroy",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4608 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4609
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4610 table = gtk_table_new(4, 2, FALSE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4611 gtk_table_set_row_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4612 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4613 gtk_container_set_border_width(GTK_CONTAINER(table), 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4614 gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4615
13545
cfc2f7fcb3dd [gaim-migrate @ 15922]
Richard Laager <rlaager@wiktel.com>
parents: 13542
diff changeset
4616 label = gtk_label_new(_("Screen name:"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4617 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4618 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
4619
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4620 data->entry = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4621 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
4622 gtk_widget_grab_focus(data->entry);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4623
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4624 if (username != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4625 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
12337
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4626 else
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4627 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->window),
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4628 GTK_RESPONSE_OK, FALSE);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4629
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4630 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
4631 gaim_set_accessible_label (data->entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4632
12337
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4633 g_signal_connect(G_OBJECT(data->entry), "changed",
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4634 G_CALLBACK(gaim_gtk_set_sensitive_if_input),
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4635 data->window);
610327016c4a [gaim-migrate @ 14641]
Mark Doliner <mark@kingant.net>
parents: 12334
diff changeset
4636
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4637 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4638 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4639 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
4640
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4641 data->entry_for_alias = gtk_entry_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4642 gtk_table_attach_defaults(GTK_TABLE(table),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4643 data->entry_for_alias, 1, 2, 1, 2);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4644
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4645 if (alias != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4646 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4647
10734
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4648 if (username != NULL)
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4649 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
8b2c81d9b271 [gaim-migrate @ 12336]
Luke Schierer <lschiere@pidgin.im>
parents: 10694
diff changeset
4650
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4651 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
4652 gaim_set_accessible_label (data->entry_for_alias, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4653
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4654 label = gtk_label_new(_("Group:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4655 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4656 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
4657
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4658 data->combo = gtk_combo_new();
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4659 gtk_combo_set_popdown_strings(GTK_COMBO(data->combo), groups_tree());
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4660 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
4661 gaim_set_accessible_label (data->combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4662
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4663 /* Set up stuff for the account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4664 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4665 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4666 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
4667
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4668 data->account_box = gaim_gtk_account_option_menu_new(account, FALSE,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4669 G_CALLBACK(add_buddy_select_account_cb), NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4670
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4671 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
4672 gaim_set_accessible_label (data->account_box, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4673 /* End of account box */
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4674
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4675 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4676 G_CALLBACK(add_buddy_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4677
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4678 gtk_widget_show_all(data->window);
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 (group != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4681 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
4682 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4683
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4684 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4685 add_chat_cb(GtkWidget *w, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4686 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4687 GHashTable *components;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4688 GList *tmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4689 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4690 GaimGroup *group;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4691 const char *group_name;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4692 const char *value;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4693
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4694 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
4695 g_free, g_free);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4696
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4697 for (tmp = data->entries; tmp; tmp = tmp->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4698 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4699 if (g_object_get_data(tmp->data, "is_spin"))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4700 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4701 g_hash_table_replace(components,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4702 g_strdup(g_object_get_data(tmp->data, "identifier")),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4703 g_strdup_printf("%d",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4704 gtk_spin_button_get_value_as_int(tmp->data)));
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 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4707 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4708 value = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4709 if (*value != '\0')
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4710 g_hash_table_replace(components,
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4711 g_strdup(g_object_get_data(tmp->data, "identifier")),
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4712 g_strdup(value));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4713 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4714 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4715
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4716 chat = gaim_chat_new(data->account,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4717 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4718 components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4719
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4720 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
4721
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4722 if ((group = gaim_find_group(group_name)) == NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4723 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4724 group = gaim_group_new(group_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4725 gaim_blist_add_group(group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4726 }
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 if (chat != NULL)
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 gaim_blist_add_chat(chat, group, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4731 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4732
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4733 gtk_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4734 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4735 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4736 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4737 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4738
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4739 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4740 add_chat_resp_cb(GtkWidget *w, int resp, GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4741 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4742 if (resp == GTK_RESPONSE_OK)
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 add_chat_cb(NULL, data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4745 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4746 else
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_widget_destroy(data->window);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4749 g_free(data->default_chat_name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4750 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4751 g_free(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4752 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4753 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4754
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4755 /*
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4756 * 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
4757 * 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
4758 */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4759 static void
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4760 addchat_set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4761 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4762 GaimGtkAddChatData *data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4763 GList *tmp;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4764 const char *text;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4765 gboolean required;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4766 gboolean sensitive = TRUE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4767
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4768 data = user_data;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4769
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4770 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4771 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4772 if (!g_object_get_data(tmp->data, "is_spin"))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4773 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4774 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4775 text = gtk_entry_get_text(tmp->data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4776 if (required && (*text == '\0'))
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4777 sensitive = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4778 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4779 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4780
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4781 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
4782 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4783
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4784 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4785 rebuild_addchat_entries(GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4786 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4787 GaimConnection *gc;
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4788 GList *list = NULL, *tmp = NULL;
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4789 GHashTable *defaults = NULL;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4790 struct proto_chat_entry *pce;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4791 gboolean focus = TRUE;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4792
10127
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4793 g_return_if_fail(data->account != NULL);
23e101b522f1 [gaim-migrate @ 11165]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10118
diff changeset
4794
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4795 gc = gaim_account_get_connection(data->account);
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 while (GTK_BOX(data->entries_box)->children)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4798 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4799 gtk_container_remove(GTK_CONTAINER(data->entries_box),
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4800 ((GtkBoxChild *)GTK_BOX(data->entries_box)->children->data)->widget);
7620
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 if (data->entries != NULL)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4804 g_list_free(data->entries);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4805
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4806 data->entries = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4807
9959
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4808 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
b6a74cbfd182 [gaim-migrate @ 10866]
Luke Schierer <lschiere@pidgin.im>
parents: 9954
diff changeset
4809 list = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4810
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4811 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
4812 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
4813
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4814 for (tmp = list; tmp; tmp = tmp->next)
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 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4817 GtkWidget *rowbox;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4818 GtkWidget *input;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4819
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4820 pce = tmp->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4821
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4822 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4823 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
4824
7889
7e1bb4deca24 [gaim-migrate @ 8547]
Nathan Walp <nwalp@pidgin.im>
parents: 7887
diff changeset
4825 label = gtk_label_new_with_mnemonic(pce->label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4826 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4827 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4828 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4829
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4830 if (pce->is_int)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4831 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4832 GtkObject *adjust;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4833 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4834 1, 10, 10);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4835 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4836 gtk_widget_set_size_request(input, 50, -1);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4837 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
4838 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4839 else
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4840 {
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4841 char *value;
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4842 input = gtk_entry_new();
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4843 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4844 value = g_hash_table_lookup(defaults, pce->identifier);
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4845 if (value != NULL)
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4846 gtk_entry_set_text(GTK_ENTRY(input), value);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4847 if (pce->secret)
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4848 {
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4849 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
11986
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4850 gtk_entry_set_invisible_char(GTK_ENTRY(input), GAIM_INVISIBLE_CHAR);
bfbb1798535e [gaim-migrate @ 14279]
Mark Doliner <mark@kingant.net>
parents: 11983
diff changeset
4851 }
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4852 gtk_box_pack_end(GTK_BOX(rowbox), input, TRUE, TRUE, 0);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4853 g_signal_connect(G_OBJECT(input), "changed",
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4854 G_CALLBACK(addchat_set_sensitive_if_input_cb), data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4855 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4856
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4857 /* Do the following for any type of input widget */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4858 if (focus)
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4859 {
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4860 gtk_widget_grab_focus(input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4861 focus = FALSE;
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4862 }
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4863 gtk_label_set_mnemonic_widget(GTK_LABEL(label), input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4864 gaim_set_accessible_label(input, label);
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13090
diff changeset
4865 g_object_set_data(G_OBJECT(input), "identifier", (gpointer)pce->identifier);
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4866 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
4867 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
4868 data->entries = g_list_append(data->entries, input);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4869
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4870 g_free(pce);
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
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4873 g_list_free(list);
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4874 g_hash_table_destroy(defaults);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4875
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4876 /* Set whether the "OK" button should be clickable initially */
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4877 addchat_set_sensitive_if_input_cb(NULL, data);
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4878
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4879 gtk_widget_show_all(data->entries_box);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4880 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4881
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4882 static void
10475
94fd0bf8c4b1 [gaim-migrate @ 11762]
Mark Doliner <mark@kingant.net>
parents: 10439
diff changeset
4883 addchat_select_account_cb(GObject *w, GaimAccount *account,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4884 GaimGtkAddChatData *data)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4885 {
9460
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4886 if (strcmp(gaim_account_get_protocol_id(data->account),
eae7e049d639 [gaim-migrate @ 10285]
Luke Schierer <lschiere@pidgin.im>
parents: 9396
diff changeset
4887 gaim_account_get_protocol_id(account)) == 0)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4888 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4889 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4890 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4891 else
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 data->account = account;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4894 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4895 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4896 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4897
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
4898 static void
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
4899 gaim_gtk_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
9754
4a8bf81b82ae [gaim-migrate @ 10621]
Luke Schierer <lschiere@pidgin.im>
parents: 9753
diff changeset
4900 const char *alias, const char *name)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4901 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4902 GaimGtkAddChatData *data;
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4903 GaimGtkBuddyList *gtkblist;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4904 GList *l;
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4905 GaimConnection *gc;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4906 GtkWidget *label;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4907 GtkWidget *rowbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4908 GtkWidget *hbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4909 GtkWidget *vbox;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4910 GtkWidget *img;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4911
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4912 if (account != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4913 gc = gaim_account_get_connection(account);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4914
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4915 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4916 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
4917 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4918 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4919 } else {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4920 /* Find an account with chat capabilities */
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4921 for (l = gaim_connections_get_all(); l != NULL; l = l->next) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4922 gc = (GaimConnection *)l->data;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4923
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4924 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4925 account = gaim_connection_get_account(gc);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4926 break;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4927 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4928 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4929
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4930 if (account == NULL) {
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4931 gaim_notify_error(NULL, NULL,
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4932 _("You are not currently signed on with any "
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4933 "protocols that have the ability to chat."), NULL);
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4934 return;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4935 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4936 }
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4937
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4938 data = g_new0(GaimGtkAddChatData, 1);
9812
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4939 data->account = account;
d56f24cc4dad [gaim-migrate @ 10683]
Mark Doliner <mark@kingant.net>
parents: 9811
diff changeset
4940 data->default_chat_name = g_strdup(name);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4941
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4942 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4943 GTK_ICON_SIZE_DIALOG);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4944
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4945 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4946
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4947 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4948
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4949 data->window = gtk_dialog_new_with_buttons(_("Add Chat"),
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4950 NULL, GTK_DIALOG_NO_SEPARATOR,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4951 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4952 GTK_STOCK_ADD, GTK_RESPONSE_OK,
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4953 NULL);
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4954
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4955 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
4956 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
4957 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4958 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
4959 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
4960 gtk_window_set_role(GTK_WINDOW(data->window), "add_chat");
8975
574393ccd705 [gaim-migrate @ 9749]
Luke Schierer <lschiere@pidgin.im>
parents: 8960
diff changeset
4961 gtk_window_set_type_hint(GTK_WINDOW(data->window),
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4962 GDK_WINDOW_TYPE_HINT_DIALOG);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4963
11243
a511b77a368b [gaim-migrate @ 13408]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
4964 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4965 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4966 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4967 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4968
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4969 vbox = gtk_vbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4970 gtk_container_add(GTK_CONTAINER(hbox), vbox);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4971
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4972 label = gtk_label_new(
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4973 _("Please enter an alias, and the appropriate information "
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4974 "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
4975 gtk_widget_set_size_request(label, 400, -1);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4976 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4977 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4978 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4979
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4980 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4981 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4982
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4983 label = gtk_label_new(_("Account:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4984 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4985 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4986 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4987
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4988 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
4989 G_CALLBACK(addchat_select_account_cb),
9987
5eedb0a9093d [gaim-migrate @ 10900]
Luke Schierer <lschiere@pidgin.im>
parents: 9959
diff changeset
4990 chat_account_filter_func, data);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4991 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
4992 gaim_set_accessible_label (data->account_menu, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4993
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4994 data->entries_box = gtk_vbox_new(FALSE, 5);
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
4995 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
4996 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
4997
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4998 rebuild_addchat_entries(data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
4999
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5000 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5001 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5002
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5003 label = gtk_label_new(_("Alias:"));
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5004 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5005 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5006 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
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 data->alias_entry = gtk_entry_new();
7859
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
5009 if (alias != NULL)
e873d0bd0e6c [gaim-migrate @ 8513]
Mark Doliner <mark@kingant.net>
parents: 7856
diff changeset
5010 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5011 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
5012 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
5013 gaim_set_accessible_label (data->alias_entry, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5014
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5015 rowbox = gtk_hbox_new(FALSE, 5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5016 gtk_box_pack_start(GTK_BOX(vbox), rowbox, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5017
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5018 label = gtk_label_new(_("Group:"));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5019 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5020 gtk_size_group_add_widget(data->sg, label);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5021 gtk_box_pack_start(GTK_BOX(rowbox), label, FALSE, FALSE, 0);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5022
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5023 data->group_combo = gtk_combo_new();
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5024 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
5025 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
5026
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5027 if (group)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5028 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5029 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
5030 group->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5031 }
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8122
diff changeset
5032 gaim_set_accessible_label (data->group_combo, label);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5033
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5034 g_signal_connect(G_OBJECT(data->window), "response",
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5035 G_CALLBACK(add_chat_resp_cb), data);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5036
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5037 gtk_widget_show_all(data->window);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5038 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5039
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5040 static void
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5041 add_group_cb(GaimConnection *gc, const char *group_name)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5042 {
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
5043 GaimGroup *group;
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
5044
12458
8626cc8d0df9 [gaim-migrate @ 14767]
Mark Doliner <mark@kingant.net>
parents: 12450
diff changeset
5045 if ((group_name == NULL) || (*group_name == '\0'))
8626cc8d0df9 [gaim-migrate @ 14767]
Mark Doliner <mark@kingant.net>
parents: 12450
diff changeset
5046 return;
8626cc8d0df9 [gaim-migrate @ 14767]
Mark Doliner <mark@kingant.net>
parents: 12450
diff changeset
5047
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
5048 group = gaim_group_new(group_name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9236
diff changeset
5049 gaim_blist_add_group(group, NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5050 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5051
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5052 static void
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5053 gaim_gtk_blist_request_add_group(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5054 {
7853
340df1652af1 [gaim-migrate @ 8507]
Mark Doliner <mark@kingant.net>
parents: 7843
diff changeset
5055 gaim_request_input(NULL, _("Add Group"), NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5056 _("Please enter the name of the group to be added."),
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8592
diff changeset
5057 NULL, FALSE, FALSE, NULL,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5058 _("Add"), G_CALLBACK(add_group_cb),
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5059 _("Cancel"), NULL, NULL);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5060 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5061
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5062 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5063 gaim_gtk_blist_toggle_visibility()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5064 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5065 if (gtkblist && gtkblist->window) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5066 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5067 gaim_blist_set_visible(GAIM_WINDOW_ICONIFIED(gtkblist->window) || gtk_blist_obscured);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5068 } else {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5069 gaim_blist_set_visible(TRUE);
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5070 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5071 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5072 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5073
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5074 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5075 gaim_gtk_blist_visibility_manager_add()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5076 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5077 visibility_manager_count++;
12479
53e2dc07d9e2 [gaim-migrate @ 14790]
Richard Laager <rlaager@wiktel.com>
parents: 12478
diff changeset
5078 gaim_debug_info("gtkblist", "added visibility manager: %d\n", visibility_manager_count);
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5079 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5080
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5081 void
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5082 gaim_gtk_blist_visibility_manager_remove()
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5083 {
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5084 if (visibility_manager_count)
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5085 visibility_manager_count--;
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5086 if (!visibility_manager_count)
13674
183c177d8cdd [gaim-migrate @ 16076]
Mark Doliner <mark@kingant.net>
parents: 13670
diff changeset
5087 gaim_blist_set_visible(TRUE);
12479
53e2dc07d9e2 [gaim-migrate @ 14790]
Richard Laager <rlaager@wiktel.com>
parents: 12478
diff changeset
5088 gaim_debug_info("gtkblist", "removed visibility manager: %d\n", visibility_manager_count);
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5089 }
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5090
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5091
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5092 static GaimBlistUiOps blist_ui_ops =
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5093 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5094 gaim_gtk_blist_new_list,
5256
1d1c45d9b7fc [gaim-migrate @ 5628]
Luke Schierer <lschiere@pidgin.im>
parents: 5254
diff changeset
5095 gaim_gtk_blist_new_node,
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5096 gaim_gtk_blist_show,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5097 gaim_gtk_blist_update,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5098 gaim_gtk_blist_remove,
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5099 gaim_gtk_blist_destroy,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5100 gaim_gtk_blist_set_visible,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5101 gaim_gtk_blist_request_add_buddy,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5102 gaim_gtk_blist_request_add_chat,
10012
a38881ec9c0f [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
5103 gaim_gtk_blist_request_add_group
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5104 };
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5105
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5106
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5107 GaimBlistUiOps *
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5108 gaim_gtk_blist_get_ui_ops(void)
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5109 {
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5110 return &blist_ui_ops;
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5111 }
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5112
10643
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
5113 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist()
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
5114 {
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
5115 return gtkblist;
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
5116 }
868aafbe859b [gaim-migrate @ 12153]
Sean Egan <seanegan@gmail.com>
parents: 10623
diff changeset
5117
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5118 static void account_signon_cb(GaimConnection *gc, gpointer z)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5119 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5120 GaimAccount *account = gaim_connection_get_account(gc);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5121 GaimBlistNode *gnode, *cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5122 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5123 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5124 if(!GAIM_BLIST_NODE_IS_GROUP(gnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5125 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5126 for(cnode = gnode->child; cnode; cnode = cnode->next)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5127 {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5128 GaimChat *chat;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5129
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5130 if(!GAIM_BLIST_NODE_IS_CHAT(cnode))
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5131 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5132
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5133 chat = (GaimChat *)cnode;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5134
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5135 if(chat->account != account)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5136 continue;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5137
8197
7c45eb829340 [gaim-migrate @ 8919]
Nathan Walp <nwalp@pidgin.im>
parents: 8143
diff changeset
5138 if(gaim_blist_node_get_bool((GaimBlistNode*)chat, "gtk-autojoin") ||
8198
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
5139 (gaim_blist_node_get_string((GaimBlistNode*)chat,
9f174d0222bd [gaim-migrate @ 8921]
Nathan Walp <nwalp@pidgin.im>
parents: 8197
diff changeset
5140 "gtk-autojoin") != NULL))
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5141 serv_join_chat(gc, chat->components);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5142 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5143 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5144 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5145
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5146 void *
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5147 gaim_gtk_blist_get_handle() {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5148 static int handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5149
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5150 return &handle;
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5151 }
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5152
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5153 static gboolean buddy_signonoff_timeout_cb(GaimBuddy *buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5154 {
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5155 struct _gaim_gtk_blist_node *gtknode = ((GaimBlistNode*)buddy)->ui_data;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5156
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5157 gtknode->recent_signonoff = FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5158 gtknode->recent_signonoff_timer = 0;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5159
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5160 gaim_gtk_blist_update(NULL, (GaimBlistNode*)buddy);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5161
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5162 return FALSE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5163 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5164
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5165 static void buddy_signonoff_cb(GaimBuddy *buddy)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5166 {
11915
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5167 struct _gaim_gtk_blist_node *gtknode;
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5168
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5169 if(!((GaimBlistNode*)buddy)->ui_data) {
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5170 gaim_gtk_blist_new_node((GaimBlistNode*)buddy);
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5171 }
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5172
31343023953c [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
5173 gtknode = ((GaimBlistNode*)buddy)->ui_data;
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5174
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5175 gtknode->recent_signonoff = TRUE;
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5176
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5177 if(gtknode->recent_signonoff_timer > 0)
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5178 gaim_timeout_remove(gtknode->recent_signonoff_timer);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5179 gtknode->recent_signonoff_timer = gaim_timeout_add(10000,
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5180 (GSourceFunc)buddy_signonoff_timeout_cb, buddy);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5181 }
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5182
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5183 void gaim_gtk_blist_init(void)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5184 {
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5185 void *gtk_blist_handle = gaim_gtk_blist_get_handle();
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5186
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5187 gaim_signal_connect(gaim_connections_get_handle(), "signed-on",
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5188 gtk_blist_handle, GAIM_CALLBACK(account_signon_cb),
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5189 NULL);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
5190
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
5191 /* Initialize prefs */
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5192 gaim_prefs_add_none("/gaim/gtk/blist");
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5193 gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5194 gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE);
12656
60cce1861e59 [gaim-migrate @ 14999]
Mark Doliner <mark@kingant.net>
parents: 12649
diff changeset
5195 gaim_prefs_add_bool("/gaim/gtk/blist/show_idle_time", TRUE);
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5196 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
5197 gaim_prefs_add_bool("/gaim/gtk/blist/list_visible", TRUE);
12279
234c25bc5d49 [gaim-migrate @ 14583]
Mark Doliner <mark@kingant.net>
parents: 12246
diff changeset
5198 gaim_prefs_add_bool("/gaim/gtk/blist/list_maximized", FALSE);
9711
b0ddfeccb9e6 [gaim-migrate @ 10572]
Mark Doliner <mark@kingant.net>
parents: 9709
diff changeset
5199 gaim_prefs_add_string("/gaim/gtk/blist/sort_type", "alphabetical");
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5200 gaim_prefs_add_int("/gaim/gtk/blist/x", 0);
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5201 gaim_prefs_add_int("/gaim/gtk/blist/y", 0);
9778
3d40125495e3 [gaim-migrate @ 10646]
Mark Doliner <mark@kingant.net>
parents: 9775
diff changeset
5202 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
5203 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
5204 gaim_prefs_add_int("/gaim/gtk/blist/tooltip_delay", 500);
7731
36727d6e1d5a [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
5205
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5206 /* Register our signals */
12016
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5207 gaim_signal_register(gtk_blist_handle, "gtkblist-hiding",
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5208 gaim_marshal_VOID__POINTER, NULL, 1,
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5209 gaim_value_new(GAIM_TYPE_POINTER));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5210
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5211 gaim_signal_register(gtk_blist_handle, "gtkblist-unhiding",
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5212 gaim_marshal_VOID__POINTER, NULL, 1,
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5213 gaim_value_new(GAIM_TYPE_SUBTYPE));
24c7fb94d3a3 [gaim-migrate @ 14309]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11988
diff changeset
5214
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5215 gaim_signal_register(gtk_blist_handle, "gtkblist-created",
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5216 gaim_marshal_VOID__POINTER, NULL, 1,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5217 gaim_value_new(GAIM_TYPE_SUBTYPE,
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5218 GAIM_SUBTYPE_BLIST));
8819
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5219
d7ed3a4bdf35 [gaim-migrate @ 9581]
Sean Egan <seanegan@gmail.com>
parents: 8817
diff changeset
5220 gaim_signal_register(gtk_blist_handle, "drawing-tooltip",
12713
d7043c3c793d [gaim-migrate @ 15057]
Richard Laager <rlaager@wiktel.com>
parents: 12679
diff changeset
5221 gaim_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5222 gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_BLIST_NODE),
12713
d7043c3c793d [gaim-migrate @ 15057]
Richard Laager <rlaager@wiktel.com>
parents: 12679
diff changeset
5223 gaim_value_new_outgoing(GAIM_TYPE_BOXED, "GString *"),
d7043c3c793d [gaim-migrate @ 15057]
Richard Laager <rlaager@wiktel.com>
parents: 12679
diff changeset
5224 gaim_value_new(GAIM_TYPE_BOOLEAN));
11910
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5225
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5226
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5227 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
700ec4523c04 [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
5228 gaim_signal_connect(gaim_blist_get_handle(), "buddy-signed-off", gtk_blist_handle, GAIM_CALLBACK(buddy_signonoff_cb), NULL);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5229 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5230
8815
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5231 void
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5232 gaim_gtk_blist_uninit(void) {
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5233 gaim_signals_unregister_by_instance(gaim_gtk_blist_get_handle());
ada0cf2f49fe [gaim-migrate @ 9577]
Luke Schierer <lschiere@pidgin.im>
parents: 8710
diff changeset
5234 }
5228
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5235
1a53330dfd34 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5236 /*********************************************************************
9811
a107051d991f [gaim-migrate @ 10682]
Mark Doliner <mark@kingant.net>
parents: 9791
diff changeset
5237 * Buddy List sorting functions *
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5238 *********************************************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5239
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5240 GList *gaim_gtk_blist_get_sort_methods()
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5241 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5242 return gaim_gtk_blist_sort_methods;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5243 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5244
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5245 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
5246 {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5247 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
5248 method->id = g_strdup(id);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5249 method->name = g_strdup(name);
9775
4c1a1be8ce33 [gaim-migrate @ 10643]
Mark Doliner <mark@kingant.net>
parents: 9774
diff changeset
5250 method->func = func;
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5251 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
5252 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5253 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5254
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5255 void gaim_gtk_blist_sort_method_unreg(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5256 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5257
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5258 while(l) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5259 struct gaim_gtk_blist_sort_method *method = l->data;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5260 if(!strcmp(method->id, id)) {
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5261 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
5262 g_free(method->id);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5263 g_free(method->name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5264 g_free(method);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5265 break;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5266 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5267 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5268 gaim_gtk_blist_update_sort_methods();
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5269 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5270
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5271 void gaim_gtk_blist_sort_method_set(const char *id){
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5272 GList *l = gaim_gtk_blist_sort_methods;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5273
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5274 if(!id)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5275 id = "none";
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5276
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5277 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
5278 l = l->next;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5279
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5280 if (l) {
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5281 current_sort_method = l->data;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5282 } else if (!current_sort_method) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5283 gaim_gtk_blist_sort_method_set("none");
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5284 return;
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5285 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5286 redo_buddy_list(gaim_get_blist(), TRUE);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5287
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5288 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5289
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5290 /******************************************
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5291 ** Sort Methods
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5292 ******************************************/
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5293
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5294 static void sort_method_none(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter parent_iter, GtkTreeIter *cur, GtkTreeIter *iter)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5295 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5296 GaimBlistNode *sibling = node->prev;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5297 GtkTreeIter sibling_iter;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5298
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5299 if (cur != NULL) {
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5300 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5301 return;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5302 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5303
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5304 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5305 sibling = sibling->prev;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5306 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5307
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5308 gtk_tree_store_insert_after(gtkblist->treemodel, iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5309 node->parent ? &parent_iter : NULL,
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5310 sibling ? &sibling_iter : NULL);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5311 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5312
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5313 #if GTK_CHECK_VERSION(2,2,1)
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5314
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5315 static void sort_method_alphabetical(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5316 {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5317 GtkTreeIter more_z;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5318
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5319 const char *my_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5320
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5321 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5322 my_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5323 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5324 my_name = gaim_chat_get_name((GaimChat*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5325 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5326 sort_method_none(node, blist, groupiter, cur, iter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5327 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5328 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5329
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5330
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5331 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5332 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5333 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5334 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5335
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5336 do {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5337 GValue val;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5338 GaimBlistNode *n;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5339 const char *this_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5340 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5341
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5342 val.g_type = 0;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5343 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
5344 n = g_value_get_pointer(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5345
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5346 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5347 this_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5348 } else if(GAIM_BLIST_NODE_IS_CHAT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5349 this_name = gaim_chat_get_name((GaimChat*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5350 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5351 this_name = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5352 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5353
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5354 cmp = gaim_utf8_strcasecmp(my_name, this_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5355
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5356 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5357 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5358 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5359 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5360 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5361 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5362 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5363 &groupiter, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5364 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5365 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5366 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5367 g_value_unset(&val);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5368 } 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
5369
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5370 if(cur) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5371 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5372 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5373 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5374 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5375 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5376 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5377 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5378 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5379
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5380 static void sort_method_status(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5381 {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5382 GtkTreeIter more_z;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5383
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5384 GaimBuddy *my_buddy, *this_buddy;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5385
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5386 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5387 my_buddy = gaim_contact_get_priority_buddy((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5388 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5389 if (cur != NULL) {
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5390 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5391 return;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5392 }
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5393
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5394 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5395 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5396 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5397 sort_method_none(node, blist, groupiter, cur, iter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5398 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5399 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5400
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5401
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5402 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5403 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5404 return;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5405 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5406
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5407 do {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5408 GValue val;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5409 GaimBlistNode *n;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5410 gint name_cmp;
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5411 gint presence_cmp;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5412
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5413 val.g_type = 0;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5414 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
5415 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5416
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5417 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5418 this_buddy = gaim_contact_get_priority_buddy((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5419 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5420 this_buddy = NULL;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5421 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5422
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5423 name_cmp = gaim_utf8_strcasecmp(
13670
a373da801dc1 [gaim-migrate @ 16072]
Richard Laager <rlaager@wiktel.com>
parents: 13629
diff changeset
5424 gaim_contact_get_alias(gaim_buddy_get_contact(my_buddy)),
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5425 (this_buddy
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5426 ? gaim_contact_get_alias(gaim_buddy_get_contact(this_buddy))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5427 : NULL));
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5428
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5429 presence_cmp = gaim_presence_compare(
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5430 gaim_buddy_get_presence(my_buddy),
13689
5fb687f9965c [gaim-migrate @ 16092]
Richard Laager <rlaager@wiktel.com>
parents: 13684
diff changeset
5431 this_buddy ? gaim_buddy_get_presence(this_buddy) : NULL);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5432
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5433 if (this_buddy == NULL ||
10860
d01d81de94d8 [gaim-migrate @ 12543]
Mark Doliner <mark@kingant.net>
parents: 10850
diff changeset
5434 (presence_cmp < 0 ||
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5435 (presence_cmp == 0 &&
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5436 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5437 {
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5438 if (cur != NULL)
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5439 {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5440 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5441 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5442 return;
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5443 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5444 else
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5445 {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5446 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5447 &groupiter, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5448 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5449 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5450 }
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5451
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5452 g_value_unset(&val);
9944
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5453 }
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5454 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
e4a27c9aec4c [gaim-migrate @ 10838]
Luke Schierer <lschiere@pidgin.im>
parents: 9925
diff changeset
5455 &more_z));
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5456
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5457 if (cur) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5458 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5459 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5460 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5461 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5462 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5463 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5464 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5465 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5466
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5467 static void sort_method_log(GaimBlistNode *node, GaimBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5468 {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5469 GtkTreeIter more_z;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5470
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5471 int log_size = 0, this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5472 const char *buddy_name, *this_buddy_name;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5473
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5474 if(cur && (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter) == 1)) {
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5475 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5476 return;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5477 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5478
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5479 if(GAIM_BLIST_NODE_IS_CONTACT(node)) {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5480 GaimBlistNode *n;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5481 for (n = node->child; n; n = n->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5482 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
5483 buddy_name = gaim_contact_get_alias((GaimContact*)node);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5484 } else if(GAIM_BLIST_NODE_IS_CHAT(node)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5485 /* 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
5486 * from the chat info in the blist, yet */
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5487 if (cur != NULL) {
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5488 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5489 return;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5490 }
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5491
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5492 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5493 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5494 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5495 sort_method_none(node, blist, groupiter, cur, iter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5496 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5497 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5498
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5499
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5500 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5501 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5502 return;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5503 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5504
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5505 do {
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5506 GValue val;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5507 GaimBlistNode *n;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5508 GaimBlistNode *n2;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5509 int cmp;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5510
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12592
diff changeset
5511 val.g_type = 0;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5512 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
5513 n = g_value_get_pointer(&val);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5514 this_log_size = 0;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5515
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5516 if(GAIM_BLIST_NODE_IS_CONTACT(n)) {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5517 for (n2 = n->child; n2; n2 = n2->next)
8898
de87e510ff9a [gaim-migrate @ 9667]
Mark Doliner <mark@kingant.net>
parents: 8861
diff changeset
5518 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
5519 this_buddy_name = gaim_contact_get_alias((GaimContact*)n);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5520 } else {
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5521 this_buddy_name = NULL;
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5522 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5523
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5524 cmp = gaim_utf8_strcasecmp(buddy_name, this_buddy_name);
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5525
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5526 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
5527 ((log_size == this_log_size) &&
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5528 (cmp < 0 || (cmp == 0 && node < n)))) {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5529 if (cur != NULL) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5530 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5531 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5532 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5533 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5534 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5535 &groupiter, &more_z);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5536 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5537 }
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5538 }
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5539 g_value_unset(&val);
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5540 } 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
5541
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5542 if (cur != NULL) {
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5543 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5544 *iter = *cur;
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5545 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5546 } else {
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5547 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5548 return;
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5549 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5550 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5551
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5552 #endif
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5553
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5554 static void
13196
f04dffe22957 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13195
diff changeset
5555 plugin_act(GtkObject *obj, GaimPluginAction *pam)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5556 {
13196
f04dffe22957 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13195
diff changeset
5557 if (pam && pam->callback)
10352
5879593a6a10 [gaim-migrate @ 11569]
Mark Doliner <mark@kingant.net>
parents: 10351
diff changeset
5558 pam->callback(pam);
5422
af62169c74fd [gaim-migrate @ 5801]
Sean Egan <seanegan@gmail.com>
parents: 5419
diff changeset
5559 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5560
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5561 static void
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5562 build_plugin_actions(GtkWidget *menu, GaimPlugin *plugin)
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5563 {
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5564 GtkWidget *menuitem;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5565 GaimPluginAction *action = NULL;
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5566 GList *actions, *l;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5567
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5568 actions = GAIM_PLUGIN_ACTIONS(plugin, NULL);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5569
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5570 for (l = actions; l != NULL; l = l->next)
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5571 {
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5572 if (l->data)
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5573 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5574 action = (GaimPluginAction *) l->data;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5575 action->plugin = plugin;
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5576 action->context = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5577
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5578 menuitem = gtk_menu_item_new_with_label(action->label);
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5579 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5580
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5581 g_signal_connect(G_OBJECT(menuitem), "activate",
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5582 G_CALLBACK(plugin_act), action);
13196
f04dffe22957 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13195
diff changeset
5583 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
f04dffe22957 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13195
diff changeset
5584 action,
f04dffe22957 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13195
diff changeset
5585 (GDestroyNotify)gaim_plugin_action_free);
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5586 gtk_widget_show(menuitem);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5587 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5588 else
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5589 gaim_separator(menu);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5590 }
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5591
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5592 g_list_free(actions);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5593 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5594
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5595 static void
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5596 modify_account_cb(GtkWidget *widget, gpointer data)
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5597 {
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5598 gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, data);
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5599 }
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5600
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5601 static void
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5602 enable_account_cb(GtkCheckMenuItem *widget, gpointer data)
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5603 {
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5604 GaimAccount *account = data;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5605 const GaimSavedStatus *saved_status;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5606
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5607 saved_status = gaim_savedstatus_get_current();
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5608 gaim_savedstatus_activate_for_account(saved_status, account);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5609
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5610 gaim_account_set_enabled(account, GAIM_GTK_UI, TRUE);
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5611 }
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5612
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5613 static void
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5614 disable_account_cb(GtkCheckMenuItem *widget, gpointer data)
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5615 {
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5616 GaimAccount *account = data;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5617
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5618 gaim_account_set_enabled(account, GAIM_GTK_UI, FALSE);
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5619 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5620
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5621 void
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5622 gaim_gtk_blist_update_accounts_menu(void)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5623 {
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5624 GtkWidget *menuitem = NULL, *submenu = NULL;
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5625 GList *l = NULL, *accounts = NULL;
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5626 gboolean disabled_accounts = FALSE;
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5627
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5628 if (accountmenu == NULL)
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5629 return;
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5630
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5631 /* Clear the old Accounts menu */
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5632 for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = l->next) {
12348
4f7797a3024b [gaim-migrate @ 14652]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12341
diff changeset
5633 menuitem = l->data;
4f7797a3024b [gaim-migrate @ 14652]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12341
diff changeset
5634
4f7797a3024b [gaim-migrate @ 14652]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12341
diff changeset
5635 if (menuitem != gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts/Add\\/Edit")))
4f7797a3024b [gaim-migrate @ 14652]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12341
diff changeset
5636 gtk_container_remove(GTK_CONTAINER(accountmenu),
13132
ba82cc4d1abd [gaim-migrate @ 15494]
Richard Laager <rlaager@wiktel.com>
parents: 13106
diff changeset
5637 menuitem);
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5638 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5639
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5640 for (accounts = gaim_accounts_get_all(); accounts; accounts = accounts->next) {
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5641 char *buf = NULL;
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5642 GtkWidget *image = NULL;
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5643 GaimConnection *gc = NULL;
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5644 GaimAccount *account = NULL;
12300
6487e68dcef9 [gaim-migrate @ 14604]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12298
diff changeset
5645 GaimStatus *status = NULL;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5646 GdkPixbuf *pixbuf = NULL;
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5647
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5648 account = accounts->data;
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5649
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5650 if(gaim_account_get_enabled(account, GAIM_GTK_UI)) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5651 buf = g_strconcat(gaim_account_get_username(account), " (",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5652 gaim_account_get_protocol_name(account), ")", NULL);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5653 menuitem = gtk_image_menu_item_new_with_label(buf);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5654 g_free(buf);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5655 status = gaim_account_get_active_status(account);
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5656 pixbuf = gaim_gtk_create_prpl_icon_with_status(account, gaim_status_get_type(status), 0.5);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5657 if (pixbuf != NULL)
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5658 {
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5659 if (!gaim_account_is_connected(account))
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5660 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf,
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5661 0.0, FALSE);
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5662 image = gtk_image_new_from_pixbuf(pixbuf);
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5663 g_object_unref(G_OBJECT(pixbuf));
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5664 gtk_widget_show(image);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5665 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5666 }
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5667 gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5668 gtk_widget_show(menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5669
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5670 submenu = gtk_menu_new();
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5671 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5672 gtk_widget_show(submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5673
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5674
12334
2823118073fa [gaim-migrate @ 14638]
Mark Doliner <mark@kingant.net>
parents: 12333
diff changeset
5675 menuitem = gtk_menu_item_new_with_mnemonic(_("_Edit Account"));
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5676 g_signal_connect(G_OBJECT(menuitem), "activate",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5677 G_CALLBACK(modify_account_cb), account);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5678 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5679 gtk_widget_show(menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5680
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5681 gaim_separator(submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5682
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5683 gc = gaim_account_get_connection(account);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5684 if (gc && GAIM_CONNECTION_IS_CONNECTED(gc)) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5685 GaimPlugin *plugin = NULL;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5686
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5687 plugin = gc->prpl;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5688 if (GAIM_PLUGIN_HAS_ACTIONS(plugin)) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5689 GList *l, *ll = NULL;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5690 GaimPluginAction *action = NULL;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5691
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5692 for (l = ll = GAIM_PLUGIN_ACTIONS(plugin, gc); l; l = l->next) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5693 if (l->data) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5694 action = (GaimPluginAction *)l->data;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5695 action->plugin = plugin;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5696 action->context = gc;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5697
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5698 menuitem = gtk_menu_item_new_with_label(action->label);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5699 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5700 g_signal_connect(G_OBJECT(menuitem), "activate",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5701 G_CALLBACK(plugin_act), action);
13755
2790a5f877f7 [gaim-migrate @ 16166]
Mark Doliner <mark@kingant.net>
parents: 13751
diff changeset
5702 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", action, (GDestroyNotify)gaim_plugin_action_free);
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5703 gtk_widget_show(menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5704 } else
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5705 gaim_separator(submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5706 }
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5707 } else {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5708 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5709 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5710 gtk_widget_set_sensitive(menuitem, FALSE);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5711 gtk_widget_show(menuitem);
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5712 }
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5713 } else {
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5714 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5715 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5716 gtk_widget_set_sensitive(menuitem, FALSE);
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5717 gtk_widget_show(menuitem);
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5718 }
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5719
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5720 gaim_separator(submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5721
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5722 menuitem = gtk_menu_item_new_with_mnemonic(_("_Disable"));
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5723 g_signal_connect(G_OBJECT(menuitem), "activate",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5724 G_CALLBACK(disable_account_cb), account);
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5725 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5726 gtk_widget_show(menuitem);
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5727 } else {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5728 disabled_accounts = TRUE;
12296
2f4577ae3810 [gaim-migrate @ 14600]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12279
diff changeset
5729 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5730 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5731
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5732 if(disabled_accounts) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5733 gaim_separator(accountmenu);
12338
1f6aac820540 [gaim-migrate @ 14642]
Mark Doliner <mark@kingant.net>
parents: 12337
diff changeset
5734 menuitem = gtk_menu_item_new_with_label(_("Enable Account"));
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5735 gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5736 gtk_widget_show(menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5737
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5738 submenu = gtk_menu_new();
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5739 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5740 gtk_widget_show(submenu);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5741
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5742 for (accounts = gaim_accounts_get_all(); accounts; accounts = accounts->next) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5743 char *buf = NULL;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5744 GtkWidget *image = NULL;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5745 GaimAccount *account = NULL;
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5746 GdkPixbuf *pixbuf = NULL;
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5747
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5748 account = accounts->data;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5749
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5750 if(!gaim_account_get_enabled(account, GAIM_GTK_UI)) {
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5751
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5752 disabled_accounts = TRUE;
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5753
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5754 buf = g_strconcat(gaim_account_get_username(account), " (",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5755 gaim_account_get_protocol_name(account), ")", NULL);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5756 menuitem = gtk_image_menu_item_new_with_label(buf);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5757 g_free(buf);
13090
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5758 pixbuf = gaim_gtk_create_prpl_icon(account, 0.5);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5759 if (pixbuf != NULL)
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5760 {
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5761 if (!gaim_account_is_connected(account))
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5762 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
0aa231ebbfd5 [gaim-migrate @ 15452]
Mark Doliner <mark@kingant.net>
parents: 13049
diff changeset
5763 image = gtk_image_new_from_pixbuf(pixbuf);
12330
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5764 g_object_unref(G_OBJECT(pixbuf));
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5765 gtk_widget_show(image);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5766 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5767 }
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5768 g_signal_connect(G_OBJECT(menuitem), "activate",
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5769 G_CALLBACK(enable_account_cb), account);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5770 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5771 gtk_widget_show(menuitem);
607108495e92 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
5772 }
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5773 }
7620
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5774 }
4f41c4aa9913 [gaim-migrate @ 8244]
Sean Egan <seanegan@gmail.com>
parents: 5516
diff changeset
5775 }
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5776
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5777 static GList *plugin_submenus = NULL;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5778
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5779 void
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5780 gaim_gtk_blist_update_plugin_actions(void)
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5781 {
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5782 GtkWidget *menuitem, *submenu;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 9013
diff changeset
5783 GaimPlugin *plugin = NULL;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5784 GList *l;
12464
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5785 GtkAccelGroup *accel_group;
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5786
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5787 GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools"));
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5788
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5789 g_return_if_fail(pluginmenu != NULL);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5790
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5791 /* Remove old plugin action submenus from the Tools menu */
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5792 for (l = plugin_submenus; l; l = l->next)
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5793 {
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5794 GList *menuitems;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5795
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5796 submenu = l->data;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5797
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5798 menuitems = gtk_container_get_children(GTK_CONTAINER(submenu));
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5799 while (menuitems != NULL)
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5800 {
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5801 GaimPluginAction *action;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5802 menuitem = menuitems->data;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5803 action = g_object_get_data(G_OBJECT(menuitem), "plugin_action");
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5804 g_free(action);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5805 menuitems = g_list_delete_link(menuitems, menuitems);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5806 }
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5807
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5808 gtk_container_remove(GTK_CONTAINER(pluginmenu), GTK_WIDGET(submenu));
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5809 }
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5810 g_list_free(plugin_submenus);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5811 plugin_submenus = NULL;
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5812
12464
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5813 accel_group = gtk_menu_get_accel_group(GTK_MENU(pluginmenu));
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5814
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5815 /* Add a submenu for each plugin with custom actions */
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5816 for (l = gaim_plugins_get_loaded(); l; l = l->next) {
12464
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5817 char *path;
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5818
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5819 plugin = (GaimPlugin *) l->data;
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5820
11742
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5821 if (GAIM_IS_PROTOCOL_PLUGIN(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5822 continue;
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5823
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5824 if (!GAIM_PLUGIN_HAS_ACTIONS(plugin))
dfb66f3f9e87 [gaim-migrate @ 14033]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
5825 continue;
9019
db1dc2d02020 [gaim-migrate @ 9795]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
5826
13336
999571d910ed [gaim-migrate @ 15706]
Richard Laager <rlaager@wiktel.com>
parents: 13315
diff changeset
5827 menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name));
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5828 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5829 gtk_widget_show(menuitem);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5830
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5831 plugin_submenus = g_list_append(plugin_submenus, menuitem);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5832
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5833 submenu = gtk_menu_new();
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5834 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5835 gtk_widget_show(submenu);
12464
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5836
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5837 gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5838 path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name);
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5839 gtk_menu_set_accel_path(GTK_MENU(submenu), path);
2b08a27c2342 [gaim-migrate @ 14774]
Richard Laager <rlaager@wiktel.com>
parents: 12461
diff changeset
5840 g_free(path);
12333
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5841
354af9ab4ed3 [gaim-migrate @ 14637]
Mark Doliner <mark@kingant.net>
parents: 12330
diff changeset
5842 build_plugin_actions(submenu, plugin);
8986
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5843 }
8cf32769ba1b [gaim-migrate @ 9761]
Luke Schierer <lschiere@pidgin.im>
parents: 8975
diff changeset
5844 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5845
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
5846 static void
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
5847 sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id)
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5848 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5849 if (gtk_check_menu_item_get_active(checkmenuitem))
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5850 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
5851 gaim_gtk_set_cursor(gtkblist->window, GDK_WATCH);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5852
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5853 gaim_gtk_blist_sort_method_set(id);
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5854 gaim_prefs_set_string("/gaim/gtk/blist/sort_type", id);
12413
0332daad85ae [gaim-migrate @ 14720]
Richard Laager <rlaager@wiktel.com>
parents: 12368
diff changeset
5855
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13375
diff changeset
5856 gaim_gtk_clear_cursor(gtkblist->window);
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5857 }
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5858 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5859
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5860 void
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5861 gaim_gtk_blist_update_sort_methods(void)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5862 {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5863 GtkWidget *menuitem = NULL, *activeitem = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5864 GaimGtkBlistSortMethod *method = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5865 GList *l;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5866 GSList *sl = NULL;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5867 GtkWidget *sortmenu;
11797
e6bbf34b2465 [gaim-migrate @ 14088]
Nathan Walp <nwalp@pidgin.im>
parents: 11796
diff changeset
5868 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
5869
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5870 if (gtkblist == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5871 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5872
11798
01c3eec6ea3c [gaim-migrate @ 14089]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11797
diff changeset
5873 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
5874
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5875 if (sortmenu == NULL)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5876 return;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5877
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5878 /* Clear the old menu */
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5879 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
5880 menuitem = l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5881 gtk_widget_destroy(GTK_WIDGET(menuitem));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5882 }
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5883
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5884 for (l = gaim_gtk_blist_sort_methods; l; l = l->next) {
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5885 method = (GaimGtkBlistSortMethod *) l->data;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5886 menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name));
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5887 if (!strcmp(m, method->id))
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5888 activeitem = menuitem;
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5889 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
5890 gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem);
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5891 g_signal_connect(G_OBJECT(menuitem), "toggled",
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5892 G_CALLBACK(sortmethod_act), method->id);
11923
ab0f16a72e89 [gaim-migrate @ 14214]
Mark Doliner <mark@kingant.net>
parents: 11920
diff changeset
5893 gtk_widget_show(menuitem);
11796
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5894 }
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5895 if (activeitem)
b9b7a010b043 [gaim-migrate @ 14087]
Sean Egan <seanegan@gmail.com>
parents: 11768
diff changeset
5896 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
5897 }