pidgin/gtkblist.c

Wed, 24 Aug 2011 15:06:36 +0000

author
Daniel Atallah <datallah@pidgin.im>
date
Wed, 24 Aug 2011 15:06:36 +0000
changeset 32229
f4aa2edf2735
parent 32191
a4668d9dc8d1
child 32315
2550a39e0285
child 32433
f539a2c083b2
permissions
-rw-r--r--

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 73c3b1db23643c3eef6a98297c1bb7ff59f07ff3)
to branch 'im.pidgin.pidgin' (head 047f1f9df60d36d0abcd494bcc0efebbf6d075d4)

5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /*
10297
b36800725b7a [gaim-migrate @ 11480]
Evan Schoenberg <evands@pidgin.im>
parents: 10288
diff changeset
2 * @file gtkblist.c GTK+ BuddyList API
16254
eeb2bba4dc94 Rename the Doxygen group from gtkui to pidgin.
Richard Laager <rlaager@pidgin.im>
parents: 16184
diff changeset
3 * @ingroup pidgin
20330
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20322
diff changeset
4 */
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20322
diff changeset
5
650a7af9c238 remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@pidgin.im>
parents: 20322
diff changeset
6 /* pidgin
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
15931
716b5fac1895 Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents: 15884
diff changeset
8 * Pidgin is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8040
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8040
diff changeset
10 * source distribution.
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * (at your option) any later version.
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * GNU General Public License for more details.
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19802
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 */
9791
f5c5bda0b96b [gaim-migrate @ 10659]
Gary Kramlich <grim@pidgin.im>
parents: 9778
diff changeset
27 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15571
diff changeset
28 #include "pidgin.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
29
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
30 #include "account.h"
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
31 #include "connection.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
32 #include "core.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
33 #include "debug.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
34 #include "notify.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
35 #include "prpl.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
36 #include "prefs.h"
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
37 #include "plugin.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
38 #include "request.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
39 #include "signals.h"
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
40 #include "pidginstock.h"
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
41 #include "theme-loader.h"
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
42 #include "theme-manager.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
43 #include "util.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
44
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
45 #include "gtkaccount.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
46 #include "gtkblist.h"
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
47 #include "gtkcellrendererexpander.h"
18650
8a34ac83df75 - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18621
diff changeset
48 #include "gtkcertmgr.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
49 #include "gtkconv.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
50 #include "gtkdebug.h"
9709
2e73f176cc80 [gaim-migrate @ 10570]
Mark Doliner <markdoliner@pidgin.im>
parents: 9686
diff changeset
51 #include "gtkdialogs.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
52 #include "gtkft.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
53 #include "gtklog.h"
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
54 #include "gtkmenutray.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
55 #include "gtkpounce.h"
11740
2b605228ec11 [gaim-migrate @ 14031]
Sean Egan <seanegan@pidgin.im>
parents: 11732
diff changeset
56 #include "gtkplugin.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
57 #include "gtkprefs.h"
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
58 #include "gtkprivacy.h"
8113
6a2ffc66c022 [gaim-migrate @ 8817]
Tim Ringenbach <marv@pidgin.im>
parents: 8089
diff changeset
59 #include "gtkroomlist.h"
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents: 10623
diff changeset
60 #include "gtkstatusbox.h"
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents: 15091
diff changeset
61 #include "gtkscrollbook.h"
22443
7b8772af6bb7 Apply the custom smiley patches from #1187, from Jorge VillaseƱo (Masca) and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22429
diff changeset
62 #include "gtksmiley.h"
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
63 #include "gtkblist-theme.h"
24377
8d0bfda8402d renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 24376
diff changeset
64 #include "gtkblist-theme-loader.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
65 #include "gtkutils.h"
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
66 #include "pidgin/minidialog.h"
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
67 #include "pidgin/pidgintooltip.h"
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
68
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 #include <gdk/gdkkeysyms.h>
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 #include <gtk/gtk.h>
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
71 #include <gdk/gdk.h>
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
72
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
73 typedef struct
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
74 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
75 PurpleAccount *account;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
76 GtkWidget *window;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
77 GtkBox *vbox;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
78 GtkWidget *account_menu;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
79 GtkSizeGroup *sg;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
80 } PidginBlistRequestData;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
81
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
82 typedef struct
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
83 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
84 PidginBlistRequestData rq_data;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
85 GtkWidget *combo;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
86 GtkWidget *entry;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
87 GtkWidget *entry_for_alias;
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
88 GtkWidget *entry_for_invite;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
89
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
90 } PidginAddBuddyData;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
91
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
92 typedef struct
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
93 {
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
94 PidginBlistRequestData rq_data;
9812
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
95 gchar *default_chat_name;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
96 GList *entries;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
97 } PidginChatData;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
98
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
99 typedef struct
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
100 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
101 PidginChatData chat_data;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
102
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
103 GtkWidget *alias_entry;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
104 GtkWidget *group_combo;
20339
352f79e0c384 Add checkboxes for 'auto-join' and 'persistent' in the add-chat dialog. Closes #2248.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20338
diff changeset
105 GtkWidget *autojoin;
352f79e0c384 Add checkboxes for 'auto-join' and 'persistent' in the add-chat dialog. Closes #2248.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20338
diff changeset
106 GtkWidget *persistent;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
107 } PidginAddChatData;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
108
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
109 typedef struct
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
110 {
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
111 /** Used to hold error minidialogs. Gets packed
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
112 * inside PidginBuddyList.error_buttons
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
113 */
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
114 PidginScrollBook *error_scrollbook;
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
115
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
116 /** Pointer to the mini-dialog about having signed on elsewhere, if one
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
117 * is showing; @c NULL otherwise.
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
118 */
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
119 PidginMiniDialog *signed_on_elsewhere;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
120
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
121 PidginBlistTheme *current_theme;
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
122 } PidginBuddyListPrivate;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
123
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
124 #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
125 ((PidginBuddyListPrivate *)((list)->priv))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
126
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
127 static GtkWidget *accountmenu = NULL;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
129 static guint visibility_manager_count = 0;
21113
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
130 static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED;
22996
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
131 static gboolean gtk_blist_focused = FALSE;
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
132 static gboolean editing_blist = FALSE;
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
133
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
134 static GList *pidgin_blist_sort_methods = NULL;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
135 static struct pidgin_blist_sort_method *current_sort_method = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
136 static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
137
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
138 static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
139 static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
140 static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
141 static PidginBuddyList *gtkblist = NULL;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
142
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
143 static GList *groups_tree(void);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
144 static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list);
19701
d5c5982757d5 Do not try to update a buddy in the buddylist when there's no buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19672
diff changeset
145 static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *node, gboolean status_change);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
146 static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer data);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
147 static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
148 static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
149 static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
150 static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full);
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
151 static const char *item_factory_translate_func (const char *path, gpointer func_data);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
152 static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter);
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
153 static gboolean buddy_is_displayable(PurpleBuddy *buddy);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
154 static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
155 static void pidgin_blist_collapse_contact_cb(GtkWidget *w, PurpleBlistNode *node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
156 static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
157 static void pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node);
22429
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
158 static void set_urgent(void);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
159
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
160 typedef enum {
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
161 PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE = 1 << 0, /* Whether there's pending message in a conversation */
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
162 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK = 1 << 1, /* Whether there's a pending message in a chat that mentions our nick */
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
163 } PidginBlistNodeFlags;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
164
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
165 typedef struct _pidgin_blist_node {
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
166 GtkTreeRowReference *row;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
167 gboolean contact_expanded;
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
168 gboolean recent_signonoff;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
169 gint recent_signonoff_timer;
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
170 struct {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
171 PurpleConversation *conv;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
172 time_t last_message; /* timestamp for last displayed message */
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
173 PidginBlistNodeFlags flags;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
174 } conv;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
175 } PidginBlistNode;
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
176
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 /***************************************************
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 * Callbacks *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 ***************************************************/
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
180 static gboolean gtk_blist_visibility_cb(GtkWidget *w, GdkEventVisibility *event, gpointer data)
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
181 {
21113
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
182 GdkVisibilityState old_state = gtk_blist_visibility;
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
183 gtk_blist_visibility = event->state;
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
184
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
185 if (gtk_blist_visibility == GDK_VISIBILITY_FULLY_OBSCURED &&
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
186 old_state != GDK_VISIBILITY_FULLY_OBSCURED) {
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
187
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
188 /* no longer fully obscured */
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
189 pidgin_blist_refresh_timer(purple_get_blist());
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
190 }
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
191
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
192 /* continue to handle event normally */
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
193 return FALSE;
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
194 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
195
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
196 static gboolean gtk_blist_window_state_cb(GtkWidget *w, GdkEventWindowState *event, gpointer data)
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
197 {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
198 if(event->changed_mask & GDK_WINDOW_STATE_WITHDRAWN) {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
199 if(event->new_window_state & GDK_WINDOW_STATE_WITHDRAWN)
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
200 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE);
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
201 else {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
202 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
203 pidgin_blist_refresh_timer(purple_get_blist());
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
204 }
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
205 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
206
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
207 if(event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
208 if(event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
209 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", TRUE);
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
210 else
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
211 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE);
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
212 }
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
213
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
214 /* Refresh gtkblist if un-iconifying */
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
215 if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED){
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
216 if (!(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
217 pidgin_blist_refresh_timer(purple_get_blist());
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
218 }
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
219
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
220 return FALSE;
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
221 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 {
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
225 if(visibility_manager_count)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
226 purple_blist_set_visible(FALSE);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
227 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
228 purple_core_quit();
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 /* we handle everything, event should not propogate further */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231 return TRUE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 static gboolean gtk_blist_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data)
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 /* unfortunately GdkEventConfigure ignores the window gravity, but *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 * the only way we have of setting the position doesn't. we have to *
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
238 * call get_position because it does pay attention to the gravity. *
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
239 * this is inefficient and I agree it sucks, but it's more likely *
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
240 * to work correctly. - Robot101 */
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 gint x, y;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 /* check for visibility because when we aren't visible, this will *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 * give us bogus (0,0) coordinates. - xOr */
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
245 if (GTK_WIDGET_VISIBLE(w))
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 gtk_window_get_position(GTK_WINDOW(w), &x, &y);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
247 else
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
248 return FALSE; /* carry on normally */
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
249
13768
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
250 #ifdef _WIN32
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
251 /* Workaround for GTK+ bug # 169811 - "configure_event" is fired
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
252 * when the window is being maximized */
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
253 if (gdk_window_get_state(w->window)
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
254 & GDK_WINDOW_STATE_MAXIMIZED) {
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
255 return FALSE;
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
256 }
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
257 #endif
4bf36498e887 [gaim-migrate @ 16178]
Daniel Atallah <datallah@pidgin.im>
parents: 13757
diff changeset
258
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
259 /* don't save if nothing changed */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
260 if (x == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x") &&
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
261 y == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y") &&
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
262 event->width == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") &&
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
263 event->height == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/height")) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
264
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
265 return FALSE; /* carry on normally */
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
268 /* don't save off-screen positioning */
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
269 if (x + event->width < 0 ||
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
270 y + event->height < 0 ||
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
271 x > gdk_screen_width() ||
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
272 y > gdk_screen_height()) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
273
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
274 return FALSE; /* carry on normally */
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
275 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
276
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
277 /* ignore changes when maximized */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
278 if(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized"))
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
279 return FALSE;
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
280
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
281 /* store the position */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
282 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/x", x);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
283 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/y", y);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
284 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/width", event->width);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
285 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/blist/height", event->height);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
286
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287 /* continue to handle event normally */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 return FALSE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
291 static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
293 PurpleAccount *account = purple_buddy_get_account(b);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
294
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
295 pidgin_retrieve_user_info(purple_account_get_connection(account),
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
296 purple_buddy_get_name(b));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
299 static void gtk_blist_menu_im_cb(GtkWidget *w, PurpleBuddy *b)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
300 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
301 pidgin_dialogs_im_with_user(purple_buddy_get_account(b),
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
302 purple_buddy_get_name(b));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
303 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
304
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
305 #ifdef USE_VV
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
306 static void gtk_blist_menu_audio_call_cb(GtkWidget *w, PurpleBuddy *b)
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
307 {
26248
03954067f80e Remove some of the deprecated API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26236
diff changeset
308 purple_prpl_initiate_media(purple_buddy_get_account(b),
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
309 purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO);
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
310 }
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
311
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
312 static void gtk_blist_menu_video_call_cb(GtkWidget *w, PurpleBuddy *b)
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
313 {
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
314 /* if the buddy supports both audio and video, start a combined call,
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
315 otherwise start a pure video session */
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
316 if (purple_prpl_get_media_caps(purple_buddy_get_account(b),
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
317 purple_buddy_get_name(b)) &
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
318 PURPLE_MEDIA_CAPS_AUDIO_VIDEO) {
26248
03954067f80e Remove some of the deprecated API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26236
diff changeset
319 purple_prpl_initiate_media(purple_buddy_get_account(b),
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
320 purple_buddy_get_name(b), PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO);
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
321 } else {
26248
03954067f80e Remove some of the deprecated API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26236
diff changeset
322 purple_prpl_initiate_media(purple_buddy_get_account(b),
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
323 purple_buddy_get_name(b), PURPLE_MEDIA_VIDEO);
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
324 }
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
325 }
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
326
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
327 #endif
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
329 static void gtk_blist_menu_send_file_cb(GtkWidget *w, PurpleBuddy *b)
9466
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
330 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
331 PurpleAccount *account = purple_buddy_get_account(b);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
332
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
333 serv_send_file(purple_account_get_connection(account),
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
334 purple_buddy_get_name(b), NULL);
9466
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
335 }
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
336
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
337 static void gtk_blist_menu_move_to_cb(GtkWidget *w, PurpleBlistNode *node)
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
338 {
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
339 PurpleGroup *group = g_object_get_data(G_OBJECT(w), "groupnode");
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
340 purple_blist_add_contact((PurpleContact *)node, group, NULL);
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
341
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
342 }
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
343
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
344 static void gtk_blist_menu_autojoin_cb(GtkWidget *w, PurpleChat *chat)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
345 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
346 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin",
7693
1f736efbd12d [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
347 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
348 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
349
19811
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
350 static void gtk_blist_menu_persistent_cb(GtkWidget *w, PurpleChat *chat)
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
351 {
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
352 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent",
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
353 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)));
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
354 }
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
355
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
356 static PurpleConversation *
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
357 find_conversation_with_buddy(PurpleBuddy *buddy)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
358 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
359 PidginBlistNode *ui = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
360 if (ui)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
361 return ui->conv.conv;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
362 return purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
363 purple_buddy_get_name(buddy),
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
364 purple_buddy_get_account(buddy));
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
365 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
366
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
367 static void gtk_blist_join_chat(PurpleChat *chat)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
368 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
369 PurpleAccount *account;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
370 PurpleConversation *conv;
18280
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
371 PurplePluginProtocolInfo *prpl_info;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
372 GHashTable *components;
18280
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
373 const char *name;
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
374 char *chat_name;
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
375
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
376 account = purple_chat_get_account(chat);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
377 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
378
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
379 components = purple_chat_get_components(chat);
18280
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
380
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
381 if (prpl_info && prpl_info->get_chat_name)
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
382 chat_name = prpl_info->get_chat_name(components);
18280
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
383 else
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
384 chat_name = NULL;
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
385
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
386 if (chat_name)
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
387 name = chat_name;
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
388 else
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
389 name = purple_chat_get_name(chat);
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
390
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
391 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, name,
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
392 account);
12576
df739b5606f6 [gaim-migrate @ 14898]
Richard Laager <rlaager@pidgin.im>
parents: 12569
diff changeset
393
19592
f9a9d682f603 Reattach the gtk-ui to a conversation when the user wants to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19543
diff changeset
394 if (conv != NULL) {
f9a9d682f603 Reattach the gtk-ui to a conversation when the user wants to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19543
diff changeset
395 pidgin_conv_attach_to_conversation(conv);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
396 purple_conversation_present(conv);
19592
f9a9d682f603 Reattach the gtk-ui to a conversation when the user wants to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19543
diff changeset
397 }
12592
5e1ce1a49ddb [gaim-migrate @ 14922]
Richard Laager <rlaager@pidgin.im>
parents: 12589
diff changeset
398
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
399 serv_join_chat(purple_account_get_connection(account), components);
18280
418dc6f0b080 fix double clicking joined chat by asking the prpl what the real name of
Ka-Hing Cheung <khc@pidgin.im>
parents: 18278
diff changeset
400 g_free(chat_name);
12576
df739b5606f6 [gaim-migrate @ 14898]
Richard Laager <rlaager@pidgin.im>
parents: 12569
diff changeset
401 }
df739b5606f6 [gaim-migrate @ 14898]
Richard Laager <rlaager@pidgin.im>
parents: 12569
diff changeset
402
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
403 static void gtk_blist_menu_join_cb(GtkWidget *w, PurpleChat *chat)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
404 {
12576
df739b5606f6 [gaim-migrate @ 14898]
Richard Laager <rlaager@pidgin.im>
parents: 12569
diff changeset
405 gtk_blist_join_chat(chat);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
406 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
407
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
408 static void gtk_blist_renderer_editing_cancelled_cb(GtkCellRenderer *renderer, PurpleBuddyList *list)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
409 {
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
410 editing_blist = FALSE;
22044
d9e9194d9f8b Reset the 'editable' flag of the renderer after cancelling the edit. Fixes #4471.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22043
diff changeset
411 g_object_set(G_OBJECT(renderer), "editable", FALSE, NULL);
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
412 pidgin_blist_refresh(list);
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
413 }
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
414
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
415 static void gtk_blist_renderer_editing_started_cb(GtkCellRenderer *renderer,
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
416 GtkCellEditable *editable,
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
417 gchar *path_str,
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
418 gpointer user_data)
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
419 {
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
420 GtkTreeIter iter;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
421 GtkTreePath *path = NULL;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
422 PurpleBlistNode *node;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
423 const char *text = NULL;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
424
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
425 path = gtk_tree_path_new_from_string (path_str);
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
426 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
427 gtk_tree_path_free (path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
428 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
429
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
430 switch (purple_blist_node_get_type(node)) {
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
431 case PURPLE_BLIST_CONTACT_NODE:
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
432 text = purple_contact_get_alias(PURPLE_CONTACT(node));
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
433 break;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
434 case PURPLE_BLIST_BUDDY_NODE:
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
435 text = purple_buddy_get_alias(PURPLE_BUDDY(node));
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
436 break;
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
437 case PURPLE_BLIST_GROUP_NODE:
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
438 text = purple_group_get_name(PURPLE_GROUP(node));
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
439 break;
29242
6b8df184118e We allow aliasing chats. So don't show an error message when we try to.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28756
diff changeset
440 case PURPLE_BLIST_CHAT_NODE:
6b8df184118e We allow aliasing chats. So don't show an error message when we try to.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28756
diff changeset
441 text = purple_chat_get_name(PURPLE_CHAT(node));
6b8df184118e We allow aliasing chats. So don't show an error message when we try to.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28756
diff changeset
442 break;
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
443 default:
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
444 g_return_if_reached();
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
445 }
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
446
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
447 if (GTK_IS_ENTRY (editable)) {
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
448 GtkEntry *entry = GTK_ENTRY (editable);
17143
fbc8a7bdb006 Patch #702, Info not reset on URL redirect
Sean Egan <seanegan@pidgin.im>
parents: 17141
diff changeset
449 gtk_entry_set_text(entry, text);
fbc8a7bdb006 Patch #702, Info not reset on URL redirect
Sean Egan <seanegan@pidgin.im>
parents: 17141
diff changeset
450 }
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
451 editing_blist = TRUE;
16357
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
452 }
c23b4d440efd Patch #205, from SuperMMX. Fix a bug related to using F2 to alias
Mark Doliner <markdoliner@pidgin.im>
parents: 16284
diff changeset
453
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
454 static void
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
455 gtk_blist_do_personize(GList *merges)
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
456 {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
457 PurpleBlistNode *contact = NULL;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
458 int max = 0;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
459 GList *tmp;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
460
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
461 /* First, we find the contact to merge the rest of the buddies into.
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
462 * This will be the contact with the most buddies in it; ties are broken
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
463 * by which contact is higher in the list
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
464 */
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
465 for (tmp = merges; tmp; tmp = tmp->next) {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
466 PurpleBlistNode *node = tmp->data;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
467 PurpleBlistNode *b;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
468 PurpleBlistNodeType type;
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
469 int i = 0;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
470
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
471 type = purple_blist_node_get_type(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
472
28380
9c8c4319b5e9 I think this was the optimization they wanted when this first broke.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
473 if (type == PURPLE_BLIST_BUDDY_NODE) {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
474 node = purple_blist_node_get_parent(node);
28380
9c8c4319b5e9 I think this was the optimization they wanted when this first broke.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
475 type = purple_blist_node_get_type(node);
9c8c4319b5e9 I think this was the optimization they wanted when this first broke.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
476 }
9c8c4319b5e9 I think this was the optimization they wanted when this first broke.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
477
9c8c4319b5e9 I think this was the optimization they wanted when this first broke.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28375
diff changeset
478 if (type != PURPLE_BLIST_CONTACT_NODE)
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
479 continue;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
480
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
481 for (b = purple_blist_node_get_first_child(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
482 b;
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
483 b = purple_blist_node_get_sibling_next(b))
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
484 {
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
485 i++;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
486 }
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
487
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
488 if (i > max) {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
489 contact = node;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
490 max = i;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
491 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
492 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
493
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
494 if (contact == NULL)
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
495 return;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
496
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
497 /* Merge all those buddies into this contact */
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
498 for (tmp = merges; tmp; tmp = tmp->next) {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
499 PurpleBlistNode *node = tmp->data;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
500 if (purple_blist_node_get_type(node) == PURPLE_BLIST_BUDDY_NODE)
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
501 node = purple_blist_node_get_parent(node);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
502
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
503 if (node == contact)
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
504 continue;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
505
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
506 purple_blist_merge_contact((PurpleContact *)node, contact);
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
507 }
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
508
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
509 /* And show the expanded contact, so the people know what's going on */
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
510 pidgin_blist_expand_contact_cb(NULL, contact);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
511 g_list_free(merges);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
512 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
513
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
514 static void
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
515 gtk_blist_auto_personize(PurpleBlistNode *group, const char *alias)
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
516 {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
517 PurpleBlistNode *contact;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
518 PurpleBlistNode *buddy;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
519 GList *merges = NULL;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
520 int i = 0;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
521 char *a = g_utf8_casefold(alias, -1);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
522
24967
a8c2d07e2ac6 A totally untested struct hiding fix.
Richard Laager <rlaager@pidgin.im>
parents: 24952
diff changeset
523 for (contact = purple_blist_node_get_first_child(group);
a8c2d07e2ac6 A totally untested struct hiding fix.
Richard Laager <rlaager@pidgin.im>
parents: 24952
diff changeset
524 contact != NULL;
a8c2d07e2ac6 A totally untested struct hiding fix.
Richard Laager <rlaager@pidgin.im>
parents: 24952
diff changeset
525 contact = purple_blist_node_get_sibling_next(contact)) {
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
526 char *node_alias;
24967
a8c2d07e2ac6 A totally untested struct hiding fix.
Richard Laager <rlaager@pidgin.im>
parents: 24952
diff changeset
527 if (purple_blist_node_get_type(contact) != PURPLE_BLIST_CONTACT_NODE)
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
528 continue;
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
529
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
530 node_alias = g_utf8_casefold(purple_contact_get_alias((PurpleContact *)contact), -1);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
531 if (node_alias && !g_utf8_collate(node_alias, a)) {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
532 merges = g_list_append(merges, contact);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
533 i++;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
534 g_free(node_alias);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
535 continue;
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
536 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
537 g_free(node_alias);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
538
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
539 for (buddy = purple_blist_node_get_first_child(contact);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
540 buddy;
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
541 buddy = purple_blist_node_get_sibling_next(buddy))
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
542 {
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
543 if (purple_blist_node_get_type(buddy) != PURPLE_BLIST_BUDDY_NODE)
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
544 continue;
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
545
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
546 node_alias = g_utf8_casefold(purple_buddy_get_alias(PURPLE_BUDDY(buddy)), -1);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
547 if (node_alias && !g_utf8_collate(node_alias, a)) {
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
548 merges = g_list_append(merges, buddy);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
549 i++;
22045
b1573130a0f4 Do not prompt for an already merged contact. Fixes #4285.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22044
diff changeset
550 g_free(node_alias);
b1573130a0f4 Do not prompt for an already merged contact. Fixes #4285.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22044
diff changeset
551 break;
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
552 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
553 g_free(node_alias);
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
554 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
555 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
556 g_free(a);
22045
b1573130a0f4 Do not prompt for an already merged contact. Fixes #4285.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22044
diff changeset
557
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
558 if (i > 1)
20335
415a2e9e61b6 In the auto-personize code:
Richard Laager <rlaager@pidgin.im>
parents: 20322
diff changeset
559 {
20385
12f3ca2278fb More Hylke icons
Sean Egan <seanegan@pidgin.im>
parents: 20365
diff changeset
560 char *msg = g_strdup_printf(ngettext("You have %d contact named %s. Would you like to merge them?", "You currently have %d contacts named %s. Would you like to merge them?", i), i, alias);
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
561 purple_request_action(NULL, NULL, msg, _("Merging these contacts will cause them to share a single entry on the buddy list and use a single conversation window. "
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
562 "You can separate them again by choosing 'Expand' from the contact's context menu"), 0, NULL, NULL, NULL,
22624
c83bfcb0c828 I think "Yes" and "No" are better answers to "Would you like to merge these
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22620
diff changeset
563 merges, 2, _("_Yes"), PURPLE_CALLBACK(gtk_blist_do_personize), _("_No"), PURPLE_CALLBACK(g_list_free));
20335
415a2e9e61b6 In the auto-personize code:
Richard Laager <rlaager@pidgin.im>
parents: 20322
diff changeset
564 g_free(msg);
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
565 } else
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
566 g_list_free(merges);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
567 }
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
568
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
569 static void gtk_blist_renderer_edited_cb(GtkCellRendererText *text_rend, char *arg1,
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
570 char *arg2, PurpleBuddyList *list)
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
571 {
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
572 GtkTreeIter iter;
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
573 GtkTreePath *path;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
574 PurpleBlistNode *node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
575 PurpleGroup *dest;
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
576
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
577 editing_blist = FALSE;
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
578 path = gtk_tree_path_new_from_string (arg1);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
579 gtk_tree_model_get_iter (GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
580 gtk_tree_path_free (path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
581 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
582 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), TRUE);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
583 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", FALSE, NULL);
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
584
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
585 switch (purple_blist_node_get_type(node))
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
586 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
587 case PURPLE_BLIST_CONTACT_NODE:
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
588 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
589 PurpleContact *contact = PURPLE_CONTACT(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
590 struct _pidgin_blist_node *gtknode =
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
591 (struct _pidgin_blist_node *)purple_blist_node_get_ui_data(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
592
28197
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
593 /*
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
594 * XXX Using purple_contact_get_alias here breaks because we
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
595 * specifically want to check the contact alias only (i.e. not
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
596 * the priority buddy, which purple_contact_get_alias does).
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
597 * Adding yet another get_alias is evil, so figure this out
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
598 * later :-P
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
599 */
b7227d527672 Fix setting the alias on a metacontact when it's not expanded. This is a patch.
Paul Aurich <darkrain42@pidgin.im>
parents: 28077
diff changeset
600 if (contact->alias || gtknode->contact_expanded) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
601 purple_blist_alias_contact(contact, arg2);
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
602 gtk_blist_auto_personize(purple_blist_node_get_parent(node), arg2);
20303
da2af1824307 Auto-personization. Closes #44
Sean Egan <seanegan@pidgin.im>
parents: 20076
diff changeset
603 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
604 PurpleBuddy *buddy = purple_contact_get_priority_buddy(contact);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
605 purple_blist_alias_buddy(buddy, arg2);
12478
e752c74ff854 [gaim-migrate @ 14789]
Aleksander Piotrowski <alek@nic.com.pl>
parents: 12474
diff changeset
606 serv_alias_buddy(buddy);
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
607 gtk_blist_auto_personize(purple_blist_node_get_parent(node), arg2);
12478
e752c74ff854 [gaim-migrate @ 14789]
Aleksander Piotrowski <alek@nic.com.pl>
parents: 12474
diff changeset
608 }
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
609 }
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
610 break;
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
611
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
612 case PURPLE_BLIST_BUDDY_NODE:
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
613 {
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
614 PurpleGroup *group = purple_buddy_get_group(PURPLE_BUDDY(node));
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
615
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
616 purple_blist_alias_buddy(PURPLE_BUDDY(node), arg2);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
617 serv_alias_buddy(PURPLE_BUDDY(node));
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
618 gtk_blist_auto_personize(PURPLE_BLIST_NODE(group), arg2);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
619 }
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
620 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
621 case PURPLE_BLIST_GROUP_NODE:
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
622 dest = purple_find_group(arg2);
25854
56a02cb817d9 explicit merge of 'a4359f8d6420120f500339b6fe48677e700f088f'
Richard Laager <rlaager@pidgin.im>
parents: 25119 25300
diff changeset
623 if (dest != NULL && purple_utf8_strcasecmp(arg2, purple_group_get_name(PURPLE_GROUP(node)))) {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
624 pidgin_dialogs_merge_groups(PURPLE_GROUP(node), arg2);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
625 } else {
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
626 purple_blist_rename_group(PURPLE_GROUP(node), arg2);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
627 }
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
628 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
629 case PURPLE_BLIST_CHAT_NODE:
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
630 purple_blist_alias_chat(PURPLE_CHAT(node), arg2);
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
631 break;
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
632 default:
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
633 break;
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
634 }
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
635 pidgin_blist_refresh(list);
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
636 }
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
637
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
638 static void
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
639 chat_components_edit_ok(PurpleChat *chat, PurpleRequestFields *allfields)
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
640 {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
641 GList *groups, *fields;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
642
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
643 for (groups = purple_request_fields_get_groups(allfields); groups; groups = groups->next) {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
644 fields = purple_request_field_group_get_fields(groups->data);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
645 for (; fields; fields = fields->next) {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
646 PurpleRequestField *field = fields->data;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
647 const char *id;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
648 char *val;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
649
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
650 id = purple_request_field_get_id(field);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
651 if (purple_request_field_get_type(field) == PURPLE_REQUEST_FIELD_INTEGER)
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
652 val = g_strdup_printf("%d", purple_request_field_int_get_value(field));
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
653 else
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
654 val = g_strdup(purple_request_field_string_get_value(field));
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
655
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
656 if (!val) {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
657 g_hash_table_remove(purple_chat_get_components(chat), id);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
658 } else {
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
659 g_hash_table_replace(purple_chat_get_components(chat), g_strdup(id), val); /* val should not be free'd */
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
660 }
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
661 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
662 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
663 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
664
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
665 static void chat_components_edit(GtkWidget *w, PurpleBlistNode *node)
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
666 {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
667 PurpleRequestFields *fields = purple_request_fields_new();
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
668 PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
669 PurpleRequestField *field;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
670 GList *parts, *iter;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
671 struct proto_chat_entry *pce;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
672 PurpleConnection *gc;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
673 PurpleChat *chat = (PurpleChat*)node;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
674
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
675 purple_request_fields_add_group(fields, group);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
676
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
677 gc = purple_account_get_connection(purple_chat_get_account(chat));
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
678 parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info(gc);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
679
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
680 for (iter = parts; iter; iter = iter->next) {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
681 pce = iter->data;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
682 if (pce->is_int) {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
683 int val;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
684 const char *str = g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
685 if (!str || sscanf(str, "%d", &val) != 1)
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
686 val = pce->min;
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
687 field = purple_request_field_int_new(pce->identifier, pce->label, val);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
688 } else {
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
689 field = purple_request_field_string_new(pce->identifier, pce->label,
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
690 g_hash_table_lookup(purple_chat_get_components(chat), pce->identifier), FALSE);
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
691 if (pce->secret)
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
692 purple_request_field_string_set_masked(field, TRUE);
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
693 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
694
22935
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
695 if (pce->required)
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
696 purple_request_field_set_required(field, TRUE);
80562b52fb71 Fine tune the edit-settings dialog (e.g., mark fields as masked or
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22932
diff changeset
697
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
698 purple_request_field_group_add_field(group, field);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
699 g_free(pce);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
700 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
701
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
702 g_list_free(parts);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
703
22961
bffffe2d39ba Tweak some strings in the Edit Chat dialog.
Will Thompson <resiak@pidgin.im>
parents: 22942
diff changeset
704 purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please update the necessary fields."),
bffffe2d39ba Tweak some strings in the Edit Chat dialog.
Will Thompson <resiak@pidgin.im>
parents: 22942
diff changeset
705 fields, _("Save"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL,
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
706 NULL, NULL, NULL,
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
707 chat);
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
708 }
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
709
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
710 static void gtk_blist_menu_alias_cb(GtkWidget *w, PurpleBlistNode *node)
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
711 {
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
712 GtkTreeIter iter;
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
713 GtkTreePath *path;
11494
60bfb30f6cba [gaim-migrate @ 13738]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11490
diff changeset
714
11258
6863ab327ec2 [gaim-migrate @ 13433]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11257
diff changeset
715 if (!(get_iter_from_node(node, &iter))) {
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
716 /* This is either a bug, or the buddy is in a collapsed contact */
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
717 node = purple_blist_node_get_parent(node);
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
718 if (!get_iter_from_node(node, &iter))
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
719 /* Now it's definitely a bug */
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
720 return;
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
721 }
11258
6863ab327ec2 [gaim-migrate @ 13433]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11257
diff changeset
722
21440
458937dee9af Don't allow tooltips to interfere with editing blist entries. Fixes #3830.
Daniel Atallah <datallah@pidgin.im>
parents: 21113
diff changeset
723 pidgin_blist_tooltip_destroy();
458937dee9af Don't allow tooltips to interfere with editing blist entries. Fixes #3830.
Daniel Atallah <datallah@pidgin.im>
parents: 21113
diff changeset
724
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
725 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
726 g_object_set(G_OBJECT(gtkblist->text_rend), "editable", TRUE, NULL);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
727 gtk_tree_view_set_enable_search (GTK_TREE_VIEW(gtkblist->treeview), FALSE);
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
728 gtk_widget_grab_focus(gtkblist->treeview);
14723
5e5b5c192df3 [gaim-migrate @ 17407]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14722
diff changeset
729 gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(gtkblist->treeview), path,
5e5b5c192df3 [gaim-migrate @ 17407]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14722
diff changeset
730 gtkblist->text_column, gtkblist->text_rend, TRUE);
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
731 gtk_tree_path_free(path);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
732 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
733
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
734 static void gtk_blist_menu_bp_cb(GtkWidget *w, PurpleBuddy *b)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
735 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
736 pidgin_pounce_editor_show(purple_buddy_get_account(b),
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
737 purple_buddy_get_name(b), NULL);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
738 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
739
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
740 static void gtk_blist_menu_showlog_cb(GtkWidget *w, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
741 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
742 PurpleLogType type;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
743 PurpleAccount *account;
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
744 char *name = NULL;
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
745
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
746 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
12232
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
747
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
748 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
749 PurpleBuddy *b = (PurpleBuddy*) node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
750 type = PURPLE_LOG_IM;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
751 name = g_strdup(purple_buddy_get_name(b));
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
752 account = purple_buddy_get_account(b);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
753 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
754 PurpleChat *c = PURPLE_CHAT(node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
755 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
756 type = PURPLE_LOG_CHAT;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
757 account = purple_chat_get_account(c);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
758 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account)));
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
759 if (prpl_info && prpl_info->get_chat_name) {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
760 name = prpl_info->get_chat_name(purple_chat_get_components(c));
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
761 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
762 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
763 pidgin_log_show_contact(PURPLE_CONTACT(node));
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
764 pidgin_clear_cursor(gtkblist->window);
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
765 return;
12232
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
766 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
767 pidgin_clear_cursor(gtkblist->window);
12232
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
768
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
769 /* This callback should not have been registered for a node
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
770 * that doesn't match the type of one of the blocks above. */
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
771 g_return_if_reached();
857f087ec86b [gaim-migrate @ 14534]
Richard Laager <rlaager@pidgin.im>
parents: 12226
diff changeset
772 }
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
773
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
774 if (name && account) {
21214
db28e29a4990 Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents: 21213
diff changeset
775 pidgin_log_show(type, name, account);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
776 pidgin_clear_cursor(gtkblist->window);
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
777 }
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
778
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
779 g_free(name);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
780 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
781
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
782 static void gtk_blist_menu_showoffline_cb(GtkWidget *w, PurpleBlistNode *node)
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
783 {
20392
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
784 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
785 {
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
786 purple_blist_node_set_bool(node, "show_offline",
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
787 !purple_blist_node_get_bool(node, "show_offline"));
22855
a5d39718e85c Fix setting "show offline" for buddy list nodes so it takes immediate
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22822
diff changeset
788 pidgin_blist_update(purple_get_blist(), node);
20392
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
789 }
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
790 else if (PURPLE_BLIST_NODE_IS_CONTACT(node))
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
791 {
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
792 PurpleBlistNode *bnode;
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
793 gboolean setting = !purple_blist_node_get_bool(node, "show_offline");
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
794
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
795 purple_blist_node_set_bool(node, "show_offline", setting);
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
796 for (bnode = purple_blist_node_get_first_child(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
797 bnode != NULL;
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
798 bnode = purple_blist_node_get_sibling_next(bnode))
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
799 {
20392
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
800 purple_blist_node_set_bool(bnode, "show_offline", setting);
22855
a5d39718e85c Fix setting "show offline" for buddy list nodes so it takes immediate
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22822
diff changeset
801 pidgin_blist_update(purple_get_blist(), bnode);
20392
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
802 }
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
803 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
804 PurpleBlistNode *cnode, *bnode;
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
805 gboolean setting = !purple_blist_node_get_bool(node, "show_offline");
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
806
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
807 purple_blist_node_set_bool(node, "show_offline", setting);
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
808 for (cnode = purple_blist_node_get_first_child(node);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
809 cnode != NULL;
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
810 cnode = purple_blist_node_get_sibling_next(cnode))
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
811 {
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
812 purple_blist_node_set_bool(cnode, "show_offline", setting);
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
813 for (bnode = purple_blist_node_get_first_child(cnode);
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
814 bnode != NULL;
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
815 bnode = purple_blist_node_get_sibling_next(bnode))
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
816 {
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
817 purple_blist_node_set_bool(bnode, "show_offline", setting);
22855
a5d39718e85c Fix setting "show offline" for buddy list nodes so it takes immediate
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22822
diff changeset
818 pidgin_blist_update(purple_get_blist(), bnode);
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
819 }
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
820 }
20392
355ab501ddf3 Fix the whitespace/tab/space junk I just created
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20391
diff changeset
821 }
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
822 }
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
823
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
824 static void gtk_blist_show_systemlog_cb(void)
21214
db28e29a4990 Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents: 21213
diff changeset
825 {
db28e29a4990 Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents: 21213
diff changeset
826 pidgin_syslog_show();
db28e29a4990 Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents: 21213
diff changeset
827 }
db28e29a4990 Reverted changes from ef7ac46f90a801547f7dfc4295927a956f90e869 to
Richard Laager <rlaager@pidgin.im>
parents: 21213
diff changeset
828
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
829 static void gtk_blist_show_onlinehelp_cb(void)
17419
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
830 {
17748
a0105917df6f use pidgin.im/documentation as the help url (which redirects already)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17747
diff changeset
831 purple_notify_uri(NULL, PURPLE_WEBSITE "documentation");
17419
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
832 }
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
833
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
834 static void
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
835 do_join_chat(PidginChatData *data)
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
836 {
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
837 if (data)
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
838 {
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
839 GHashTable *components =
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
840 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
841 GList *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
842 PurpleChat *chat;
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
843
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
844 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
845 {
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
846 if (g_object_get_data(tmp->data, "is_spin"))
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
847 {
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
848 g_hash_table_replace(components,
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
849 g_strdup(g_object_get_data(tmp->data, "identifier")),
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
850 g_strdup_printf("%d",
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
851 gtk_spin_button_get_value_as_int(tmp->data)));
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
852 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
853 else
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
854 {
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
855 g_hash_table_replace(components,
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
856 g_strdup(g_object_get_data(tmp->data, "identifier")),
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
857 g_strdup(gtk_entry_get_text(tmp->data)));
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
858 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
859 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
860
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
861 chat = purple_chat_new(data->rq_data.account, NULL, components);
12576
df739b5606f6 [gaim-migrate @ 14898]
Richard Laager <rlaager@pidgin.im>
parents: 12569
diff changeset
862 gtk_blist_join_chat(chat);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
863 purple_blist_remove_chat(chat);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
864 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
865 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
866
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
867 static void
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
868 do_joinchat(GtkWidget *dialog, int id, PidginChatData *info)
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
869 {
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
870 switch(id)
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
871 {
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
872 case GTK_RESPONSE_OK:
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
873 do_join_chat(info);
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
874 break;
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
875
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
876 case 1:
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
877 pidgin_roomlist_dialog_show_with_account(info->rq_data.account);
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
878 return;
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
879
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
880 break;
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
881 }
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
882
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
883 gtk_widget_destroy(GTK_WIDGET(dialog));
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
884 g_list_free(info->entries);
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
885 g_free(info);
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
886 }
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
887
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
888 /*
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
889 * Check the values of all the text entry boxes. If any required input
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
890 * strings are empty then don't allow the user to click on "OK."
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
891 */
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
892 static void
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
893 set_sensitive_if_input_cb(GtkWidget *entry, gpointer user_data)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
894 {
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
895 PurplePluginProtocolInfo *prpl_info;
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
896 PurpleConnection *gc;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
897 PidginChatData *data;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
898 GList *tmp;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
899 const char *text;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
900 gboolean required;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
901 gboolean sensitive = TRUE;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
902
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
903 data = user_data;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
904
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
905 for (tmp = data->entries; tmp != NULL; tmp = tmp->next)
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
906 {
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
907 if (!g_object_get_data(tmp->data, "is_spin"))
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
908 {
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
909 required = GPOINTER_TO_INT(g_object_get_data(tmp->data, "required"));
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
910 text = gtk_entry_get_text(tmp->data);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
911 if (required && (*text == '\0'))
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
912 sensitive = FALSE;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
913 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
914 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
915
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
916 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), GTK_RESPONSE_OK, sensitive);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
917
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
918 gc = purple_account_get_connection(data->rq_data.account);
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
919 prpl_info = (gc != NULL) ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
920 sensitive = (prpl_info != NULL && prpl_info->roomlist_get_list != NULL);
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
921
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
922 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window), 1, sensitive);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
923 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
924
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
925 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
926 pidgin_blist_update_privacy_cb(PurpleBuddy *buddy)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
927 {
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
928 struct _pidgin_blist_node *ui_data = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(buddy));
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
929 if (ui_data == NULL || ui_data->row == NULL)
19701
d5c5982757d5 Do not try to update a buddy in the buddylist when there's no buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19672
diff changeset
930 return;
24969
9585a37b5642 Got about a third of the gtkblist.c direct struct usage, much more to go obviously, but i must sleep...
Gary Kramlich <grim@reaperworld.com>
parents: 24967
diff changeset
931 pidgin_blist_update_buddy(purple_get_blist(), PURPLE_BLIST_NODE(buddy), TRUE);
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
932 }
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
933
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
934 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
935 chat_account_filter_func(PurpleAccount *account)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
936 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
937 PurpleConnection *gc = purple_account_get_connection(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
938 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
939
30267
ba6674f1cff1 Prevent a null pointer dereference in chat_account_filter_func() if called
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 30039
diff changeset
940 if (gc == NULL)
ba6674f1cff1 Prevent a null pointer dereference in chat_account_filter_func() if called
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 30039
diff changeset
941 return FALSE;
ba6674f1cff1 Prevent a null pointer dereference in chat_account_filter_func() if called
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 30039
diff changeset
942
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
943 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
944
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
945 return (prpl_info->chat_info != NULL);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
946 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
947
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
948 gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
949 pidgin_blist_joinchat_is_showable()
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
950 {
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
951 GList *c;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
952 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
953
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
954 for (c = purple_connections_get_all(); c != NULL; c = c->next) {
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
955 gc = c->data;
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
956
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
957 if (chat_account_filter_func(purple_connection_get_account(gc)))
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
958 return TRUE;
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
959 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
960
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
961 return FALSE;
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
962 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
963
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
964 static GtkWidget *
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
965 make_blist_request_dialog(PidginBlistRequestData *data, PurpleAccount *account,
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
966 const char *title, const char *window_role, const char *label_text,
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
967 GCallback callback_func, PurpleFilterAccountFunc filter_func,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
968 GCallback response_cb)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
969 {
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
970 GtkWidget *label;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
971 GtkWidget *img;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
972 GtkWidget *hbox;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
973 GtkWidget *vbox;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
974 GtkWindow *blist_window;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
975 PidginBuddyList *gtkblist;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
976
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
977 data->account = account;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
978
15497
92f02f4bd5ee Dialog icon changes
Sean Egan <seanegan@pidgin.im>
parents: 15496
diff changeset
979 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
980 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
981
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
982 gtkblist = PIDGIN_BLIST(purple_get_blist());
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
983 blist_window = gtkblist ? GTK_WINDOW(gtkblist->window) : NULL;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
984
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
985 data->window = gtk_dialog_new_with_buttons(title,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
986 blist_window, GTK_DIALOG_NO_SEPARATOR,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
987 NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
988
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
989 gtk_window_set_transient_for(GTK_WINDOW(data->window), blist_window);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
990 gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
991 gtk_container_set_border_width(GTK_CONTAINER(data->window), PIDGIN_HIG_BOX_SPACE);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
992 gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
993 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BORDER);
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
994 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BOX_SPACE);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
995 gtk_window_set_role(GTK_WINDOW(data->window), window_role);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
996
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
997 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
998 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
999 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1000 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1001
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1002 vbox = gtk_vbox_new(FALSE, 5);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1003 gtk_container_add(GTK_CONTAINER(hbox), vbox);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1004
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1005 label = gtk_label_new(label_text);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1006
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1007 gtk_widget_set_size_request(label, 400, -1);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1008 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1009 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1010 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1011
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1012 data->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1013
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1014 data->account_menu = pidgin_account_option_menu_new(account, FALSE,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1015 callback_func, filter_func, data);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1016 pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("A_ccount"), data->sg, data->account_menu, TRUE, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1017
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1018 data->vbox = GTK_BOX(gtk_vbox_new(FALSE, 5));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1019 gtk_container_set_border_width(GTK_CONTAINER(data->vbox), 0);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1020 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(data->vbox), FALSE, FALSE, 0);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1021
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1022 g_signal_connect(G_OBJECT(data->window), "response", response_cb, data);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1023
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1024 g_object_unref(data->sg);
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1025
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1026 return vbox;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1027 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1028
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1029 static void
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1030 rebuild_chat_entries(PidginChatData *data, const char *default_chat_name)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1031 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1032 PurpleConnection *gc;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1033 GList *list = NULL, *tmp;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1034 GHashTable *defaults = NULL;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1035 struct proto_chat_entry *pce;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1036 gboolean focus = TRUE;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1037
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1038 g_return_if_fail(data->rq_data.account != NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1039
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1040 gc = purple_account_get_connection(data->rq_data.account);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1041
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1042 gtk_container_foreach(GTK_CONTAINER(data->rq_data.vbox), (GtkCallback)gtk_widget_destroy, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1043
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1044 g_list_free(data->entries);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1045 data->entries = NULL;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1046
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1047 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1048 list = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1049
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1050 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1051 defaults = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, default_chat_name);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1052
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1053 for (tmp = list; tmp; tmp = tmp->next)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1054 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1055 GtkWidget *input;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1056
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1057 pce = tmp->data;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1058
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1059 if (pce->is_int)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1060 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1061 GtkObject *adjust;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1062 adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1063 1, 10, 10);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1064 input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1065 gtk_widget_set_size_request(input, 50, -1);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1066 pidgin_add_widget_to_vbox(GTK_BOX(data->rq_data.vbox), pce->label, data->rq_data.sg, input, FALSE, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1067 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1068 else
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1069 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1070 char *value;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1071 input = gtk_entry_new();
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1072 gtk_entry_set_activates_default(GTK_ENTRY(input), TRUE);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1073 value = g_hash_table_lookup(defaults, pce->identifier);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1074 if (value != NULL)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1075 gtk_entry_set_text(GTK_ENTRY(input), value);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1076 if (pce->secret)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1077 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1078 gtk_entry_set_visibility(GTK_ENTRY(input), FALSE);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1079 #if !GTK_CHECK_VERSION(2,16,0)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1080 if (gtk_entry_get_invisible_char(GTK_ENTRY(input)) == '*')
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1081 gtk_entry_set_invisible_char(GTK_ENTRY(input), PIDGIN_INVISIBLE_CHAR);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1082 #endif /* Less than GTK+ 2.16 */
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1083 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1084 pidgin_add_widget_to_vbox(data->rq_data.vbox, pce->label, data->rq_data.sg, input, TRUE, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1085 g_signal_connect(G_OBJECT(input), "changed",
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1086 G_CALLBACK(set_sensitive_if_input_cb), data);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1087 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1088
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1089 /* Do the following for any type of input widget */
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1090 if (focus)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1091 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1092 gtk_widget_grab_focus(input);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1093 focus = FALSE;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1094 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1095 g_object_set_data(G_OBJECT(input), "identifier", (gpointer)pce->identifier);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1096 g_object_set_data(G_OBJECT(input), "is_spin", GINT_TO_POINTER(pce->is_int));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1097 g_object_set_data(G_OBJECT(input), "required", GINT_TO_POINTER(pce->required));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1098 data->entries = g_list_append(data->entries, input);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1099
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1100 g_free(pce);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1101 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1102
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1103 g_list_free(list);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1104 g_hash_table_destroy(defaults);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1105
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1106 /* Set whether the "OK" button should be clickable initially */
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1107 set_sensitive_if_input_cb(NULL, data);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1108
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1109 gtk_widget_show_all(GTK_WIDGET(data->rq_data.vbox));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1110 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1111
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1112 static void
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1113 chat_select_account_cb(GObject *w, PurpleAccount *account,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1114 PidginChatData *data)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1115 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1116 if (strcmp(purple_account_get_protocol_id(data->rq_data.account),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1117 purple_account_get_protocol_id(account)) == 0)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1118 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1119 data->rq_data.account = account;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1120 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1121 else
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1122 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1123 data->rq_data.account = account;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1124 rebuild_chat_entries(data, data->default_chat_name);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1125 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1126 }
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1127
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1128 void
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1129 pidgin_blist_joinchat_show(void)
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1130 {
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1131 PidginChatData *data = NULL;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1132
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1133 data = g_new0(PidginChatData, 1);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1134
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1135 make_blist_request_dialog((PidginBlistRequestData *)data, NULL,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1136 _("Join a Chat"), "join_chat",
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1137 _("Please enter the appropriate information about the chat "
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1138 "you would like to join.\n"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1139 G_CALLBACK(chat_select_account_cb),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1140 chat_account_filter_func, (GCallback)do_joinchat);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1141 gtk_dialog_add_buttons(GTK_DIALOG(data->rq_data.window),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1142 _("Room _List"), 1,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1143 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1144 PIDGIN_STOCK_CHAT, GTK_RESPONSE_OK, NULL);
27888
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
1145 gtk_dialog_set_default_response(GTK_DIALOG(data->rq_data.window),
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
1146 GTK_RESPONSE_OK);
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1147 data->default_chat_name = NULL;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1148 data->rq_data.account = pidgin_account_option_menu_get_selected(data->rq_data.account_menu);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1149
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1150 rebuild_chat_entries(data, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1151
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
1152 gtk_widget_show_all(data->rq_data.window);
8303
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1153 }
bbe7d3420549 [gaim-migrate @ 9027]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1154
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1155 static void gtk_blist_row_expanded_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1156 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1157 PurpleBlistNode *node;
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1158
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1159 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &node, -1);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1160
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1161 if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1162 char *title;
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1163
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
1164 title = pidgin_get_group_title(node, TRUE);
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1165
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1166 gtk_tree_store_set(gtkblist->treemodel, iter,
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1167 NAME_COLUMN, title,
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1168 -1);
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1169
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1170 g_free(title);
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1171
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1172 purple_blist_node_set_bool(node, "collapsed", FALSE);
22806
db2444697cd9 Destroy the tooltip when a group in the buddylist is expanded or collapsed
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22754
diff changeset
1173 pidgin_blist_tooltip_destroy();
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1174 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1175 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1176
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1177 static void gtk_blist_row_collapsed_cb(GtkTreeView *tv, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1178 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1179 PurpleBlistNode *node;
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1180
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1181 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), iter, NODE_COLUMN, &node, -1);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1182
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1183 if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1184 char *title;
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1185 struct _pidgin_blist_node *gtknode;
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1186 PurpleBlistNode *cnode;
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1187
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
1188 title = pidgin_get_group_title(node, FALSE);
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1189
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1190 gtk_tree_store_set(gtkblist->treemodel, iter,
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1191 NAME_COLUMN, title,
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1192 -1);
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1193
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
1194 g_free(title);
15409
37b46bbce4cb [gaim-migrate @ 18140]
Daniel Atallah <datallah@pidgin.im>
parents: 15403
diff changeset
1195
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1196 purple_blist_node_set_bool(node, "collapsed", TRUE);
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1197
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1198 for(cnode = purple_blist_node_get_first_child(node); cnode; cnode = purple_blist_node_get_sibling_next(cnode)) {
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1199 if (PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1200 gtknode = purple_blist_node_get_ui_data(cnode);
17180
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1201 if (!gtknode->contact_expanded)
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1202 continue;
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1203 gtknode->contact_expanded = FALSE;
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1204 pidgin_blist_update_contact(NULL, cnode);
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1205 }
280b99127139 Patch from SuperMMX to correctly update the expand state of contacts
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17143
diff changeset
1206 }
22806
db2444697cd9 Destroy the tooltip when a group in the buddylist is expanded or collapsed
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22754
diff changeset
1207 pidgin_blist_tooltip_destroy();
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1208 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1209 pidgin_blist_collapse_contact_cb(NULL, node);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1210 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1211 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1212
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1213 static void gtk_blist_row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1214 PurpleBlistNode *node;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1215 GtkTreeIter iter;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1216
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1217 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1218 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1219
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1220 if(PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1221 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1222
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1223 if(PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1224 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1225 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1226 buddy = (PurpleBuddy*)node;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1227
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1228 pidgin_dialogs_im_with_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1229 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1230 gtk_blist_join_chat((PurpleChat *)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1231 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
1232 /* if (gtk_tree_view_row_expanded(tv, path))
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1233 gtk_tree_view_collapse_row(tv, path);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1234 else
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
1235 gtk_tree_view_expand_row(tv,path,FALSE);*/
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1236 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1237 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1238
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
1239 static void pidgin_blist_add_chat_cb(void)
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1240 {
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1241 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1242 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1243 PurpleBlistNode *node;
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1244
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1245 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1246 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1247 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1248 purple_blist_request_add_chat(NULL, purple_buddy_get_group(PURPLE_BUDDY(node)), NULL, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1249 if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node))
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1250 purple_blist_request_add_chat(NULL, purple_contact_get_group(PURPLE_CONTACT(node)), NULL, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1251 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1252 purple_blist_request_add_chat(NULL, (PurpleGroup*)node, NULL, NULL);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1253 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1254 else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1255 purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1256 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1257 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
1258
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
1259 static void pidgin_blist_add_buddy_cb(void)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1260 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1261 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1262 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1263 PurpleBlistNode *node;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1264
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1265 if(gtk_tree_selection_get_selected(sel, NULL, &iter)){
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1266 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1267 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1268 PurpleGroup *group = purple_buddy_get_group(PURPLE_BUDDY(node));
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1269 purple_blist_request_add_buddy(NULL, NULL, purple_group_get_name(group), NULL);
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1270 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node)) {
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1271 PurpleGroup *group = purple_contact_get_group(PURPLE_CONTACT(node));
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1272 purple_blist_request_add_buddy(NULL, NULL, purple_group_get_name(group), NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1273 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1274 purple_blist_request_add_buddy(NULL, NULL, purple_group_get_name(PURPLE_GROUP(node)), NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1275 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1276 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1277 else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1278 purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1279 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1280 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1281
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1282 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1283 pidgin_blist_remove_cb (GtkWidget *w, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1284 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1285 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
1286 pidgin_dialogs_remove_buddy((PurpleBuddy*)node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1287 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
1288 pidgin_dialogs_remove_chat((PurpleChat*)node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1289 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
1290 pidgin_dialogs_remove_group((PurpleGroup*)node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1291 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
1292 pidgin_dialogs_remove_contact((PurpleContact*)node);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1293 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1294 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1295
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1296 struct _expand {
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1297 GtkTreeView *treeview;
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1298 GtkTreePath *path;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1299 PurpleBlistNode *node;
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1300 };
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1301
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
1302 static gboolean
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
1303 scroll_to_expanded_cell(gpointer data)
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1304 {
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
1305 struct _expand *ex = data;
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1306 gtk_tree_view_scroll_to_cell(ex->treeview, ex->path, NULL, FALSE, 0, 0);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1307 pidgin_blist_update_contact(NULL, ex->node);
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1308
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1309 gtk_tree_path_free(ex->path);
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1310 g_free(ex);
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
1311
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1312 return FALSE;
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1313 }
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
1314
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1315 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1316 pidgin_blist_expand_contact_cb(GtkWidget *w, PurpleBlistNode *node)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1317 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1318 struct _pidgin_blist_node *gtknode;
9632
e295aa712589 [gaim-migrate @ 10476]
Sean Egan <seanegan@pidgin.im>
parents: 9620
diff changeset
1319 GtkTreeIter iter, parent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1320 PurpleBlistNode *bnode;
10325
9bb530214bae [gaim-migrate @ 11532]
Mark Doliner <markdoliner@pidgin.im>
parents: 10320
diff changeset
1321 GtkTreePath *path;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1322
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1323 if(!PURPLE_BLIST_NODE_IS_CONTACT(node))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1324 return;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1325
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1326 gtknode = purple_blist_node_get_ui_data(node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1327
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1328 gtknode->contact_expanded = TRUE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1329
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1330 for(bnode = purple_blist_node_get_first_child(node); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1331 pidgin_blist_update(NULL, bnode);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1332 }
10353
830e54bb7fa0 [gaim-migrate @ 11570]
Mark Doliner <markdoliner@pidgin.im>
parents: 10352
diff changeset
1333
9632
e295aa712589 [gaim-migrate @ 10476]
Sean Egan <seanegan@pidgin.im>
parents: 9620
diff changeset
1334 /* This ensures that the bottom buddy is visible, i.e. not scrolled off the alignment */
14748
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1335 if (get_iter_from_node(node, &parent)) {
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1336 struct _expand *ex = g_new0(struct _expand, 1);
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1337
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1338 gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent,
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1339 gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &parent) -1);
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1340 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1341
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1342 /* Let the treeview draw so it knows where to scroll */
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1343 ex->treeview = GTK_TREE_VIEW(gtkblist->treeview);
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1344 ex->path = path;
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1345 ex->node = purple_blist_node_get_first_child(node);
14748
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1346 g_idle_add(scroll_to_expanded_cell, ex);
03b0e1705115 [gaim-migrate @ 17438]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 14723
diff changeset
1347 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1348 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1349
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1350 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1351 pidgin_blist_collapse_contact_cb(GtkWidget *w, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1352 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1353 PurpleBlistNode *bnode;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1354 struct _pidgin_blist_node *gtknode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1355
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1356 if(!PURPLE_BLIST_NODE_IS_CONTACT(node))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1357 return;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1358
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1359 gtknode = purple_blist_node_get_ui_data(node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1360
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1361 gtknode->contact_expanded = FALSE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1362
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1363 for(bnode = purple_blist_node_get_first_child(node); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1364 pidgin_blist_update(NULL, bnode);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1365 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1366 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1367
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1368 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1369 toggle_privacy(GtkWidget *widget, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1370 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1371 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1372 PurpleAccount *account;
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1373 gboolean permitted;
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1374 const char *name;
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1375
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1376 if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1377 return;
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1378
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1379 buddy = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1380 account = purple_buddy_get_account(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1381 name = purple_buddy_get_name(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1382
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1383 permitted = purple_privacy_check(account, name);
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1384
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1385 /* XXX: Perhaps ask whether to restore the previous lists where appropirate? */
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1386
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1387 if (permitted)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1388 purple_privacy_deny(account, name, FALSE, FALSE);
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1389 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1390 purple_privacy_allow(account, name, FALSE, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1391
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1392 pidgin_blist_update(purple_get_blist(), node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1393 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1394
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1395 void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1396 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1397 PurpleBuddy *buddy = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1398 PurpleAccount *account;
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1399 gboolean permitted;
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1400
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1401 account = purple_buddy_get_account(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1402 permitted = purple_privacy_check(account, purple_buddy_get_name(buddy));
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1403
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1404 pidgin_new_item_from_stock(menu, permitted ? _("_Block") : _("Un_block"),
16068
b1dac315ed09 block and unblock have the right icons now
Nathan Walp <nwalp@pidgin.im>
parents: 16040
diff changeset
1405 permitted ? PIDGIN_STOCK_TOOLBAR_BLOCK : PIDGIN_STOCK_TOOLBAR_UNBLOCK, G_CALLBACK(toggle_privacy),
15380
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1406 node, 0 ,0, NULL);
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1407 }
1171796358b3 [gaim-migrate @ 18109]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15307
diff changeset
1408
9051
aebb592d4529 [gaim-migrate @ 9827]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9030
diff changeset
1409 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1410 pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1411 PurpleBlistNode *node)
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1412 {
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1413 GList *l, *ll;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1414 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1415
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1416 if(!prpl_info || !prpl_info->blist_node_menu)
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1417 return;
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1418
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1419 for(l = ll = prpl_info->blist_node_menu(node); l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1420 PurpleMenuAction *act = (PurpleMenuAction *) l->data;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1421 pidgin_append_menu_action(menu, act, node);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1422 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1423 g_list_free(ll);
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1424 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1425
9051
aebb592d4529 [gaim-migrate @ 9827]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9030
diff changeset
1426 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1427 pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node)
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1428 {
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1429 GList *l, *ll;
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1430
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1431 for(l = ll = purple_blist_node_get_extended_menu(node); l; l = l->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1432 PurpleMenuAction *act = (PurpleMenuAction *) l->data;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1433 pidgin_append_menu_action(menu, act, node);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1434 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1435 g_list_free(ll);
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1436 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1437
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1438
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1439
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1440 static void
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1441 pidgin_append_blist_node_move_to_menu(GtkWidget *menu, PurpleBlistNode *node)
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1442 {
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1443 GtkWidget *submenu;
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1444 GtkWidget *menuitem;
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1445 PurpleBlistNode *group;
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1446
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1447 menuitem = gtk_menu_item_new_with_label(_("Move to"));
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1448 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1449 gtk_widget_show(menuitem);
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1450
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1451 submenu = gtk_menu_new();
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
1452 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1453
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1454 for (group = purple_blist_get_root(); group; group = purple_blist_node_get_sibling_next(group)) {
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1455 if (!PURPLE_BLIST_NODE_IS_GROUP(group))
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1456 continue;
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1457 if (group == purple_blist_node_get_parent(node))
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1458 continue;
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
1459 menuitem = pidgin_new_item_from_stock(submenu, purple_group_get_name((PurpleGroup *)group), NULL,
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1460 G_CALLBACK(gtk_blist_menu_move_to_cb), node, 0, 0, NULL);
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1461 g_object_set_data(G_OBJECT(menuitem), "groupnode", group);
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1462 }
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1463 gtk_widget_show_all(submenu);
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1464 }
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1465
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1466 void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1467 pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) {
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1468 PurpleAccount *account = NULL;
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1469 PurpleConnection *pc = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1470 PurplePluginProtocolInfo *prpl_info;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1471 PurpleContact *contact;
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1472 PurpleBlistNode *node;
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1473 gboolean contact_expanded = FALSE;
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1474
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1475 g_return_if_fail(menu);
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1476 g_return_if_fail(buddy);
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1477
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1478 account = purple_buddy_get_account(buddy);
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1479 pc = purple_account_get_connection(account);
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1480 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(pc));
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1481
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1482 node = PURPLE_BLIST_NODE(buddy);
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1483
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1484 contact = purple_buddy_get_contact(buddy);
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1485 if (contact) {
29673
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1486 PidginBlistNode *node = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(contact));
d2759164a4a3 a bunch more struct hiding fixes, but too much for me at the moment
Gary Kramlich <grim@reaperworld.com>
parents: 29628
diff changeset
1487 contact_expanded = node->contact_expanded;
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1488 }
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1489
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1490 if (prpl_info && prpl_info->get_info) {
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
1491 pidgin_new_item_from_stock(menu, _("Get _Info"), PIDGIN_STOCK_TOOLBAR_USER_INFO,
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1492 G_CALLBACK(gtk_blist_menu_info_cb), buddy, 0, 0, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1493 }
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
1494 pidgin_new_item_from_stock(menu, _("I_M"), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW,
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1495 G_CALLBACK(gtk_blist_menu_im_cb), buddy, 0, 0, NULL);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
1496
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1497 #ifdef USE_VV
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1498 if (prpl_info && prpl_info->get_media_caps) {
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1499 PurpleAccount *account = purple_buddy_get_account(buddy);
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1500 const gchar *who = purple_buddy_get_name(buddy);
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1501 PurpleMediaCaps caps = purple_prpl_get_media_caps(account, who);
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1502 if (caps & PURPLE_MEDIA_CAPS_AUDIO) {
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1503 pidgin_new_item_from_stock(menu, _("_Audio Call"),
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1504 PIDGIN_STOCK_TOOLBAR_AUDIO_CALL,
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1505 G_CALLBACK(gtk_blist_menu_audio_call_cb), buddy, 0, 0, NULL);
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1506 }
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1507 if (caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO) {
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1508 pidgin_new_item_from_stock(menu, _("Audio/_Video Call"),
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1509 PIDGIN_STOCK_TOOLBAR_VIDEO_CALL,
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1510 G_CALLBACK(gtk_blist_menu_video_call_cb), buddy, 0, 0, NULL);
26316
950c0d491c0d Change purple_prpl_can_do_media to purple_prpl_get_media_caps.
Michael Ruprecht <maiku@pidgin.im>
parents: 26274
diff changeset
1511 } else if (caps & PURPLE_MEDIA_CAPS_VIDEO) {
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1512 pidgin_new_item_from_stock(menu, _("_Video Call"),
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1513 PIDGIN_STOCK_TOOLBAR_VIDEO_CALL,
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1514 G_CALLBACK(gtk_blist_menu_video_call_cb), buddy, 0, 0, NULL);
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1515 }
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1516 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
1517
26159
24ffae1874f1 Added menu items to buddy list context menu to start voice and video sessions
Marcus Lundblad <malu@pidgin.im>
parents: 24573
diff changeset
1518 #endif
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
1519
9466
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
1520 if (prpl_info && prpl_info->send_file) {
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1521 if (!prpl_info->can_receive_file ||
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1522 prpl_info->can_receive_file(buddy->account->gc, buddy->name))
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1523 {
20615
fe11a607bdcc Ellipsize some menu actions that require further input. Fixes #1770
Sean Egan <seanegan@pidgin.im>
parents: 20612
diff changeset
1524 pidgin_new_item_from_stock(menu, _("_Send File..."),
16881
e6bca9e3d85c New Send File icon
Hylke Bons <hbons@pidgin.im>
parents: 16879
diff changeset
1525 PIDGIN_STOCK_TOOLBAR_SEND_FILE,
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1526 G_CALLBACK(gtk_blist_menu_send_file_cb),
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1527 buddy, 0, 0, NULL);
9466
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
1528 }
b6425eab60ca [gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents: 9460
diff changeset
1529 }
12024
5a87b77fcc3c [gaim-migrate @ 14317]
Sean Egan <seanegan@pidgin.im>
parents: 12016
diff changeset
1530
20615
fe11a607bdcc Ellipsize some menu actions that require further input. Fixes #1770
Sean Egan <seanegan@pidgin.im>
parents: 20612
diff changeset
1531 pidgin_new_item_from_stock(menu, _("Add Buddy _Pounce..."), NULL,
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1532 G_CALLBACK(gtk_blist_menu_bp_cb), buddy, 0, 0, NULL);
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1533
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
1534 if (node->parent && node->parent->child->next &&
18970
ef13a2231e36 Tooltips in infopanes
Sean Egan <seanegan@pidgin.im>
parents: 18956
diff changeset
1535 !sub && !contact_expanded) {
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
1536 pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1537 G_CALLBACK(gtk_blist_menu_showlog_cb),
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1538 contact, 0, 0, NULL);
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1539 } else if (!sub) {
15622
024584b350fb context menu cleanup
Sean Egan <seanegan@pidgin.im>
parents: 15621
diff changeset
1540 pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1541 G_CALLBACK(gtk_blist_menu_showlog_cb), buddy, 0, 0, NULL);
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1542 }
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1543
27666
15ddd56f47ed Close up scope on a variable and use PURPLE_BLIST_NODE_HAS_FLAG.
Etan Reisner <deryni@pidgin.im>
parents: 27603
diff changeset
1544 if (!PURPLE_BLIST_NODE_HAS_FLAG(node, PURPLE_BLIST_NODE_FLAG_NO_SAVE)) {
15ddd56f47ed Close up scope on a variable and use PURPLE_BLIST_NODE_HAS_FLAG.
Etan Reisner <deryni@pidgin.im>
parents: 27603
diff changeset
1545 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline");
27589
09602ed0a5b2 Title Case some blist right-click menu items.
Etan Reisner <deryni@pidgin.im>
parents: 27252
diff changeset
1546 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"),
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1547 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL);
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1548 }
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1549
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1550 pidgin_append_blist_node_proto_menu(menu, buddy->account->gc, node);
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1551 pidgin_append_blist_node_extended_menu(menu, node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1552
21867
f777572e7c44 Fix a crash that occurs when creating the "Move To" menu for buddies that aren't on your list. Fixes #4217.
Daniel Atallah <datallah@pidgin.im>
parents: 21866
diff changeset
1553 if (!contact_expanded && contact != NULL)
20354
e5f940479e63 Various warning fixes and a small leak fix.
Daniel Atallah <datallah@pidgin.im>
parents: 20339
diff changeset
1554 pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact);
20306
323b98f087cf Move to menu in blist context menu. Used for more easily moving buddies between groups
Sean Egan <seanegan@pidgin.im>
parents: 20303
diff changeset
1555
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
1556 if (node->parent && node->parent->child->next &&
18970
ef13a2231e36 Tooltips in infopanes
Sean Egan <seanegan@pidgin.im>
parents: 18956
diff changeset
1557 !sub && !contact_expanded) {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1558 pidgin_separator(menu);
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1559 pidgin_append_blist_node_privacy_menu(menu, node);
17559
55efe450728c Add the mnemonics I really meant to add before I got distracted by Add Chat
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17556
diff changeset
1560 pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
9925
7f33ac0e1878 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1561 G_CALLBACK(gtk_blist_menu_alias_cb),
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1562 contact, 0, 0, NULL);
17559
55efe450728c Add the mnemonics I really meant to add before I got distracted by Add Chat
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17556
diff changeset
1563 pidgin_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1564 G_CALLBACK(pidgin_blist_remove_cb),
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1565 contact, 0, 0, NULL);
12319
42a0e8cecea3 [gaim-migrate @ 14623]
Richard Laager <rlaager@pidgin.im>
parents: 12302
diff changeset
1566 } else if (!sub || contact_expanded) {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1567 pidgin_separator(menu);
20391
0c7e6023d313 Merge the plugin pack's showoffline plugin's functionality to pidgin proper
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 20388
diff changeset
1568 pidgin_append_blist_node_privacy_menu(menu, node);
15570
81e9b7d13875 stock to pidgin
Sean Egan <seanegan@pidgin.im>
parents: 15569
diff changeset
1569 pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
9925
7f33ac0e1878 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1570 G_CALLBACK(gtk_blist_menu_alias_cb), buddy, 0, 0, NULL);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1571 pidgin_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1572 G_CALLBACK(pidgin_blist_remove_cb), buddy,
9925
7f33ac0e1878 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1573 0, 0, NULL);
7f33ac0e1878 [gaim-migrate @ 10817]
Nathan Walp <nwalp@pidgin.im>
parents: 9918
diff changeset
1574 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1575 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1576
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1577 static gboolean
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17180
diff changeset
1578 gtk_blist_key_press_cb(GtkWidget *tv, GdkEventKey *event, gpointer data)
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17180
diff changeset
1579 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1580 PurpleBlistNode *node;
27251
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1581 GtkTreeIter iter, parent;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1582 GtkTreeSelection *sel;
27251
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1583 GtkTreePath *path;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1584
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1585 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1586 if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1587 return FALSE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1588
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1589 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1590
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1591 if(event->state & GDK_CONTROL_MASK &&
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1592 (event->keyval == 'o' || event->keyval == 'O')) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1593 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1594
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1595 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1596 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1597 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1598 buddy = (PurpleBuddy*)node;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1599 } else {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1600 return FALSE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1601 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1602 if(buddy)
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17180
diff changeset
1603 pidgin_retrieve_user_info(buddy->account->gc, buddy->name);
27251
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1604 } else {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1605 switch (event->keyval) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1606 case GDK_F2:
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1607 gtk_blist_menu_alias_cb(tv, node);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1608 break;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1609
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1610 case GDK_Left:
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1611 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1612 if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1613 /* Collapse the Group */
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1614 gtk_tree_view_collapse_row(GTK_TREE_VIEW(tv), path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1615 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1616 return TRUE;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1617 } else {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1618 /* Select the Parent */
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1619 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1620 if (gtk_tree_model_iter_parent(GTK_TREE_MODEL(gtkblist->treemodel), &parent, &iter)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1621 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1622 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1623 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1624 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1625 return TRUE;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1626 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1627 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1628 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1629 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1630 break;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1631
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1632 case GDK_Right:
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1633 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1634 if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1635 /* Expand the Group */
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1636 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1637 pidgin_blist_expand_contact_cb(NULL, node);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1638 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1639 return TRUE;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1640 } else if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1641 gtk_tree_view_expand_row(GTK_TREE_VIEW(tv), path, FALSE);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1642 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1643 return TRUE;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1644 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1645 } else {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1646 /* Select the First Child */
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1647 if (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &parent, path)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1648 if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter, &parent, 0)) {
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1649 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1650 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1651 gtk_tree_view_set_cursor(GTK_TREE_VIEW(tv), path, NULL, FALSE);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1652 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1653 return TRUE;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1654 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1655 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1656 }
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1657 gtk_tree_path_free(path);
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1658 break;
706215a568e2 Apply patch from Peter to handle the left and right arrow keys in the buddy
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27196
diff changeset
1659 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1660 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1661
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1662 return FALSE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1663 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1664
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1665 static void
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1666 set_node_custom_icon_cb(const gchar *filename, gpointer data)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1667 {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1668 if (filename) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1669 PurpleBlistNode *node = (PurpleBlistNode*)data;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1670
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1671 purple_buddy_icons_node_set_custom_icon_from_file(node,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1672 filename);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1673 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1674 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1675
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1676 static void
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1677 set_node_custom_icon(GtkWidget *w, PurpleBlistNode *node)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1678 {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1679 /* This doesn't keep track of the returned dialog (so that successive
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1680 * calls could be made to re-display that dialog). Do we want that? */
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1681 GtkWidget *win = pidgin_buddy_icon_chooser_new(NULL, set_node_custom_icon_cb, node);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1682 gtk_widget_show_all(win);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1683 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1684
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1685 static void
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1686 remove_node_custom_icon(GtkWidget *w, PurpleBlistNode *node)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1687 {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1688 purple_buddy_icons_node_set_custom_icon(node, NULL, 0);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1689 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1690
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1691 static void
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1692 add_buddy_icon_menu_items(GtkWidget *menu, PurpleBlistNode *node)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1693 {
23305
e47f5d5367be Disable the 'remove custom icon' item from the menu if a custom icon isn't set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23302
diff changeset
1694 GtkWidget *item;
e47f5d5367be Disable the 'remove custom icon' item from the menu if a custom icon isn't set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23302
diff changeset
1695
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1696 pidgin_new_item_from_stock(menu, _("Set Custom Icon"), NULL,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1697 G_CALLBACK(set_node_custom_icon), node, 0,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1698 0, NULL);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1699
23305
e47f5d5367be Disable the 'remove custom icon' item from the menu if a custom icon isn't set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23302
diff changeset
1700 item = pidgin_new_item_from_stock(menu, _("Remove Custom Icon"), NULL,
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1701 G_CALLBACK(remove_node_custom_icon), node,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1702 0, 0, NULL);
23305
e47f5d5367be Disable the 'remove custom icon' item from the menu if a custom icon isn't set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23302
diff changeset
1703 if (!purple_buddy_icons_node_has_custom_icon(node))
e47f5d5367be Disable the 'remove custom icon' item from the menu if a custom icon isn't set.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23302
diff changeset
1704 gtk_widget_set_sensitive(item, FALSE);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1705 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1706
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1707 static GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1708 create_group_menu (PurpleBlistNode *node, PurpleGroup *g)
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1709 {
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1710 GtkWidget *menu;
11988
7ed733ed806b [gaim-migrate @ 14281]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11986
diff changeset
1711 GtkWidget *item;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1712
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1713 menu = gtk_menu_new();
20615
fe11a607bdcc Ellipsize some menu actions that require further input. Fixes #1770
Sean Egan <seanegan@pidgin.im>
parents: 20612
diff changeset
1714 item = pidgin_new_item_from_stock(menu, _("Add _Buddy..."), GTK_STOCK_ADD,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1715 G_CALLBACK(pidgin_blist_add_buddy_cb), node, 0, 0, NULL);
16825
e81d38d1f0e6 if you're offline, and right-click on a group, you shouldn't be presented
Nathan Walp <nwalp@pidgin.im>
parents: 16805
diff changeset
1716 gtk_widget_set_sensitive(item, purple_connections_get_all() != NULL);
20615
fe11a607bdcc Ellipsize some menu actions that require further input. Fixes #1770
Sean Egan <seanegan@pidgin.im>
parents: 20612
diff changeset
1717 item = pidgin_new_item_from_stock(menu, _("Add C_hat..."), GTK_STOCK_ADD,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1718 G_CALLBACK(pidgin_blist_add_chat_cb), node, 0, 0, NULL);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1719 gtk_widget_set_sensitive(item, pidgin_blist_joinchat_is_showable());
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1720 pidgin_new_item_from_stock(menu, _("_Delete Group"), GTK_STOCK_REMOVE,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1721 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1722 pidgin_new_item_from_stock(menu, _("_Rename"), NULL,
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
1723 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
1724 if (!(purple_blist_node_get_flags(node) & PURPLE_BLIST_NODE_FLAG_NO_SAVE)) {
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
1725 gboolean show_offline = purple_blist_node_get_bool(node, "show_offline");
27589
09602ed0a5b2 Title Case some blist right-click menu items.
Etan Reisner <deryni@pidgin.im>
parents: 27252
diff changeset
1726 pidgin_new_item_from_stock(menu, show_offline ? _("Hide When Offline") : _("Show When Offline"),
22584
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
1727 NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node, 0, 0, NULL);
d6452d2b698b Make "Show when offline" work on group nodes too, which sets the flag for
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22455
diff changeset
1728 }
8952
b8bf830b3731 [gaim-migrate @ 9724]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8945
diff changeset
1729
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1730 add_buddy_icon_menu_items(menu, node);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1731
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1732 pidgin_append_blist_node_extended_menu(menu, node);
8952
b8bf830b3731 [gaim-migrate @ 9724]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8945
diff changeset
1733
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1734 return menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1735 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1736
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1737 static GtkWidget *
18956
ce9f33e26b22 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18944
diff changeset
1738 create_chat_menu(PurpleBlistNode *node, PurpleChat *c)
ce9f33e26b22 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18944
diff changeset
1739 {
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1740 GtkWidget *menu;
19811
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
1741 gboolean autojoin, persistent;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1742
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1743 menu = gtk_menu_new();
31469
675926579597 Stop trying to get "gtk-autojoin" as a string from chat rooms in the buddy
Mark Doliner <markdoliner@pidgin.im>
parents: 31304
diff changeset
1744 autojoin = purple_blist_node_get_bool(node, "gtk-autojoin");
19811
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
1745 persistent = purple_blist_node_get_bool(node, "gtk-persistent");
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1746
15570
81e9b7d13875 stock to pidgin
Sean Egan <seanegan@pidgin.im>
parents: 15569
diff changeset
1747 pidgin_new_item_from_stock(menu, _("_Join"), PIDGIN_STOCK_CHAT,
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1748 G_CALLBACK(gtk_blist_menu_join_cb), node, 0, 0, NULL);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1749 pidgin_new_check_item(menu, _("Auto-Join"),
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1750 G_CALLBACK(gtk_blist_menu_autojoin_cb), node, autojoin);
19811
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
1751 pidgin_new_check_item(menu, _("Persistent"),
634020cc4429 "We are going to destroy the conversations immediately only if the 'close immediately'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19810
diff changeset
1752 G_CALLBACK(gtk_blist_menu_persistent_cb), node, persistent);
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
1753 pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
9917
2fbb3c9fab2b [gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents: 9869
diff changeset
1754 G_CALLBACK(gtk_blist_menu_showlog_cb), node, 0, 0, NULL);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9019
diff changeset
1755
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1756 pidgin_append_blist_node_proto_menu(menu, c->account->gc, node);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1757 pidgin_append_blist_node_extended_menu(menu, node);
8586
c8c7a19da549 [gaim-migrate @ 9336]
Pekka Riikonen <priikone@silcnet.org>
parents: 8573
diff changeset
1758
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1759 pidgin_separator(menu);
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1760
22932
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
1761 pidgin_new_item_from_stock(menu, _("_Edit Settings..."), NULL,
78894be3e296 'Edit Settings' in the context menu for chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22855
diff changeset
1762 G_CALLBACK(chat_components_edit), node, 0, 0, NULL);
15570
81e9b7d13875 stock to pidgin
Sean Egan <seanegan@pidgin.im>
parents: 15569
diff changeset
1763 pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1764 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1765 pidgin_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1766 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL);
8586
c8c7a19da549 [gaim-migrate @ 9336]
Pekka Riikonen <priikone@silcnet.org>
parents: 8573
diff changeset
1767
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1768 add_buddy_icon_menu_items(menu, node);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1769
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1770 return menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1771 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1772
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1773 static GtkWidget *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1774 create_contact_menu (PurpleBlistNode *node)
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1775 {
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1776 GtkWidget *menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1777
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1778 menu = gtk_menu_new();
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1779
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
1780 pidgin_new_item_from_stock(menu, _("View _Log"), NULL,
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1781 G_CALLBACK(gtk_blist_menu_showlog_cb),
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1782 node, 0, 0, NULL);
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1783
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1784 pidgin_separator(menu);
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1785
15570
81e9b7d13875 stock to pidgin
Sean Egan <seanegan@pidgin.im>
parents: 15569
diff changeset
1786 pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1787 G_CALLBACK(gtk_blist_menu_alias_cb), node, 0, 0, NULL);
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1788 pidgin_new_item_from_stock(menu, _("_Remove"), GTK_STOCK_REMOVE,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1789 G_CALLBACK(pidgin_blist_remove_cb), node, 0, 0, NULL);
10663
1a5ab09c8475 [gaim-migrate @ 12202]
Sean Egan <seanegan@pidgin.im>
parents: 10662
diff changeset
1790
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1791 add_buddy_icon_menu_items(menu, node);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
1792
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1793 pidgin_separator(menu);
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1794
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1795 pidgin_new_item_from_stock(menu, _("_Collapse"), GTK_STOCK_ZOOM_OUT,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1796 G_CALLBACK(pidgin_blist_collapse_contact_cb),
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1797 node, 0, 0, NULL);
9051
aebb592d4529 [gaim-migrate @ 9827]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9030
diff changeset
1798
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1799 pidgin_append_blist_node_extended_menu(menu, node);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1800 return menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1801 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1802
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1803 static GtkWidget *
18956
ce9f33e26b22 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18944
diff changeset
1804 create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b)
ce9f33e26b22 Make the infopane context-menu look more like a buddylist context menu.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18944
diff changeset
1805 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1806 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1807 GtkWidget *menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1808 GtkWidget *menuitem;
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
1809 gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies");
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1810
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1811 menu = gtk_menu_new();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1812 pidgin_blist_make_buddy_menu(menu, b, FALSE);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1813
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1814 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1815 pidgin_separator(menu);
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
1816
23307
4a099def3ca3 Show the custom icon menu for a contact even if it's collapsed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23305
diff changeset
1817 add_buddy_icon_menu_items(menu, node);
4a099def3ca3 Show the custom icon menu for a contact even if it's collapsed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23305
diff changeset
1818
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1819 if(gtknode->contact_expanded) {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1820 pidgin_new_item_from_stock(menu, _("_Collapse"),
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1821 GTK_STOCK_ZOOM_OUT,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1822 G_CALLBACK(pidgin_blist_collapse_contact_cb),
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1823 node, 0, 0, NULL);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1824 } else {
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
1825 pidgin_new_item_from_stock(menu, _("_Expand"),
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1826 GTK_STOCK_ZOOM_IN,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1827 G_CALLBACK(pidgin_blist_expand_contact_cb), node,
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1828 0, 0, NULL);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1829 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1830 if(node->child->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1831 PurpleBlistNode *bnode;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1832
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1833 for(bnode = node->child; bnode; bnode = bnode->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1834 PurpleBuddy *buddy = (PurpleBuddy*)bnode;
9340
d9a87f3abbdf [gaim-migrate @ 10148]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9337
diff changeset
1835 GdkPixbuf *buf;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1836 GtkWidget *submenu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1837 GtkWidget *image;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1838
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1839 if(buddy == b)
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1840 continue;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1841 if(!buddy->account->gc)
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1842 continue;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1843 if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy))
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1844 continue;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1845
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1846 menuitem = gtk_image_menu_item_new_with_label(buddy->name);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1847 buf = pidgin_create_prpl_icon(buddy->account,PIDGIN_PRPL_ICON_SMALL);
9340
d9a87f3abbdf [gaim-migrate @ 10148]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9337
diff changeset
1848 image = gtk_image_new_from_pixbuf(buf);
d9a87f3abbdf [gaim-migrate @ 10148]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9337
diff changeset
1849 g_object_unref(G_OBJECT(buf));
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1850 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem),
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
1851 image);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1852 gtk_widget_show(image);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1853 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1854 gtk_widget_show(menuitem);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1855
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1856 submenu = gtk_menu_new();
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1857 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1858 gtk_widget_show(submenu);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1859
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1860 pidgin_blist_make_buddy_menu(submenu, buddy, TRUE);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1861 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1862 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1863 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1864 return menu;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1865 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1866
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1867 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1868 pidgin_blist_show_context_menu(PurpleBlistNode *node,
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1869 GtkMenuPositionFunc func,
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1870 GtkWidget *tv,
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1871 guint button,
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1872 guint32 time)
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1873 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1874 struct _pidgin_blist_node *gtknode;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1875 GtkWidget *menu = NULL;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1876 gboolean handled = FALSE;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1877
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1878 gtknode = (struct _pidgin_blist_node *)node->ui_data;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1879
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1880 /* Create a menu based on the thing we right-clicked on */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1881 if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1882 PurpleGroup *g = (PurpleGroup *)node;
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1883
8952
b8bf830b3731 [gaim-migrate @ 9724]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 8945
diff changeset
1884 menu = create_group_menu(node, g);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1885 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1886 PurpleChat *c = (PurpleChat *)node;
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1887
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1888 menu = create_chat_menu(node, c);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1889 } else if ((PURPLE_BLIST_NODE_IS_CONTACT(node)) && (gtknode->contact_expanded)) {
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1890 menu = create_contact_menu(node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1891 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1892 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1893
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1894 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1895 b = purple_contact_get_priority_buddy((PurpleContact*)node);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1896 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1897 b = (PurpleBuddy *)node;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1898
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
1899 menu = create_buddy_menu(node, b);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1900 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1901
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1902 #ifdef _WIN32
23139
8b8551afe101 Patch from Arban57 to prevent tooltips conflicting with the context menu on
Daniel Atallah <datallah@pidgin.im>
parents: 23094
diff changeset
1903 pidgin_blist_tooltip_destroy();
8b8551afe101 Patch from Arban57 to prevent tooltips conflicting with the context menu on
Daniel Atallah <datallah@pidgin.im>
parents: 23094
diff changeset
1904
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1905 /* Unhook the tooltip-timeout since we don't want a tooltip
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1906 * to appear and obscure the context menu we are about to show
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1907 This is a workaround for GTK+ bug 107320. */
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1908 if (gtkblist->timeout) {
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1909 g_source_remove(gtkblist->timeout);
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1910 gtkblist->timeout = 0;
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1911 }
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1912 #endif
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
1913
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1914 /* Now display the menu */
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1915 if (menu != NULL) {
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1916 gtk_widget_show_all(menu);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1917 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, func, tv, button, time);
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1918 handled = TRUE;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1919 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1920
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1921 return handled;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1922 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1923
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
1924 static gboolean
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
1925 gtk_blist_button_press_cb(GtkWidget *tv, GdkEventButton *event, gpointer user_data)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1926 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1927 GtkTreePath *path;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1928 PurpleBlistNode *node;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1929 GtkTreeIter iter;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1930 GtkTreeSelection *sel;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1931 PurplePlugin *prpl = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1932 PurplePluginProtocolInfo *prpl_info = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1933 struct _pidgin_blist_node *gtknode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1934 gboolean handled = FALSE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1935
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1936 /* Here we figure out which node was clicked */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1937 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), event->x, event->y, &path, NULL, NULL, NULL))
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1938 return FALSE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1939 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
1940 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1941 gtknode = (struct _pidgin_blist_node *)node->ui_data;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1942
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1943 /* Right click draws a context menu */
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1944 if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1945 handled = pidgin_blist_show_context_menu(node, NULL, tv, 3, event->time);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1946
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1947 /* CTRL+middle click expands or collapse a contact */
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1948 } else if ((event->button == 2) && (event->type == GDK_BUTTON_PRESS) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1949 (event->state & GDK_CONTROL_MASK) && (PURPLE_BLIST_NODE_IS_CONTACT(node))) {
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1950 if (gtknode->contact_expanded)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1951 pidgin_blist_collapse_contact_cb(NULL, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1952 else
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1953 pidgin_blist_expand_contact_cb(NULL, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1954 handled = TRUE;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1955
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1956 /* Double middle click gets info */
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1957 } else if ((event->button == 2) && (event->type == GDK_2BUTTON_PRESS) &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1958 ((PURPLE_BLIST_NODE_IS_CONTACT(node)) || (PURPLE_BLIST_NODE_IS_BUDDY(node)))) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1959 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1960 if(PURPLE_BLIST_NODE_IS_CONTACT(node))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1961 b = purple_contact_get_priority_buddy((PurpleContact*)node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1962 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1963 b = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1964
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1965 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1966 if (prpl != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1967 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1968
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1969 if (prpl && prpl_info->get_info)
17360
4b04b2ee459a Use utility functions to get user info. Closes #964.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17180
diff changeset
1970 pidgin_retrieve_user_info(b->account->gc, b->name);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1971 handled = TRUE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1972 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1973
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1974 #if (1)
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1975 /*
10814
7e17cb56b019 [gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents: 10780
diff changeset
1976 * This code only exists because GTK+ doesn't work. If we return
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1977 * FALSE here, as would be normal the event propoagates down and
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1978 * somehow gets interpreted as the start of a drag event.
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1979 *
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1980 * Um, isn't it _normal_ to return TRUE here? Since the event
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1981 * was handled? --Mark
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1982 */
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1983 if(handled) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1984 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1985 gtk_tree_selection_select_path(sel, path);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1986 gtk_tree_path_free(path);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1987 return TRUE;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1988 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1989 #endif
7753
f3f9394afe6d [gaim-migrate @ 8398]
Ethan Blanton <elb@pidgin.im>
parents: 7737
diff changeset
1990 gtk_tree_path_free(path);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1991
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
1992 return FALSE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1993 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1994
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1995 static gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
1996 pidgin_blist_popup_menu_cb(GtkWidget *tv, void *user_data)
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1997 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
1998 PurpleBlistNode *node;
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
1999 GtkTreeIter iter;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2000 GtkTreeSelection *sel;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2001 gboolean handled = FALSE;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2002
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2003 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2004 if (!gtk_tree_selection_get_selected(sel, NULL, &iter))
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2005 return FALSE;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2006
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2007 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2008
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2009 /* Shift+F10 draws a context menu */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2010 handled = pidgin_blist_show_context_menu(node, pidgin_treeview_popup_menu_position_func, tv, 0, GDK_CURRENT_TIME);
8143
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2011
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2012 return handled;
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2013 }
ce4b6383777b [gaim-migrate @ 8851]
Nathan Fredrickson <nathan@silverorange.com>
parents: 8137
diff changeset
2014
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2015 static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item)
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2016 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2017 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
12569
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2018
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2019 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons",
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
2020 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
12569
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2021
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2022 pidgin_clear_cursor(gtkblist->window);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2023 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2024
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2025 static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item)
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2026 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2027 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
2028
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2029 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time",
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
2030 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
2031
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2032 pidgin_clear_cursor(gtkblist->window);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2033 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2034
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2035 static void pidgin_blist_show_protocol_icons_cb(gpointer data, guint action, GtkWidget *item)
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2036 {
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2037 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons",
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2038 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2039 }
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
2040
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2041 static void pidgin_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item)
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2042 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2043 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
12569
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2044
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2045 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups",
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2046 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item)));
12569
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2047
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2048 pidgin_clear_cursor(gtkblist->window);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2049 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2050
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2051 static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action,
12569
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2052 GtkWidget *checkitem)
5ed47be3e4c3 [gaim-migrate @ 14888]
Richard Laager <rlaager@pidgin.im>
parents: 12530
diff changeset
2053 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2054 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2055
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2056 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies",
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2057 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem)));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2058
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2059 pidgin_clear_cursor(gtkblist->window);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2060 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2061
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2062 static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item)
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2063 {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2064 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(item)->active);
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2065 }
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2066
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12799
diff changeset
2067 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2068 pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12799
diff changeset
2069 gconstpointer value, gpointer data)
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2070 {
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2071 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift,
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2072 N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value));
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2073 }
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2074
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12799
diff changeset
2075 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2076 pidgin_blist_sound_method_pref_cb(const char *name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12799
diff changeset
2077 gconstpointer value, gpointer data)
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2078 {
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2079 gboolean sensitive = TRUE;
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2080
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2081 if(!strcmp(value, "none"))
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2082 sensitive = FALSE;
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2083
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2084 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive);
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2085 }
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
2086
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2087 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2088 add_buddies_from_vcard(const char *prpl_id, PurpleGroup *group, GList *list,
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2089 const char *alias)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2090 {
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
2091 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2092 PurpleAccount *account = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2093 PurpleConnection *gc;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2094
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2095 if (list == NULL)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2096 return;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2097
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2098 for (l = purple_connections_get_all(); l != NULL; l = l->next)
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2099 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2100 gc = (PurpleConnection *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2101 account = purple_connection_get_account(gc);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2102
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2103 if (!strcmp(purple_account_get_protocol_id(account), prpl_id))
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2104 break;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2105
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2106 account = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2107 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2108
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2109 if (account != NULL)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2110 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2111 for (l = list; l != NULL; l = l->next)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2112 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2113 purple_blist_request_add_buddy(account, l->data,
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2114 (group ? group->name : NULL),
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2115 alias);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2116 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2117 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2118
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2119 g_list_foreach(list, (GFunc)g_free, NULL);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2120 g_list_free(list);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2121 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2122
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2123 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2124 parse_vcard(const char *vcard, PurpleGroup *group)
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2125 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2126 char *temp_vcard;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2127 char *s, *c;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2128 char *alias = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2129 GList *aims = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2130 GList *icqs = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2131 GList *yahoos = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2132 GList *msns = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2133 GList *jabbers = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2134
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2135 s = temp_vcard = g_strdup(vcard);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2136
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2137 while (*s != '\0' && strncmp(s, "END:vCard", strlen("END:vCard")))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2138 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2139 char *field, *value;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2140
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2141 field = s;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2142
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2143 /* Grab the field */
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2144 while (*s != '\r' && *s != '\n' && *s != '\0' && *s != ':')
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2145 s++;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2146
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2147 if (*s == '\r') s++;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2148 if (*s == '\n')
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2149 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2150 s++;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2151 continue;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2152 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2153
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2154 if (*s != '\0') *s++ = '\0';
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2155
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2156 if ((c = strchr(field, ';')) != NULL)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2157 *c = '\0';
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2158
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2159 /* Proceed to the end of the line */
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2160 value = s;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2161
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2162 while (*s != '\r' && *s != '\n' && *s != '\0')
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2163 s++;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2164
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2165 if (*s == '\r') *s++ = '\0';
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2166 if (*s == '\n') *s++ = '\0';
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2167
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2168 /* We only want to worry about a few fields here. */
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2169 if (!strcmp(field, "FN"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2170 alias = g_strdup(value);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2171 else if (!strcmp(field, "X-AIM") || !strcmp(field, "X-ICQ") ||
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2172 !strcmp(field, "X-YAHOO") || !strcmp(field, "X-MSN") ||
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2173 !strcmp(field, "X-JABBER"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2174 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2175 char **values = g_strsplit(value, ":", 0);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2176 char **im;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2177
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2178 for (im = values; *im != NULL; im++)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2179 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2180 if (!strcmp(field, "X-AIM"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2181 aims = g_list_append(aims, g_strdup(*im));
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2182 else if (!strcmp(field, "X-ICQ"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2183 icqs = g_list_append(icqs, g_strdup(*im));
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2184 else if (!strcmp(field, "X-YAHOO"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2185 yahoos = g_list_append(yahoos, g_strdup(*im));
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2186 else if (!strcmp(field, "X-MSN"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2187 msns = g_list_append(msns, g_strdup(*im));
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2188 else if (!strcmp(field, "X-JABBER"))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2189 jabbers = g_list_append(jabbers, g_strdup(*im));
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2190 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2191
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2192 g_strfreev(values);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2193 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2194 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2195
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2196 g_free(temp_vcard);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2197
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2198 if (aims == NULL && icqs == NULL && yahoos == NULL &&
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2199 msns == NULL && jabbers == NULL)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2200 {
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2201 g_free(alias);
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2202
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2203 return FALSE;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2204 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2205
29935
d28b5dcc7554 Remove a bunch of old references to prpl-oscar
Mark Doliner <markdoliner@pidgin.im>
parents: 29923
diff changeset
2206 add_buddies_from_vcard("prpl-aim", group, aims, alias);
d28b5dcc7554 Remove a bunch of old references to prpl-oscar
Mark Doliner <markdoliner@pidgin.im>
parents: 29923
diff changeset
2207 add_buddies_from_vcard("prpl-icq", group, icqs, alias);
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2208 add_buddies_from_vcard("prpl-yahoo", group, yahoos, alias);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2209 add_buddies_from_vcard("prpl-msn", group, msns, alias);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2210 add_buddies_from_vcard("prpl-jabber", group, jabbers, alias);
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2211
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2212 g_free(alias);
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2213
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2214 return TRUE;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2215 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2216
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2217 #ifdef _WIN32
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2218 static void pidgin_blist_drag_begin(GtkWidget *widget,
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2219 GdkDragContext *drag_context, gpointer user_data)
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2220 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2221 pidgin_blist_tooltip_destroy();
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2222
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2223
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2224 /* Unhook the tooltip-timeout since we don't want a tooltip
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2225 * to appear and obscure the dragging operation.
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2226 * This is a workaround for GTK+ bug 107320. */
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2227 if (gtkblist->timeout) {
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2228 g_source_remove(gtkblist->timeout);
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2229 gtkblist->timeout = 0;
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2230 }
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2231 }
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2232 #endif
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2233
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2234 static void pidgin_blist_drag_data_get_cb(GtkWidget *widget,
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
2235 GdkDragContext *dc,
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
2236 GtkSelectionData *data,
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
2237 guint info,
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
2238 guint time,
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2239 gpointer null)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2240 {
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
2241
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2242 if (data->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2243 {
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2244 GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2245 GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2246 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2247 PurpleBlistNode *node = NULL;
5273
0d7e92ea8b97 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
2248 if(!sourcerow)
0d7e92ea8b97 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
2249 return;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2250 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, sourcerow);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2251 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2252 gtk_selection_data_set (data,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2253 gdk_atom_intern ("PURPLE_BLIST_NODE", FALSE),
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2254 8, /* bits */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2255 (void*)&node,
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2256 sizeof (node));
5273
0d7e92ea8b97 [gaim-migrate @ 5645]
Nathan Walp <nwalp@pidgin.im>
parents: 5263
diff changeset
2257
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2258 gtk_tree_path_free(sourcerow);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2259 }
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2260 else if (data->target == gdk_atom_intern("application/x-im-contact", FALSE))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2261 {
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2262 GtkTreeRowReference *ref;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2263 GtkTreePath *sourcerow;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2264 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2265 PurpleBlistNode *node = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2266 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2267 PurpleConnection *gc;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2268 GString *str;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2269 const char *protocol;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2270
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2271 ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2272 sourcerow = gtk_tree_row_reference_get_path(ref);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2273
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2274 if (!sourcerow)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2275 return;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2276
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2277 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2278 sourcerow);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2279 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2280
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2281 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2282 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2283 buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2284 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2285 else if (!PURPLE_BLIST_NODE_IS_BUDDY(node))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2286 {
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2287 gtk_tree_path_free(sourcerow);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2288 return;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2289 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2290 else
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2291 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2292 buddy = (PurpleBuddy *)node;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2293 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2294
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2295 gc = purple_account_get_connection(buddy->account);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2296
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2297 if (gc == NULL)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2298 {
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2299 gtk_tree_path_free(sourcerow);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2300 return;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2301 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2302
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2303 protocol =
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2304 PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->list_icon(buddy->account,
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2305 buddy);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2306
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2307 str = g_string_new(NULL);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2308 g_string_printf(str,
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2309 "MIME-Version: 1.0\r\n"
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2310 "Content-Type: application/x-im-contact\r\n"
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2311 "X-IM-Protocol: %s\r\n"
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2312 "X-IM-Username: %s\r\n",
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2313 protocol,
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2314 buddy->name);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2315
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2316 if (buddy->alias != NULL)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2317 {
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2318 g_string_append_printf(str,
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2319 "X-IM-Alias: %s\r\n",
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2320 buddy->alias);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2321 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2322
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
2323 g_string_append(str, "\r\n");
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2324
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2325 gtk_selection_data_set(data,
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2326 gdk_atom_intern("application/x-im-contact", FALSE),
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2327 8, /* bits */
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2328 (const guchar *)str->str,
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2329 strlen(str->str) + 1);
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2330
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2331 g_string_free(str, TRUE);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2332 gtk_tree_path_free(sourcerow);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2333 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2334 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2335
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2336 static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2337 GtkSelectionData *sd, guint info, guint t)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2338 {
13834
28f6ad6dc0f2 [gaim-migrate @ 16281]
Ka-Hing Cheung <khc@pidgin.im>
parents: 13821
diff changeset
2339 if (gtkblist->drag_timeout) {
28f6ad6dc0f2 [gaim-migrate @ 16281]
Ka-Hing Cheung <khc@pidgin.im>
parents: 13821
diff changeset
2340 g_source_remove(gtkblist->drag_timeout);
28f6ad6dc0f2 [gaim-migrate @ 16281]
Ka-Hing Cheung <khc@pidgin.im>
parents: 13821
diff changeset
2341 gtkblist->drag_timeout = 0;
28f6ad6dc0f2 [gaim-migrate @ 16281]
Ka-Hing Cheung <khc@pidgin.im>
parents: 13821
diff changeset
2342 }
28f6ad6dc0f2 [gaim-migrate @ 16281]
Ka-Hing Cheung <khc@pidgin.im>
parents: 13821
diff changeset
2343
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2344 if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && sd->data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2345 PurpleBlistNode *n = NULL;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2346 GtkTreePath *path = NULL;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2347 GtkTreeViewDropPosition position;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2348 memcpy(&n, sd->data, sizeof(n));
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2349 if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
2350 /* if we're here, I think it means the drop is ok */
7642
4e1735a499f5 [gaim-migrate @ 8285]
Nathan Walp <nwalp@pidgin.im>
parents: 7636
diff changeset
2351 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2352 PurpleBlistNode *node;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2353 struct _pidgin_blist_node *gtknode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2354
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2355 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2356 &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2357 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2358 &iter, NODE_COLUMN, &node, -1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2359 gtknode = node->ui_data;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2360
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2361 if (PURPLE_BLIST_NODE_IS_CONTACT(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2362 PurpleContact *c = (PurpleContact*)n;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2363 if (PURPLE_BLIST_NODE_IS_CONTACT(node) && gtknode->contact_expanded) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2364 purple_blist_merge_contact(c, node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2365 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2366 PURPLE_BLIST_NODE_IS_CHAT(node)) {
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2367 switch(position) {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2368 case GTK_TREE_VIEW_DROP_AFTER:
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2369 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2370 purple_blist_add_contact(c, (PurpleGroup*)node->parent,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2371 node);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2372 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2373 case GTK_TREE_VIEW_DROP_BEFORE:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2374 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2375 purple_blist_add_contact(c, (PurpleGroup*)node->parent,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2376 node->prev);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2377 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2378 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2379 } else if(PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2380 purple_blist_add_contact(c, (PurpleGroup*)node, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2381 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2382 purple_blist_merge_contact(c, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2383 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2384 } else if (PURPLE_BLIST_NODE_IS_BUDDY(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2385 PurpleBuddy *b = (PurpleBuddy*)n;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2386 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2387 switch(position) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2388 case GTK_TREE_VIEW_DROP_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2389 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2390 purple_blist_add_buddy(b, (PurpleContact*)node->parent,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2391 (PurpleGroup*)node->parent->parent, node);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2392 break;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2393 case GTK_TREE_VIEW_DROP_BEFORE:
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2394 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2395 purple_blist_add_buddy(b, (PurpleContact*)node->parent,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2396 (PurpleGroup*)node->parent->parent,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2397 node->prev);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2398 break;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2399 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2400 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2401 purple_blist_add_buddy(b, NULL, (PurpleGroup*)node->parent,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2402 NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2403 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2404 purple_blist_add_buddy(b, NULL, (PurpleGroup*)node, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2405 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2406 if(gtknode->contact_expanded) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2407 switch(position) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2408 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2409 case GTK_TREE_VIEW_DROP_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2410 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2411 purple_blist_add_buddy(b, (PurpleContact*)node,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2412 (PurpleGroup*)node->parent, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2413 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2414 case GTK_TREE_VIEW_DROP_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2415 purple_blist_add_buddy(b, NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2416 (PurpleGroup*)node->parent, node->prev);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2417 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2418 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2419 } else {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2420 switch(position) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2421 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2422 case GTK_TREE_VIEW_DROP_AFTER:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2423 purple_blist_add_buddy(b, NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2424 (PurpleGroup*)node->parent, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2425 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2426 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2427 case GTK_TREE_VIEW_DROP_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2428 purple_blist_add_buddy(b, NULL,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2429 (PurpleGroup*)node->parent, node->prev);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2430 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2431 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2432 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2433 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2434 } else if (PURPLE_BLIST_NODE_IS_CHAT(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2435 PurpleChat *chat = (PurpleChat *)n;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2436 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2437 switch(position) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2438 case GTK_TREE_VIEW_DROP_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2439 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2440 case GTK_TREE_VIEW_DROP_BEFORE:
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2441 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2442 purple_blist_add_chat(chat,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2443 (PurpleGroup*)node->parent->parent,
13543
25f9c386270c [gaim-migrate @ 15919]
Daniel Atallah <datallah@pidgin.im>
parents: 13541
diff changeset
2444 node->parent);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2445 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2446 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2447 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2448 PURPLE_BLIST_NODE_IS_CHAT(node)) {
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2449 switch(position) {
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2450 case GTK_TREE_VIEW_DROP_AFTER:
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2451 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2452 purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2453 break;
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2454 case GTK_TREE_VIEW_DROP_BEFORE:
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2455 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2456 purple_blist_add_chat(chat, (PurpleGroup*)node->parent, node->prev);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2457 break;
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2458 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2459 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2460 purple_blist_add_chat(chat, (PurpleGroup*)node, NULL);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
2461 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2462 } else if (PURPLE_BLIST_NODE_IS_GROUP(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2463 PurpleGroup *g = (PurpleGroup*)n;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2464 if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2465 switch (position) {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2466 case GTK_TREE_VIEW_DROP_INTO_OR_AFTER:
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2467 case GTK_TREE_VIEW_DROP_AFTER:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2468 purple_blist_add_group(g, node);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2469 break;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2470 case GTK_TREE_VIEW_DROP_INTO_OR_BEFORE:
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2471 case GTK_TREE_VIEW_DROP_BEFORE:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2472 purple_blist_add_group(g, node->prev);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2473 break;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2474 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2475 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2476 purple_blist_add_group(g, node->parent->parent);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2477 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2478 PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2479 purple_blist_add_group(g, node->parent);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2480 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2481 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2482
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2483 gtk_tree_path_free(path);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
2484 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2485 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2486 }
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2487 else if (sd->target == gdk_atom_intern("application/x-im-contact",
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2488 FALSE) && sd->data)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2489 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2490 PurpleGroup *group = NULL;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2491 GtkTreePath *path = NULL;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2492 GtkTreeViewDropPosition position;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2493 PurpleAccount *account;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2494 char *protocol = NULL;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2495 char *username = NULL;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2496 char *alias = NULL;
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2497
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2498 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2499 x, y, &path, &position))
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2500 {
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2501 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2502 PurpleBlistNode *node;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2503
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2504 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2505 &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2506 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2507 &iter, NODE_COLUMN, &node, -1);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2508
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2509 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2510 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2511 group = (PurpleGroup *)node->parent->parent;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2512 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2513 else if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2514 PURPLE_BLIST_NODE_IS_CONTACT(node))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2515 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2516 group = (PurpleGroup *)node->parent;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2517 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2518 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2519 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2520 group = (PurpleGroup *)node;
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2521 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2522 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2523
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2524 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
7712
74af9358b808 [gaim-migrate @ 8357]
Christian Hammond <chipx86@chipx86.com>
parents: 7706
diff changeset
2525 &protocol, &username, &alias))
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2526 {
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2527 if (account == NULL)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2528 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2529 purple_notify_error(NULL, NULL,
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2530 _("You are not currently signed on with an account that "
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2531 "can add that buddy."), NULL);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2532 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2533 else
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2534 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2535 purple_blist_request_add_buddy(account, username,
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2536 (group ? group->name : NULL),
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2537 alias);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2538 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2539 }
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2540
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2541 g_free(username);
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2542 g_free(protocol);
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
2543 g_free(alias);
7706
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2544
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2545 if (path != NULL)
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2546 gtk_tree_path_free(path);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2547
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2548 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
e5e87715a42c [gaim-migrate @ 8351]
Sean Egan <seanegan@pidgin.im>
parents: 7693
diff changeset
2549 }
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2550 else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data)
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2551 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2552 gboolean result;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2553 PurpleGroup *group = NULL;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2554 GtkTreePath *path = NULL;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2555 GtkTreeViewDropPosition position;
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2556
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2557 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2558 x, y, &path, &position))
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2559 {
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2560 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2561 PurpleBlistNode *node;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2562
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2563 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2564 &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2565 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2566 &iter, NODE_COLUMN, &node, -1);
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2567
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2568 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2569 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2570 group = (PurpleGroup *)node->parent->parent;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2571 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2572 else if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2573 PURPLE_BLIST_NODE_IS_CONTACT(node))
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2574 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2575 group = (PurpleGroup *)node->parent;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2576 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2577 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2578 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2579 group = (PurpleGroup *)node;
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2580 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2581 }
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2582
11137
cf40226ddff7 [gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents: 11134
diff changeset
2583 result = parse_vcard((const gchar *)sd->data, group);
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2584
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2585 gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t);
9525
28a430d517db [gaim-migrate @ 10352]
Sean Egan <seanegan@pidgin.im>
parents: 9498
diff changeset
2586 } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) {
9495
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2587 GtkTreePath *path = NULL;
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2588 GtkTreeViewDropPosition position;
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2589
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2590 if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget),
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
2591 x, y, &path, &position))
9495
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2592 {
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2593 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2594 PurpleBlistNode *node;
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2595
9495
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2596 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel),
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2597 &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2598 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel),
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
2599 &iter, NODE_COLUMN, &node, -1);
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2600
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2601 if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) {
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24969
diff changeset
2602 PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node));
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
2603 pidgin_dnd_file_manage(sd, b->account, b->name);
10229
39ffee70c286 [gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents: 10222
diff changeset
2604 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
39ffee70c286 [gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents: 10222
diff changeset
2605 } else {
39ffee70c286 [gaim-migrate @ 11364]
Alceste Scalas <alceste.scalas@gmx.net>
parents: 10222
diff changeset
2606 gtk_drag_finish(dc, FALSE, FALSE, t);
9495
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
2607 }
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
2608 }
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
2609 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2610 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2611
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2612 /* Altered from do_colorshift in gnome-panel */
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2613 static void
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2614 do_alphashift(GdkPixbuf *pixbuf, int shift)
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2615 {
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2616 gint i, j;
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2617 gint width, height, padding;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2618 guchar *pixels;
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2619 int val;
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2620
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2621 if (!gdk_pixbuf_get_has_alpha(pixbuf))
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2622 return;
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2623
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2624 width = gdk_pixbuf_get_width(pixbuf);
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2625 height = gdk_pixbuf_get_height(pixbuf);
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2626 padding = gdk_pixbuf_get_rowstride(pixbuf) - width * 4;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2627 pixels = gdk_pixbuf_get_pixels(pixbuf);
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2628
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2629 for (i = 0; i < height; i++) {
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2630 for (j = 0; j < width; j++) {
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2631 pixels++;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2632 pixels++;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2633 pixels++;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2634 val = *pixels - shift;
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2635 *(pixels++) = CLAMP(val, 0, 255);
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2636 }
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
2637 pixels += padding;
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2638 }
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2639 }
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2640
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
2641
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2642 static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node,
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2643 gboolean scaled, gboolean greyed)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2644 {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2645 gsize len;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2646 PurpleBuddy *buddy = NULL;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2647 PurpleGroup *group = NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2648 const guchar *data = NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2649 GdkPixbuf *buf, *ret = NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2650 PurpleBuddyIcon *icon = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2651 PurpleAccount *account = NULL;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2652 PurpleContact *contact = NULL;
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16357
diff changeset
2653 PurpleStoredImage *custom_img;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2654 PurplePluginProtocolInfo *prpl_info = NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2655 gint orig_width, orig_height, scale_width, scale_height;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2656
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2657 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2658 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2659 contact = (PurpleContact*)node;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2660 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2661 buddy = (PurpleBuddy*)node;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2662 contact = purple_buddy_get_contact(buddy);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2663 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2664 group = (PurpleGroup*)node;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2665 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2666 /* We don't need to do anything here. We just need to not fall
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2667 * into the else block and return. */
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2668 } else {
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2669 return NULL;
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2670 }
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2671
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2672 if (buddy) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2673 account = purple_buddy_get_account(buddy);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2674 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2675
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2676 if(account && account->gc) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2677 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2678 }
15490
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
2679
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2680 #if 0
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
2681 if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"))
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2682 return NULL;
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2683 #endif
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2684
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2685 /* If we have a contact then this is either a contact or a buddy and
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2686 * we want to fetch the custom icon for the contact. If we don't have
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2687 * a contact then this is a group or some other type of node and we
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2688 * want to use that directly. */
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2689 if (contact) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2690 custom_img = purple_buddy_icons_node_find_custom_icon((PurpleBlistNode*)contact);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2691 } else {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2692 custom_img = purple_buddy_icons_node_find_custom_icon(node);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2693 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2694
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2695 if (custom_img) {
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16357
diff changeset
2696 data = purple_imgstore_get_data(custom_img);
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16357
diff changeset
2697 len = purple_imgstore_get_size(custom_img);
14914
290eb2170f38 [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14882
diff changeset
2698 }
290eb2170f38 [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14882
diff changeset
2699
290eb2170f38 [gaim-migrate @ 17621]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 14882
diff changeset
2700 if (data == NULL) {
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2701 if (buddy) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2702 /* Not sure I like this...*/
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2703 if (!(icon = purple_buddy_icons_find(buddy->account, buddy->name)))
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2704 return NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2705 data = purple_buddy_icon_get_data(icon, &len);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2706 }
16625
d0a4891b5127 This is Sadrul's icon-migrate.patch from ticket #314.
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2707
d0a4891b5127 This is Sadrul's icon-migrate.patch from ticket #314.
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2708 if(data == NULL)
d0a4891b5127 This is Sadrul's icon-migrate.patch from ticket #314.
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2709 return NULL;
d0a4891b5127 This is Sadrul's icon-migrate.patch from ticket #314.
Richard Laager <rlaager@pidgin.im>
parents: 16545
diff changeset
2710 }
15490
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
2711
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2712 buf = pidgin_pixbuf_from_data(data, len);
16900
e9f12eb06c5b Rework purple_buddy_icons_find() to return a reference for the caller, which
Richard Laager <rlaager@pidgin.im>
parents: 16825
diff changeset
2713 purple_buddy_icon_unref(icon);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2714 if (!buf) {
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2715 purple_debug_warning("gtkblist", "Couldn't load buddy icon "
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2716 "on account %s (%s) buddyname=%s "
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2717 "custom_img_data=%p\n",
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2718 account ? purple_account_get_username(account) : "(no account)",
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2719 account ? purple_account_get_protocol_id(account) : "(no account)",
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2720 buddy ? purple_buddy_get_name(buddy) : "(no buddy)",
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2721 custom_img ? purple_imgstore_get_data(custom_img) : NULL);
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2722 purple_imgstore_unref(custom_img);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2723 return NULL;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2724 }
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
2725 purple_imgstore_unref(custom_img);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2726
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2727 if (greyed) {
23301
c460b5acd220 Buddy icons in the buddy list should not default to being marked idle. Thanks
Etan Reisner <deryni@pidgin.im>
parents: 23299
diff changeset
2728 gboolean offline = FALSE, idle = FALSE;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2729
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2730 if (buddy) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2731 PurplePresence *presence = purple_buddy_get_presence(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2732 if (!PURPLE_BUDDY_IS_ONLINE(buddy))
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2733 offline = TRUE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2734 if (purple_presence_is_idle(presence))
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2735 idle = TRUE;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2736 } else if (group) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2737 if (purple_blist_get_group_online_count(group) == 0)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2738 offline = TRUE;
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2739 }
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2740
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2741 if (offline)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2742 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.0, FALSE);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2743
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2744 if (idle)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2745 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0.25, FALSE);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2746 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2747
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2748 /* I'd use the pidgin_buddy_icon_get_scale_size() thing, but it won't
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2749 * tell me the original size, which I need for scaling purposes. */
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2750 scale_width = orig_width = gdk_pixbuf_get_width(buf);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2751 scale_height = orig_height = gdk_pixbuf_get_height(buf);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2752
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2753 if (prpl_info && prpl_info->icon_spec.scale_rules & PURPLE_ICON_SCALE_DISPLAY)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2754 purple_buddy_icon_get_scale_size(&prpl_info->icon_spec, &scale_width, &scale_height);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2755
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2756 if (scaled || scale_height > 200 || scale_width > 200) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2757 GdkPixbuf *tmpbuf;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2758 float scale_size = scaled ? 32.0 : 200.0;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2759 if(scale_height > scale_width) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2760 scale_width = scale_size * (double)scale_width / (double)scale_height;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2761 scale_height = scale_size;
10483
e7b09a8b1f52 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2762 } else {
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2763 scale_height = scale_size * (double)scale_height / (double)scale_width;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2764 scale_width = scale_size;
10483
e7b09a8b1f52 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2765 }
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2766 /* Scale & round before making square, so rectangular (but
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2767 * non-square) images get rounded corners too. */
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2768 tmpbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_width, scale_height);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2769 gdk_pixbuf_fill(tmpbuf, 0x00000000);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2770 gdk_pixbuf_scale(buf, tmpbuf, 0, 0, scale_width, scale_height, 0, 0, (double)scale_width/(double)orig_width, (double)scale_height/(double)orig_height, GDK_INTERP_BILINEAR);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2771 if (pidgin_gdk_pixbuf_is_opaque(tmpbuf))
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2772 pidgin_gdk_pixbuf_make_round(tmpbuf);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2773 ret = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, scale_size, scale_size);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2774 gdk_pixbuf_fill(ret, 0x00000000);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2775 gdk_pixbuf_copy_area(tmpbuf, 0, 0, scale_width, scale_height, ret, (scale_size-scale_width)/2, (scale_size-scale_height)/2);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2776 g_object_unref(G_OBJECT(tmpbuf));
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2777 } else {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2778 ret = gdk_pixbuf_scale_simple(buf,scale_width,scale_height, GDK_INTERP_BILINEAR);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2779 }
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2780 g_object_unref(G_OBJECT(buf));
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2781
10483
e7b09a8b1f52 [gaim-migrate @ 11773]
Nathan Walp <nwalp@pidgin.im>
parents: 10482
diff changeset
2782 return ret;
10482
01c1287da66f [gaim-migrate @ 11772]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10477
diff changeset
2783 }
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
2784
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2785 /* # - Status Icon
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2786 * P - Protocol Icon
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2787 * A - Buddy Icon
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2788 * [ - SMALL_SPACE
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2789 * = - LARGE_SPACE
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2790 * +--- STATUS_SIZE +--- td->avatar_width
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2791 * | +-- td->name_width |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2792 * +----+ +-------+ +---------+
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2793 * | | | | | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2794 * +-------------------------------------------+
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2795 * | [ = [ |--- TOOLTIP_BORDER
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2796 *name_height --+-| ######[BuddyName = PP [ AAAAAAAAAAA |--+
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2797 * | | ######[ = PP [ AAAAAAAAAAA | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2798 * STATUS SIZE -| | ######[[[[[[[[[[[[[[[[[[[[[ AAAAAAAAAAA | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2799 * +--+-| ######[Account: So-and-so [ AAAAAAAAAAA | |-- td->avatar_height
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2800 * | | [Idle: 4h 15m [ AAAAAAAAAAA | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2801 * height --+ | [Foo: Bar, Baz [ AAAAAAAAAAA | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2802 * | | [Status: Awesome [ AAAAAAAAAAA |--+
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2803 * +----| [Stop: Hammer Time [ |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2804 * | [ [ |--- TOOLTIP_BORDER
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2805 * +-------------------------------------------+
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2806 * | | | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2807 * | +----------------+ |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2808 * | | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2809 * | +-- td->width |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2810 * | |
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2811 * +---- TOOLTIP_BORDER +---- TOOLTIP_BORDER
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2812 *
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
2813 *
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2814 */
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
2815 #define STATUS_SIZE 16
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2816 #define TOOLTIP_BORDER 12
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2817 #define SMALL_SPACE 6
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2818 #define LARGE_SPACE 12
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
2819 #define PRPL_SIZE 16
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2820 struct tooltip_data {
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2821 PangoLayout *layout;
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2822 PangoLayout *name_layout;
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2823 GdkPixbuf *prpl_icon;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2824 GdkPixbuf *status_icon;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2825 GdkPixbuf *avatar;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2826 gboolean avatar_is_prpl_icon;
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2827 int avatar_width;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2828 int avatar_height;
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2829 int name_height;
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2830 int name_width;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2831 int width;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2832 int height;
23222
1dd9cdcdb1e6 Reduce the enormous padding in the group tooltip. People will hopefully dislike it less now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23139
diff changeset
2833 int padding;
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2834 };
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2835
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2836 static PangoLayout * create_pango_layout(const char *markup, int *width, int *height)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2837 {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2838 PangoLayout *layout;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2839 int w, h;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2840
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2841 layout = gtk_widget_create_pango_layout(gtkblist->tipwindow, NULL);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2842 pango_layout_set_markup(layout, markup, -1);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2843 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2844 pango_layout_set_width(layout, 300000);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2845
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2846 pango_layout_get_size (layout, &w, &h);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2847 if (width)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2848 *width = PANGO_PIXELS(w);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2849 if (height)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2850 *height = PANGO_PIXELS(h);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2851 return layout;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2852 }
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2853
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2854 static struct tooltip_data * create_tip_for_account(PurpleAccount *account)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2855 {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2856 struct tooltip_data *td = g_new0(struct tooltip_data, 1);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2857 td->status_icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2858 /* Yes, status_icon, not prpl_icon */
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2859 if (purple_account_is_disconnected(account))
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2860 gdk_pixbuf_saturate_and_pixelate(td->status_icon, td->status_icon, 0.0, FALSE);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2861 td->layout = create_pango_layout(purple_account_get_username(account), &td->width, &td->height);
23222
1dd9cdcdb1e6 Reduce the enormous padding in the group tooltip. People will hopefully dislike it less now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23139
diff changeset
2862 td->padding = SMALL_SPACE;
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2863 return td;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2864 }
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2865
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2866 static struct tooltip_data * create_tip_for_node(PurpleBlistNode *node, gboolean full)
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
2867 {
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2868 struct tooltip_data *td = g_new0(struct tooltip_data, 1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2869 PurpleAccount *account = NULL;
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2870 char *tmp = NULL, *node_name = NULL, *tooltip_text = NULL;
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2871
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2872 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2873 account = ((PurpleBuddy*)(node))->account;
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2874 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2875 account = ((PurpleChat*)(node))->account;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2876 }
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2877
23222
1dd9cdcdb1e6 Reduce the enormous padding in the group tooltip. People will hopefully dislike it less now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23139
diff changeset
2878 td->padding = TOOLTIP_BORDER;
15569
e85adc8d3b5c gtkblist changes to pidgin
Sean Egan <seanegan@pidgin.im>
parents: 15568
diff changeset
2879 td->status_icon = pidgin_blist_get_status_icon(node, PIDGIN_STATUS_ICON_LARGE);
16437
7ff7c3405ea2 Rework the buddy icon subsystem to use the imgstore subsystem, and modify the
Richard Laager <rlaager@pidgin.im>
parents: 16357
diff changeset
2880 td->avatar = pidgin_blist_get_buddy_icon(node, !full, FALSE);
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2881 if (account != NULL) {
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2882 td->prpl_icon = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2883 }
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
2884 tooltip_text = pidgin_get_tooltip_text(node, full);
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2885 if (tooltip_text && *tooltip_text) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2886 td->layout = create_pango_layout(tooltip_text, &td->width, &td->height);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2887 }
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2888
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2889 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2890 tmp = g_markup_escape_text(purple_buddy_get_name((PurpleBuddy*)node), -1);
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2891 } else if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2892 tmp = g_markup_escape_text(purple_chat_get_name((PurpleChat*)node), -1);
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2893 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2894 tmp = g_markup_escape_text(purple_group_get_name((PurpleGroup*)node), -1);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2895 } else {
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2896 /* I don't believe this can happen currently, I think
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2897 * everything that calls this function checks for one of the
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2898 * above node types first. */
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2899 tmp = g_strdup(_("Unknown node type"));
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2900 }
23094
c9a6547f17e1 Fix a NULL printf. Fixes #5387.
Daniel Atallah <datallah@pidgin.im>
parents: 22961
diff changeset
2901 node_name = g_strdup_printf("<span size='x-large' weight='bold'>%s</span>",
c9a6547f17e1 Fix a NULL printf. Fixes #5387.
Daniel Atallah <datallah@pidgin.im>
parents: 22961
diff changeset
2902 tmp ? tmp : "");
15982
31ae61be5792 Fix a small tooltip-related memleak
Mark Doliner <markdoliner@pidgin.im>
parents: 15931
diff changeset
2903 g_free(tmp);
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2904
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2905 td->name_layout = create_pango_layout(node_name, &td->name_width, &td->name_height);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2906 td->name_width += SMALL_SPACE + PRPL_SIZE;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
2907 td->name_height = MAX(td->name_height, PRPL_SIZE + SMALL_SPACE);
15526
2aa8c06f946e tooltip tweaks
Sean Egan <seanegan@pidgin.im>
parents: 15525
diff changeset
2908 #if 0 /* PRPL Icon as avatar */
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2909 if(!td->avatar && full) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
2910 td->avatar = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_LARGE);
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2911 td->avatar_is_prpl_icon = TRUE;
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
2912 }
15526
2aa8c06f946e tooltip tweaks
Sean Egan <seanegan@pidgin.im>
parents: 15525
diff changeset
2913 #endif
15769
813f36d31f6c Fix asserts when there is no buddy icon
Daniel Atallah <datallah@pidgin.im>
parents: 15692
diff changeset
2914
813f36d31f6c Fix asserts when there is no buddy icon
Daniel Atallah <datallah@pidgin.im>
parents: 15692
diff changeset
2915 if (td->avatar) {
813f36d31f6c Fix asserts when there is no buddy icon
Daniel Atallah <datallah@pidgin.im>
parents: 15692
diff changeset
2916 td->avatar_width = gdk_pixbuf_get_width(td->avatar);
813f36d31f6c Fix asserts when there is no buddy icon
Daniel Atallah <datallah@pidgin.im>
parents: 15692
diff changeset
2917 td->avatar_height = gdk_pixbuf_get_height(td->avatar);
813f36d31f6c Fix asserts when there is no buddy icon
Daniel Atallah <datallah@pidgin.im>
parents: 15692
diff changeset
2918 }
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2919
15550
d710f85e6d0e A small memory leak in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15546
diff changeset
2920 g_free(node_name);
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2921 g_free(tooltip_text);
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2922 return td;
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2923 }
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2924
21998
3dbae318c88d Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21903
diff changeset
2925 static gboolean
3dbae318c88d Refactor some of the tooltip drawing functions. And add some pretend docs.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21903
diff changeset
2926 pidgin_blist_paint_tip(GtkWidget *widget, gpointer null)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2927 {
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2928 GtkStyle *style;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2929 int current_height, max_width;
15542
8de6f9738f5b fix a weird tooltip rendering bug when the second buddy in a contact tooltip
Nathan Walp <nwalp@pidgin.im>
parents: 15539
diff changeset
2930 int max_text_width;
15546
f320e2b2a6e8 fix the display bug a bit smarter
Nathan Walp <nwalp@pidgin.im>
parents: 15545
diff changeset
2931 int max_avatar_width;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2932 GList *l;
15526
2aa8c06f946e tooltip tweaks
Sean Egan <seanegan@pidgin.im>
parents: 15525
diff changeset
2933 int prpl_col = 0;
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
2934 GtkTextDirection dir = gtk_widget_get_direction(widget);
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2935 int status_size = 0;
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
2936
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2937 if(gtkblist->tooltipdata == NULL)
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
2938 return FALSE;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2939
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2940 style = gtkblist->tipwindow->style;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2941
15542
8de6f9738f5b fix a weird tooltip rendering bug when the second buddy in a contact tooltip
Nathan Walp <nwalp@pidgin.im>
parents: 15539
diff changeset
2942 max_text_width = 0;
15546
f320e2b2a6e8 fix the display bug a bit smarter
Nathan Walp <nwalp@pidgin.im>
parents: 15545
diff changeset
2943 max_avatar_width = 0;
15545
46584790b5f0 really fix that tooltip display glitch
Nathan Walp <nwalp@pidgin.im>
parents: 15544
diff changeset
2944
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2945 for(l = gtkblist->tooltipdata; l; l = l->next)
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2946 {
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2947 struct tooltip_data *td = l->data;
15546
f320e2b2a6e8 fix the display bug a bit smarter
Nathan Walp <nwalp@pidgin.im>
parents: 15545
diff changeset
2948
15542
8de6f9738f5b fix a weird tooltip rendering bug when the second buddy in a contact tooltip
Nathan Walp <nwalp@pidgin.im>
parents: 15539
diff changeset
2949 max_text_width = MAX(max_text_width,
8de6f9738f5b fix a weird tooltip rendering bug when the second buddy in a contact tooltip
Nathan Walp <nwalp@pidgin.im>
parents: 15539
diff changeset
2950 MAX(td->width, td->name_width));
15546
f320e2b2a6e8 fix the display bug a bit smarter
Nathan Walp <nwalp@pidgin.im>
parents: 15545
diff changeset
2951 max_avatar_width = MAX(max_avatar_width, td->avatar_width);
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2952 if (td->status_icon)
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2953 status_size = STATUS_SIZE;
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2954 }
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2955
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2956 max_width = TOOLTIP_BORDER + status_size + SMALL_SPACE + max_text_width + SMALL_SPACE + max_avatar_width + TOOLTIP_BORDER;
15644
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2957 if (dir == GTK_TEXT_DIR_RTL)
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2958 prpl_col = TOOLTIP_BORDER + max_avatar_width + SMALL_SPACE;
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2959 else
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2960 prpl_col = TOOLTIP_BORDER + status_size + SMALL_SPACE + max_text_width - PRPL_SIZE;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2961
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2962 current_height = 12;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2963 for(l = gtkblist->tooltipdata; l; l = l->next)
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2964 {
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2965 struct tooltip_data *td = l->data;
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
2966
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
2967 if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar))
15648
47e9eddcf323 Add some braces to eliminate a compiler warning about an ambiguous else.
Richard Laager <rlaager@pidgin.im>
parents: 15644
diff changeset
2968 {
15644
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2969 if (dir == GTK_TEXT_DIR_RTL)
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2970 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2971 NULL, gtkblist->tipwindow, "tooltip",
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2972 TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, td->avatar_height + 2);
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2973 else
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2974 gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2975 NULL, gtkblist->tipwindow, "tooltip",
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2976 max_width - (td->avatar_width+ TOOLTIP_BORDER)-1,
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2977 current_height-1,td->avatar_width+2, td->avatar_height+2);
15648
47e9eddcf323 Add some braces to eliminate a compiler warning about an ambiguous else.
Richard Laager <rlaager@pidgin.im>
parents: 15644
diff changeset
2978 }
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
2979
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2980 if (td->status_icon) {
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2981 if (dir == GTK_TEXT_DIR_RTL)
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2982 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
2983 0, 0, max_width - TOOLTIP_BORDER - status_size, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2984 else
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2985 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2986 0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2987 }
22064
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
2988
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
2989 if(td->avatar) {
15644
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2990 if (dir == GTK_TEXT_DIR_RTL)
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2991 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2992 td->avatar, 0, 0, TOOLTIP_BORDER, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2993 else
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2994 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2995 td->avatar, 0, 0, max_width - (td->avatar_width + TOOLTIP_BORDER),
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
2996 current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
15648
47e9eddcf323 Add some braces to eliminate a compiler warning about an ambiguous else.
Richard Laager <rlaager@pidgin.im>
parents: 15644
diff changeset
2997 }
47e9eddcf323 Add some braces to eliminate a compiler warning about an ambiguous else.
Richard Laager <rlaager@pidgin.im>
parents: 15644
diff changeset
2998
22064
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
2999 if (!td->avatar_is_prpl_icon && td->prpl_icon)
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
3000 gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->prpl_icon,
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
3001 0, 0,
15526
2aa8c06f946e tooltip tweaks
Sean Egan <seanegan@pidgin.im>
parents: 15525
diff changeset
3002 prpl_col,
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
3003 current_height + ((td->name_height / 2) - (PRPL_SIZE / 2)),
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
3004 -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
3005
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3006 if (td->name_layout) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3007 if (dir == GTK_TEXT_DIR_RTL) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3008 gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3009 NULL, gtkblist->tipwindow, "tooltip",
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3010 max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000),
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3011 current_height, td->name_layout);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3012 } else {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3013 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3014 NULL, gtkblist->tipwindow, "tooltip",
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3015 TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3016 }
15644
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
3017 }
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3018
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3019 if (td->layout) {
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3020 if (dir != GTK_TEXT_DIR_RTL) {
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3021 gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3022 NULL, gtkblist->tipwindow, "tooltip",
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3023 TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height + td->name_height, td->layout);
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3024 } else {
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3025 gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3026 NULL, gtkblist->tipwindow, "tooltip",
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3027 max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000),
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3028 current_height + td->name_height,
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3029 td->layout);
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3030 }
15644
6ca1260680be RTL Tooltips.
Sean Egan <seanegan@pidgin.im>
parents: 15623
diff changeset
3031 }
15539
b204042fba24 fix overlapping in tooltips w/ large avatars
Nathan Walp <nwalp@pidgin.im>
parents: 15526
diff changeset
3032
23222
1dd9cdcdb1e6 Reduce the enormous padding in the group tooltip. People will hopefully dislike it less now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23139
diff changeset
3033 current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
3034 }
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3035 return FALSE;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3036 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3037
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3038 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
3039 pidgin_blist_destroy_tooltip_data(void)
8254
3b3d86ef983b [gaim-migrate @ 8977]
Mark Doliner <markdoliner@pidgin.im>
parents: 8252
diff changeset
3040 {
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3041 while(gtkblist->tooltipdata) {
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3042 struct tooltip_data *td = gtkblist->tooltipdata->data;
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3043
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3044 if(td->avatar)
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3045 g_object_unref(td->avatar);
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3046 if(td->status_icon)
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3047 g_object_unref(td->status_icon);
15503
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
3048 if(td->prpl_icon)
40690461a1af PRPL Icons in tooltips
Sean Egan <seanegan@pidgin.im>
parents: 15498
diff changeset
3049 g_object_unref(td->prpl_icon);
22118
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3050 if (td->layout)
7fc2d17a393e Get rid of some wasted empty space in the tooltips for chats and groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22087
diff changeset
3051 g_object_unref(td->layout);
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3052 if (td->name_layout)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3053 g_object_unref(td->name_layout);
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3054 g_free(td);
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3055 gtkblist->tooltipdata = g_list_delete_link(gtkblist->tooltipdata, gtkblist->tooltipdata);
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3056 }
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3057 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3058
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3059 void pidgin_blist_tooltip_destroy()
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3060 {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3061 pidgin_blist_destroy_tooltip_data();
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3062 pidgin_tooltip_destroy();
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3063 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3064
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3065 static void
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3066 pidgin_blist_align_tooltip(struct tooltip_data *td, GtkWidget *widget)
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3067 {
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3068 GtkTextDirection dir = gtk_widget_get_direction(widget);
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3069
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3070 if (dir == GTK_TEXT_DIR_RTL)
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3071 {
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3072 char* layout_name = purple_markup_strip_html(pango_layout_get_text(td->name_layout));
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3073 PangoDirection dir = pango_find_base_dir(layout_name, -1);
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3074 if (dir == PANGO_DIRECTION_RTL || dir == PANGO_DIRECTION_NEUTRAL)
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3075 pango_layout_set_alignment(td->name_layout, PANGO_ALIGN_RIGHT);
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3076 g_free(layout_name);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3077 pango_layout_set_alignment(td->layout, PANGO_ALIGN_RIGHT);
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3078 }
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3079 }
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3080
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3081 static gboolean
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3082 pidgin_blist_create_tooltip_for_node(GtkWidget *widget, gpointer data, int *w, int *h)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3083 {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3084 PurpleBlistNode *node = data;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3085 int width, height;
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3086 GList *list;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3087 int max_text_width = 0;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3088 int max_avatar_width = 0;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3089 int status_size = 0;
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3090
22064
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
3091 if (gtkblist->tooltipdata) {
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
3092 gtkblist->tipwindow = NULL;
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
3093 pidgin_blist_destroy_tooltip_data();
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
3094 }
8b35fd51087d Use the new tooltip functions to draw the tooltips in the conversation window.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22046
diff changeset
3095
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3096 gtkblist->tipwindow = widget;
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3097 if (PURPLE_BLIST_NODE_IS_CHAT(node) ||
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3098 PURPLE_BLIST_NODE_IS_BUDDY(node)) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3099 struct tooltip_data *td = create_tip_for_node(node, TRUE);
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3100 pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3101 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3102 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3103 PurpleGroup *group = (PurpleGroup*)node;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3104 GSList *accounts;
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3105 struct tooltip_data *td = create_tip_for_node(node, TRUE);
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3106 pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3107 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3108
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3109 /* Accounts with buddies in group */
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3110 accounts = purple_group_get_accounts(group);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3111 for (; accounts != NULL;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3112 accounts = g_slist_delete_link(accounts, accounts)) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3113 PurpleAccount *account = accounts->data;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3114 td = create_tip_for_account(account);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3115 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3116 }
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3117 } else if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3118 PurpleBlistNode *child;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3119 PurpleBuddy *b = purple_contact_get_priority_buddy((PurpleContact *)node);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3120
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3121 for(child = node->child; child; child = child->next)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3122 {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3123 if(PURPLE_BLIST_NODE_IS_BUDDY(child) && buddy_is_displayable((PurpleBuddy*)child)) {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3124 struct tooltip_data *td = create_tip_for_node(child, (b == (PurpleBuddy*)child));
24699
f7b485df05f3 A patch from db42 to fix right-to-left text in tooltips.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
3125 pidgin_blist_align_tooltip(td, gtkblist->tipwindow);
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3126 if (b == (PurpleBuddy *)child) {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3127 gtkblist->tooltipdata = g_list_prepend(gtkblist->tooltipdata, td);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3128 } else {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3129 gtkblist->tooltipdata = g_list_append(gtkblist->tooltipdata, td);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3130 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3131 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3132 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3133 } else {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3134 return FALSE;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3135 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3136
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3137 height = width = 0;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3138 for (list = gtkblist->tooltipdata; list; list = list->next) {
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3139 struct tooltip_data *td = list->data;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3140 max_text_width = MAX(max_text_width, MAX(td->width, td->name_width));
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3141 max_avatar_width = MAX(max_avatar_width, td->avatar_width);
23222
1dd9cdcdb1e6 Reduce the enormous padding in the group tooltip. People will hopefully dislike it less now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23139
diff changeset
3142 height += MAX(MAX(STATUS_SIZE, td->avatar_height), td->height + td->name_height) + td->padding;
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3143 if (td->status_icon)
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3144 status_size = MAX(status_size, STATUS_SIZE);
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3145 }
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3146 height += TOOLTIP_BORDER;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3147 width = TOOLTIP_BORDER + status_size + SMALL_SPACE + max_text_width + SMALL_SPACE + max_avatar_width + TOOLTIP_BORDER;
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3148
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3149 if (w)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3150 *w = width;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3151 if (h)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3152 *h = height;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3153
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3154 return TRUE;
8254
3b3d86ef983b [gaim-migrate @ 8977]
Mark Doliner <markdoliner@pidgin.im>
parents: 8252
diff changeset
3155 }
3b3d86ef983b [gaim-migrate @ 8977]
Mark Doliner <markdoliner@pidgin.im>
parents: 8252
diff changeset
3156
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3157 static gboolean pidgin_blist_expand_timeout(GtkWidget *tv)
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3158 {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3159 GtkTreePath *path;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3160 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3161 PurpleBlistNode *node;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3162 struct _pidgin_blist_node *gtknode;
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3163
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3164 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), gtkblist->tip_rect.x, gtkblist->tip_rect.y + (gtkblist->tip_rect.height/2),
19543
d79b0822afc7 Calculate what buddy we're pointing at from the middle of the cell rather than the age. Fixes #1422
Sean Egan <seanegan@pidgin.im>
parents: 19375
diff changeset
3165 &path, NULL, NULL, NULL))
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3166 return FALSE;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3167 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
3168 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3169
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3170 if(!PURPLE_BLIST_NODE_IS_CONTACT(node)) {
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
3171 gtk_tree_path_free(path);
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3172 return FALSE;
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
3173 }
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3174
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3175 gtknode = node->ui_data;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3176
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3177 if (!gtknode->contact_expanded) {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3178 GtkTreeIter i;
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
3179
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3180 pidgin_blist_expand_contact_cb(NULL, node);
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
3181
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3182 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &gtkblist->contact_rect);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3183 gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3184 gtkblist->mouseover_contact = node;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3185 gtk_tree_path_down (path);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3186 while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3187 GdkRectangle rect;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3188 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3189 gtkblist->contact_rect.height += rect.height;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3190 gtk_tree_path_next(path);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3191 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3192 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3193 gtk_tree_path_free(path);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3194 return FALSE;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3195 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3196
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3197 static gboolean buddy_is_displayable(PurpleBuddy *buddy)
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3198 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3199 struct _pidgin_blist_node *gtknode;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3200
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3201 if(!buddy)
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3202 return FALSE;
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3203
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3204 gtknode = ((PurpleBlistNode*)buddy)->ui_data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3205
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3206 return (purple_account_is_connected(buddy->account) &&
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3207 (purple_presence_is_online(buddy->presence) ||
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
3208 (gtknode && gtknode->recent_signonoff) ||
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
3209 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") ||
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3210 purple_blist_node_get_bool((PurpleBlistNode*)buddy, "show_offline")));
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3211 }
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
3212
18970
ef13a2231e36 Tooltips in infopanes
Sean Egan <seanegan@pidgin.im>
parents: 18956
diff changeset
3213 void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget)
ef13a2231e36 Tooltips in infopanes
Sean Egan <seanegan@pidgin.im>
parents: 18956
diff changeset
3214 {
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3215 pidgin_tooltip_show(widget, node, pidgin_blist_create_tooltip_for_node, pidgin_blist_paint_tip);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3216 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3217
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3218 static gboolean pidgin_blist_drag_motion_cb(GtkWidget *tv, GdkDragContext *drag_context,
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3219 gint x, gint y, guint time, gpointer user_data)
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3220 {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3221 GtkTreePath *path;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3222 int delay;
17485
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3223 GdkRectangle rect;
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3224
12679
42fa0799eef6 [gaim-migrate @ 15022]
Mark Doliner <markdoliner@pidgin.im>
parents: 12656
diff changeset
3225 /*
42fa0799eef6 [gaim-migrate @ 15022]
Mark Doliner <markdoliner@pidgin.im>
parents: 12656
diff changeset
3226 * When dragging a buddy into a contact, this is the delay before
42fa0799eef6 [gaim-migrate @ 15022]
Mark Doliner <markdoliner@pidgin.im>
parents: 12656
diff changeset
3227 * the contact auto-expands.
42fa0799eef6 [gaim-migrate @ 15022]
Mark Doliner <markdoliner@pidgin.im>
parents: 12656
diff changeset
3228 */
42fa0799eef6 [gaim-migrate @ 15022]
Mark Doliner <markdoliner@pidgin.im>
parents: 12656
diff changeset
3229 delay = 900;
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3230
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3231 if (gtkblist->drag_timeout) {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3232 if ((y > gtkblist->tip_rect.y) && ((y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y))
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3233 return FALSE;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3234 /* We've left the cell. Remove the timeout and create a new one below */
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3235 g_source_remove(gtkblist->drag_timeout);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3236 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3237
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3238 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tv), x, y, &path, NULL, NULL, NULL);
17485
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3239 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, &rect);
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3240
22455
1e4f21a50bc6 Plug some leaks caused by GtkTreePaths not being freed.
Daniel Atallah <datallah@pidgin.im>
parents: 22429
diff changeset
3241 if (path)
1e4f21a50bc6 Plug some leaks caused by GtkTreePaths not being freed.
Daniel Atallah <datallah@pidgin.im>
parents: 22429
diff changeset
3242 gtk_tree_path_free(path);
1e4f21a50bc6 Plug some leaks caused by GtkTreePaths not being freed.
Daniel Atallah <datallah@pidgin.im>
parents: 22429
diff changeset
3243
17485
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3244 /* Only autoexpand when in the middle of the cell to avoid annoying un-intended expands */
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3245 if (y < rect.y + (rect.height / 3) ||
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3246 y > rect.y + (2 * (rect.height /3)))
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3247 return FALSE;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
3248
17485
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3249 rect.height = rect.height / 3;
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3250 rect.y += rect.height;
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3251
e010c3ae591a Only auto-expand buddies when the mouse is hovering over the middle third of the buddy. This prevents un-intended expanding of buddies when you're only trying to re-order. Fixes #608
Sean Egan <seanegan@pidgin.im>
parents: 17418
diff changeset
3252 gtkblist->tip_rect = rect;
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3253
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3254 gtkblist->drag_timeout = g_timeout_add(delay, (GSourceFunc)pidgin_blist_expand_timeout, tv);
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3255
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3256 if (gtkblist->mouseover_contact) {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3257 if ((y < gtkblist->contact_rect.y) || ((y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3258 pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3259 gtkblist->mouseover_contact = NULL;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3260 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3261 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3262
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3263 return FALSE;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3264 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3265
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3266 static gboolean
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3267 pidgin_blist_create_tooltip(GtkWidget *widget, GtkTreePath *path,
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3268 gpointer null, int *w, int *h)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3269 {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3270 GtkTreeIter iter;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3271 PurpleBlistNode *node;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3272 gboolean editable = FALSE;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3273
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3274 /* If we're editing a cell (e.g. alias editing), don't show the tooltip */
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3275 g_object_get(G_OBJECT(gtkblist->text_rend), "editable", &editable, NULL);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3276 if (editable)
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3277 return FALSE;
8083
312f60085554 [gaim-migrate @ 8782]
Nathan Walp <nwalp@pidgin.im>
parents: 8046
diff changeset
3278
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3279 if (gtkblist->tooltipdata) {
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3280 gtkblist->tipwindow = NULL;
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3281 pidgin_blist_destroy_tooltip_data();
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3282 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3283
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3284 gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &iter, path);
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
3285 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
3286
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3287 return pidgin_blist_create_tooltip_for_node(widget, node, w, h);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3288 }
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3289
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3290 static gboolean pidgin_blist_motion_cb (GtkWidget *tv, GdkEventMotion *event, gpointer null)
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
3291 {
7636
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3292 if (gtkblist->mouseover_contact) {
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3293 if ((event->y < gtkblist->contact_rect.y) || ((event->y - gtkblist->contact_rect.height) > gtkblist->contact_rect.y)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3294 pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3295 gtkblist->mouseover_contact = NULL;
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3296 }
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3297 }
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3298
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3299 return FALSE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3300 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3301
22031
64dada91f5b0 The event handlers need to return a gboolean. Using void callbacks can lead to unpredictable behaviour.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22009
diff changeset
3302 static gboolean pidgin_blist_leave_cb (GtkWidget *w, GdkEventCrossing *e, gpointer n)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3303 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3304 if (gtkblist->timeout) {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3305 g_source_remove(gtkblist->timeout);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3306 gtkblist->timeout = 0;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3307 }
10382
32e07712e224 [gaim-migrate @ 11608]
Luke Schierer <lschiere@pidgin.im>
parents: 10357
diff changeset
3308
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3309 if (gtkblist->drag_timeout) {
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3310 g_source_remove(gtkblist->drag_timeout);
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3311 gtkblist->drag_timeout = 0;
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3312 }
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
3313
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3314 if (gtkblist->mouseover_contact &&
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
3315 !((e->x > gtkblist->contact_rect.x) && (e->x < (gtkblist->contact_rect.x + gtkblist->contact_rect.width)) &&
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
3316 (e->y > gtkblist->contact_rect.y) && (e->y < (gtkblist->contact_rect.y + gtkblist->contact_rect.height)))) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3317 pidgin_blist_collapse_contact_cb(NULL, gtkblist->mouseover_contact);
7636
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3318 gtkblist->mouseover_contact = NULL;
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
3319 }
22031
64dada91f5b0 The event handlers need to return a gboolean. Using void callbacks can lead to unpredictable behaviour.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22009
diff changeset
3320 return FALSE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3321 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3322
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3323 static void
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3324 toggle_debug(void)
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3325 {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
3326 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled",
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
3327 !purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled"));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3328 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3329
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3330 static char *get_mood_icon_path(const char *mood)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3331 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3332 char *path;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3333
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3334 if (!strcmp(mood, "busy")) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3335 path = g_build_filename(DATADIR, "pixmaps", "pidgin",
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3336 "status", "16", "busy.png", NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3337 } else if (!strcmp(mood, "hiptop")) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3338 path = g_build_filename(DATADIR, "pixmaps", "pidgin",
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3339 "emblems", "16", "hiptop.png", NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3340 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3341 char *filename = g_strdup_printf("%s.png", mood);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3342 path = g_build_filename(DATADIR, "pixmaps", "pidgin",
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3343 "emotes", "small", filename, NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3344 g_free(filename);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3345 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3346 return path;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3347 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3348
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3349 static void
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3350 update_status_with_mood(PurpleAccount *account, const gchar *mood,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3351 const gchar *text)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3352 {
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3353 if (mood && *mood) {
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3354 if (text) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3355 purple_account_set_status(account, "mood", TRUE,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3356 PURPLE_MOOD_NAME, mood,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3357 PURPLE_MOOD_COMMENT, text,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3358 NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3359 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3360 purple_account_set_status(account, "mood", TRUE,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3361 PURPLE_MOOD_NAME, mood,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3362 NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3363 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3364 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3365 purple_account_set_status(account, "mood", FALSE, NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3366 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3367 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3368
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3369 static void
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3370 edit_mood_cb(PurpleConnection *gc, PurpleRequestFields *fields)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3371 {
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3372 PurpleRequestField *mood_field;
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3373 GList *l;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3374
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3375 mood_field = purple_request_fields_get_field(fields, "mood");
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3376 l = purple_request_field_list_get_selected(mood_field);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3377
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3378 if (l) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3379 const char *mood = purple_request_field_list_get_data(mood_field, l->data);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3380
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3381 if (gc) {
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3382 const char *text;
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3383 PurpleAccount *account = purple_connection_get_account(gc);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3384
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3385 if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES) {
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3386 PurpleRequestField *text_field;
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3387 text_field = purple_request_fields_get_field(fields, "text");
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3388 text = purple_request_field_string_get_value(text_field);
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3389 } else {
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3390 text = NULL;
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3391 }
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3392
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3393 update_status_with_mood(account, mood, text);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3394 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3395 GList *accounts = purple_accounts_get_all_active();
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3396
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3397 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3398 PurpleAccount *account = (PurpleAccount *) accounts->data;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3399 PurpleConnection *gc = purple_account_get_connection(account);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3400
30364
28b3cd77ab50 Fix a crash when setting a non account-specific mood and an enabled account is offline
Daniel Atallah <datallah@pidgin.im>
parents: 30291
diff changeset
3401 if (gc && gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3402 update_status_with_mood(account, mood, NULL);
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3403 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3404 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3405 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3406 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3407 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3408
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3409 static void
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3410 global_moods_for_each(gpointer key, gpointer value, gpointer user_data)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3411 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3412 GList **out_moods = (GList **) user_data;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3413 PurpleMood *mood = (PurpleMood *) value;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3414
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3415 *out_moods = g_list_append(*out_moods, mood);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3416 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3417
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3418 static PurpleMood *
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3419 get_global_moods(void)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3420 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3421 GHashTable *global_moods =
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3422 g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3423 GHashTable *mood_counts =
29922
6c8d4407da9c Some fixes related to setting moods.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29919
diff changeset
3424 g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3425 GList *accounts = purple_accounts_get_all_active();
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3426 PurpleMood *result = NULL;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3427 GList *out_moods = NULL;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3428 int i = 0;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3429 int num_accounts = 0;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3430
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3431 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3432 PurpleAccount *account = (PurpleAccount *) accounts->data;
30291
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3433 if (purple_account_is_connected(account)) {
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3434 PurpleConnection *gc = purple_account_get_connection(account);
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3435
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3436 if (gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3437 PurplePluginProtocolInfo *prpl_info =
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3438 PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3439 PurpleMood *mood = NULL;
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3440
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3441 /* PURPLE_CONNECTION_SUPPORT_MOODS would not be set if the prpl doesn't
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3442 * have get_moods, so using PURPLE_PROTOCOL_PLUGIN_HAS_FUNC isn't necessary
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3443 * here */
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3444 for (mood = prpl_info->get_moods(account) ;
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3445 mood->mood != NULL ; mood++) {
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3446 int mood_count =
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3447 GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood));
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3448
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3449 if (!g_hash_table_lookup(global_moods, mood->mood)) {
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3450 g_hash_table_insert(global_moods, (gpointer)mood->mood, mood);
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3451 }
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3452 g_hash_table_insert(mood_counts, (gpointer)mood->mood,
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3453 GINT_TO_POINTER(mood_count + 1));
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3454 }
30291
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3455
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3456 num_accounts++;
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3457 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3458 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3459 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3460
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3461 g_hash_table_foreach(global_moods, global_moods_for_each, &out_moods);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3462 result = g_new0(PurpleMood, g_hash_table_size(global_moods) + 1);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3463
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3464 while (out_moods) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3465 PurpleMood *mood = (PurpleMood *) out_moods->data;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3466 int in_num_accounts =
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3467 GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood));
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3468
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3469 if (in_num_accounts == num_accounts) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3470 /* mood is present in all accounts supporting moods */
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3471 result[i].mood = mood->mood;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3472 result[i].description = mood->description;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3473 i++;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3474 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3475 out_moods = g_list_delete_link(out_moods, out_moods);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3476 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3477
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3478 g_hash_table_destroy(global_moods);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3479 g_hash_table_destroy(mood_counts);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3480
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3481 return result;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3482 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3483
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3484 /* get current set mood for all mood-supporting accounts, or NULL if not set
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3485 or not set to the same on all */
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3486 static const gchar *
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3487 get_global_mood_status(void)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3488 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3489 GList *accounts = purple_accounts_get_all_active();
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3490 const gchar *found_mood = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3491
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3492 for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3493 PurpleAccount *account = (PurpleAccount *) accounts->data;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3494
30291
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3495 if (purple_account_is_connected(account) &&
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3496 (purple_account_get_connection(account)->flags &
d6d39828431c pidgin: Fix a crash when accessing the Set Moods tool menu when having
Marcus Lundblad <malu@pidgin.im>
parents: 30267
diff changeset
3497 PURPLE_CONNECTION_SUPPORT_MOODS)) {
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3498 PurplePresence *presence = purple_account_get_presence(account);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3499 PurpleStatus *status = purple_presence_get_status(presence, "mood");
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3500 const gchar *curr_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3501
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3502 if (found_mood != NULL && !purple_strequal(curr_mood, found_mood)) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3503 /* found a different mood */
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3504 found_mood = NULL;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3505 break;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3506 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3507 found_mood = curr_mood;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3508 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3509 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3510 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3511
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3512 return found_mood;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3513 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3514
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3515 static void
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3516 set_mood_cb(GtkWidget *widget, PurpleAccount *account)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3517 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3518 const char *current_mood;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3519 PurpleRequestFields *fields;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3520 PurpleRequestFieldGroup *g;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3521 PurpleRequestField *f;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3522 PurpleConnection *gc = NULL;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3523 PurplePluginProtocolInfo *prpl_info = NULL;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3524 PurpleMood *mood;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3525 PurpleMood *global_moods = get_global_moods();
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3526
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3527 if (account) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3528 PurplePresence *presence = purple_account_get_presence(account);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3529 PurpleStatus *status = purple_presence_get_status(presence, "mood");
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3530 gc = purple_account_get_connection(account);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3531 g_return_if_fail(gc->prpl != NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3532 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3533 current_mood = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3534 } else {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3535 current_mood = get_global_mood_status();
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3536 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3537
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3538 fields = purple_request_fields_new();
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3539 g = purple_request_field_group_new(NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3540 f = purple_request_field_list_new("mood", _("Please select your mood from the list"));
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3541
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3542 purple_request_field_list_add(f, _("None"), "");
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3543 if (current_mood == NULL)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3544 purple_request_field_list_add_selected(f, _("None"));
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3545
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3546 /* TODO: rlaager wants this sorted. */
30473
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3547 /* TODO: darkrain wants it sorted post-translation */
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3548 if (account && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods))
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3549 mood = prpl_info->get_moods(account);
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3550 else
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3551 mood = global_moods;
7105a4535fe6 Add a comment noting the moods should be sorted post-translation.
Paul Aurich <darkrain42@pidgin.im>
parents: 30436
diff changeset
3552 for ( ; mood->mood != NULL ; mood++) {
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3553 char *path;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3554
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3555 if (mood->mood == NULL || mood->description == NULL)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3556 continue;
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3557
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3558 path = get_mood_icon_path(mood->mood);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3559 purple_request_field_list_add_icon(f, _(mood->description),
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3560 path, (gpointer)mood->mood);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3561 g_free(path);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3562
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3563 if (current_mood && !strcmp(current_mood, mood->mood))
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3564 purple_request_field_list_add_selected(f, _(mood->description));
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3565 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3566 purple_request_field_group_add_field(g, f);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3567
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3568 purple_request_fields_add_group(fields, g);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3569
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3570 /* if the connection allows setting a mood message */
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3571 if (gc && (gc->flags & PURPLE_CONNECTION_SUPPORT_MOOD_MESSAGES)) {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3572 g = purple_request_field_group_new(NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3573 f = purple_request_field_string_new("text",
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3574 _("Message (optional)"), NULL, FALSE);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3575 purple_request_field_group_add_field(g, f);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3576 purple_request_fields_add_group(fields, g);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3577 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3578
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3579 purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"),
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3580 NULL, fields,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3581 _("OK"), G_CALLBACK(edit_mood_cb),
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3582 _("Cancel"), NULL,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3583 gc ? purple_connection_get_account(gc) : NULL,
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3584 NULL, NULL, gc);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3585
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3586 g_free(global_moods);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3587 }
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3588
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3589 static void
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3590 set_mood_show(void)
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3591 {
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3592 set_mood_cb(NULL, NULL);
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
3593 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3594
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3595 /***************************************************
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3596 * Crap *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3597 ***************************************************/
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3598 static GtkItemFactoryEntry blist_menu[] =
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3599 {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
3600 /* NOTE: Do not set any accelerator to Control+O. It is mapped by
30731
ac6efa77da3e Make a note not to use Control+O, since it's used elsewhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
3601 gtk_blist_key_press_cb to "Get User Info" on the selected buddy. */
ac6efa77da3e Make a note not to use Control+O, since it's used elsewhere.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30706
diff changeset
3602
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3603 /* Buddies menu */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3604 { N_("/_Buddies"), NULL, NULL, 0, "<Branch>", NULL },
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
3605 { N_("/Buddies/New Instant _Message..."), "<CTL>M", pidgin_dialogs_im, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW },
23326
3b9627b6168d A simple patch from "bsd" to get the icon back for Buddies->Join a Chat.
Richard Laager <rlaager@pidgin.im>
parents: 23318
diff changeset
3606 { N_("/Buddies/Join a _Chat..."), "<CTL>C", pidgin_blist_joinchat_show, 0, "<StockItem>", PIDGIN_STOCK_CHAT },
16263
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
3607 { N_("/Buddies/Get User _Info..."), "<CTL>I", pidgin_dialogs_info, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_USER_INFO },
27e0ef0f38e6 Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@pidgin.im>
parents: 16259
diff changeset
3608 { N_("/Buddies/View User _Log..."), "<CTL>L", pidgin_dialogs_log, 0, "<Item>", NULL },
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3609 { "/Buddies/sep1", NULL, NULL, 0, "<Separator>", NULL },
20885
93cdff80a63b Add an accelerator for 'Buddies -> Show'. Fixes #3298.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20879
diff changeset
3610 { N_("/Buddies/Sh_ow"), NULL, NULL, 0, "<Branch>", NULL},
19771
455c96569611 (2007-09-03 07:57:30) rlaager: In the buddy list, we now have a Show submenu with a bunch of Show X items under it. It seems to me that the Show on each item is redundant and should be removed. This would be consistent with the Sort Buddies menu, where the items finish the sentence fragment started by the submenu name.
Richard Laager <rlaager@pidgin.im>
parents: 19734
diff changeset
3611 { N_("/Buddies/Show/_Offline Buddies"), NULL, pidgin_blist_edit_mode_cb, 1, "<CheckItem>", NULL },
455c96569611 (2007-09-03 07:57:30) rlaager: In the buddy list, we now have a Show submenu with a bunch of Show X items under it. It seems to me that the Show on each item is redundant and should be removed. This would be consistent with the Sort Buddies menu, where the items finish the sentence fragment started by the submenu name.
Richard Laager <rlaager@pidgin.im>
parents: 19734
diff changeset
3612 { N_("/Buddies/Show/_Empty Groups"), NULL, pidgin_blist_show_empty_groups_cb, 1, "<CheckItem>", NULL },
455c96569611 (2007-09-03 07:57:30) rlaager: In the buddy list, we now have a Show submenu with a bunch of Show X items under it. It seems to me that the Show on each item is redundant and should be removed. This would be consistent with the Sort Buddies menu, where the items finish the sentence fragment started by the submenu name.
Richard Laager <rlaager@pidgin.im>
parents: 19734
diff changeset
3613 { N_("/Buddies/Show/Buddy _Details"), NULL, pidgin_blist_buddy_details_cb, 1, "<CheckItem>", NULL },
455c96569611 (2007-09-03 07:57:30) rlaager: In the buddy list, we now have a Show submenu with a bunch of Show X items under it. It seems to me that the Show on each item is redundant and should be removed. This would be consistent with the Sort Buddies menu, where the items finish the sentence fragment started by the submenu name.
Richard Laager <rlaager@pidgin.im>
parents: 19734
diff changeset
3614 { N_("/Buddies/Show/Idle _Times"), NULL, pidgin_blist_show_idle_time_cb, 1, "<CheckItem>", NULL },
455c96569611 (2007-09-03 07:57:30) rlaager: In the buddy list, we now have a Show submenu with a bunch of Show X items under it. It seems to me that the Show on each item is redundant and should be removed. This would be consistent with the Sort Buddies menu, where the items finish the sentence fragment started by the submenu name.
Richard Laager <rlaager@pidgin.im>
parents: 19734
diff changeset
3615 { N_("/Buddies/Show/_Protocol Icons"), NULL, pidgin_blist_show_protocol_icons_cb, 1, "<CheckItem>", NULL },
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3616 { N_("/Buddies/_Sort Buddies"), NULL, NULL, 0, "<Branch>", NULL },
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3617 { "/Buddies/sep2", NULL, NULL, 0, "<Separator>", NULL },
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3618 { N_("/Buddies/_Add Buddy..."), "<CTL>B", pidgin_blist_add_buddy_cb, 0, "<StockItem>", GTK_STOCK_ADD },
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3619 { N_("/Buddies/Add C_hat..."), NULL, pidgin_blist_add_chat_cb, 0, "<StockItem>", GTK_STOCK_ADD },
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3620 { N_("/Buddies/Add _Group..."), NULL, purple_blist_request_add_group, 0, "<StockItem>", GTK_STOCK_ADD },
12799
3a4678907219 [gaim-migrate @ 15146]
Mark Doliner <markdoliner@pidgin.im>
parents: 12797
diff changeset
3621 { "/Buddies/sep3", NULL, NULL, 0, "<Separator>", NULL },
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3622 { N_("/Buddies/_Quit"), "<CTL>Q", purple_core_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
12300
c24609bae42d [gaim-migrate @ 14604]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12298
diff changeset
3623
c24609bae42d [gaim-migrate @ 14604]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12298
diff changeset
3624 /* Accounts menu */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3625 { N_("/_Accounts"), NULL, NULL, 0, "<Branch>", NULL },
23450
d66ca0a906d4 Change "Manage" to "Manage Accounts" in the Accounts menu.
Richard Laager <rlaager@pidgin.im>
parents: 23423
diff changeset
3626 { N_("/Accounts/Manage Accounts"), "<CTL>A", pidgin_accounts_window_show, 0, "<Item>", NULL },
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3627
8470
100fc1feea95 [gaim-migrate @ 9203]
Christian Hammond <chipx86@chipx86.com>
parents: 8444
diff changeset
3628 /* Tools */
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3629 { N_("/_Tools"), NULL, NULL, 0, "<Branch>", NULL },
21630
591a79c1b295 This merge has the effect of reverting the hinting code from trunk.
Richard Laager <rlaager@pidgin.im>
parents: 21586 21352
diff changeset
3630 { N_("/Tools/Buddy _Pounces"), NULL, pidgin_pounces_manager_show, 1, "<Item>", NULL },
18650
8a34ac83df75 - Add a skeleton for the Pidgin Certificate Manager and include it in
William Ehlhardt <williamehlhardt@gmail.com>
parents: 18621
diff changeset
3631 { N_("/Tools/_Certificates"), NULL, pidgin_certmgr_show, 0, "<Item>", NULL },
25876
6dafeb78324a Try to improve the wording in our custom smiley manager
Mark Doliner <markdoliner@pidgin.im>
parents: 25874
diff changeset
3632 { N_("/Tools/Custom Smile_ys"), "<CTL>Y", pidgin_smiley_manager_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_SMILEY },
21630
591a79c1b295 This merge has the effect of reverting the hinting code from trunk.
Richard Laager <rlaager@pidgin.im>
parents: 21586 21352
diff changeset
3633 { N_("/Tools/Plu_gins"), "<CTL>U", pidgin_plugin_dialog_show, 2, "<StockItem>", PIDGIN_STOCK_TOOLBAR_PLUGINS },
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3634 { N_("/Tools/Pr_eferences"), "<CTL>P", pidgin_prefs_show, 0, "<StockItem>", GTK_STOCK_PREFERENCES },
15614
8dcd6c09d69a Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@pidgin.im>
parents: 15606
diff changeset
3635 { N_("/Tools/Pr_ivacy"), NULL, pidgin_privacy_dialog_show, 0, "<Item>", NULL },
30733
0c4d0459306f Change the Set User Mood shortcut to Control+D. Control+O is in use
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30731
diff changeset
3636 { N_("/Tools/Set _Mood"), "<CTL>D", set_mood_show, 0, "<Item>", NULL },
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3637 { "/Tools/sep2", NULL, NULL, 0, "<Separator>", NULL },
23423
05e6ffac284c Update File Transfer icon and use new send fie icon. Fixes #2744.
Daniel Atallah <datallah@pidgin.im>
parents: 23326
diff changeset
3638 { N_("/Tools/_File Transfers"), "<CTL>T", pidgin_xfer_dialog_show, 0, "<StockItem>", PIDGIN_STOCK_TOOLBAR_TRANSFER },
15614
8dcd6c09d69a Remove excess menu item icon clutter, especialy where our icons made no sense. The Redo icon for Buddy Pounces?! Come on.
Sean Egan <seanegan@pidgin.im>
parents: 15606
diff changeset
3639 { N_("/Tools/R_oom List"), NULL, pidgin_roomlist_dialog_show, 0, "<Item>", NULL },
21630
591a79c1b295 This merge has the effect of reverting the hinting code from trunk.
Richard Laager <rlaager@pidgin.im>
parents: 21586 21352
diff changeset
3640 { N_("/Tools/System _Log"), NULL, gtk_blist_show_systemlog_cb, 3, "<Item>", NULL },
12600
7ecd4441fdc7 [gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents: 12592
diff changeset
3641 { "/Tools/sep3", NULL, NULL, 0, "<Separator>", NULL },
24232
9815b1c75ff6 take out default mute key binding
Ka-Hing Cheung <khc@pidgin.im>
parents: 24192
diff changeset
3642 { N_("/Tools/Mute _Sounds"), NULL, pidgin_blist_mute_sounds_cb, 0, "<CheckItem>", NULL },
17419
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
3643 /* Help */
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
3644 { N_("/_Help"), NULL, NULL, 0, "<Branch>", NULL },
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
3645 { N_("/Help/Online _Help"), "F1", gtk_blist_show_onlinehelp_cb, 0, "<StockItem>", GTK_STOCK_HELP },
29522
a5595d764a85 Split the "Debugging Information" and translator info into "Build Information"
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29514
diff changeset
3646 { "/Help/sep1", NULL, NULL, 0, "<Separator>", NULL },
a5595d764a85 Split the "Debugging Information" and translator info into "Build Information"
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29514
diff changeset
3647 { N_("/Help/_Build Information"), NULL, pidgin_dialogs_buildinfo, 0, "<Item>", NULL },
17419
2a7045fc50bf disapproval of revision 'e582f0260df20a57244730dc433866e754975417'
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17417
diff changeset
3648 { N_("/Help/_Debug Window"), NULL, toggle_debug, 0, "<Item>", NULL },
29525
424be0764e27 Break the developer information out into its own dialog. I also bolded a few
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29522
diff changeset
3649 { N_("/Help/De_veloper Information"), NULL, pidgin_dialogs_developers, 0, "<Item>", NULL },
31945
f1d8ab1029c4 Add a plugin information dialog that shows information for all plugins, even
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31889
diff changeset
3650 { N_("/Help/_Plugin Information"), NULL, pidgin_dialogs_plugins_info, 0, "<Item>", NULL },
29525
424be0764e27 Break the developer information out into its own dialog. I also bolded a few
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29522
diff changeset
3651 { N_("/Help/_Translator Information"), NULL, pidgin_dialogs_translators, 0, "<Item>", NULL },
29522
a5595d764a85 Split the "Debugging Information" and translator info into "Build Information"
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29514
diff changeset
3652 { "/Help/sep2", NULL, NULL, 0, "<Separator>", NULL },
21630
591a79c1b295 This merge has the effect of reverting the hinting code from trunk.
Richard Laager <rlaager@pidgin.im>
parents: 21586 21352
diff changeset
3653 { N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "<StockItem>", GTK_STOCK_ABOUT },
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3654 };
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3655
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3656 /*********************************************************
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3657 * Private Utility functions *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3658 *********************************************************/
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3659
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3660 static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3661 {
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3662 GString *str = g_string_new("");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3663 PurplePlugin *prpl;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3664 PurplePluginProtocolInfo *prpl_info = NULL;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3665 char *tmp;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3666
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3667 if (PURPLE_BLIST_NODE_IS_CHAT(node))
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3668 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3669 PurpleChat *chat;
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3670 GList *connections;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3671 GList *cur;
5274
71553f31db2e [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
3672 struct proto_chat_entry *pce;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3673 char *name, *value;
22585
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3674 PurpleConversation *conv;
21889
ab9f22496fae Show the topic of a chat, when available, in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21877
diff changeset
3675 PidginBlistNode *bnode = node->ui_data;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3676
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3677 chat = (PurpleChat *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3678 prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3679 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3680
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3681 connections = purple_connections_get_all();
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3682 if (connections && connections->next)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3683 {
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3684 tmp = g_markup_escape_text(chat->account->username, -1);
22121
91a6fe0bdb03 Show prpl icons in the tooltip for groups.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22118
diff changeset
3685 g_string_append_printf(str, _("<b>Account:</b> %s"), tmp);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3686 g_free(tmp);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3687 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3688
22585
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3689 if (bnode && bnode->conv.conv) {
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3690 conv = bnode->conv.conv;
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3691 } else {
22598
311d71f83831 Fix a memory leak
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22585
diff changeset
3692 char *chat_name;
22585
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3693 if (prpl_info && prpl_info->get_chat_name)
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3694 chat_name = prpl_info->get_chat_name(chat->components);
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3695 else
22598
311d71f83831 Fix a memory leak
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22585
diff changeset
3696 chat_name = g_strdup(purple_chat_get_name(chat));
22585
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3697
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3698 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chat_name,
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3699 chat->account);
22598
311d71f83831 Fix a memory leak
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22585
diff changeset
3700 g_free(chat_name);
22585
7a553ac98254 Fix Topic in chat node tooltips, and turn on using the transient chat node
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22584
diff changeset
3701 }
22754
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3702
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3703 if (conv && !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) {
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3704 g_string_append_printf(str, _("\n<b>Occupants:</b> %d"),
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3705 g_list_length(purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))));
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3706
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3707 if (prpl_info && (prpl_info->options & OPT_PROTO_CHAT_TOPIC)) {
23318
eb8dd6f2441c Don't try to escape a NULL text. This gets rid of a runtime warning.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23307
diff changeset
3708 const char *chattopic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv));
eb8dd6f2441c Don't try to escape a NULL text. This gets rid of a runtime warning.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23307
diff changeset
3709 char *topic = chattopic ? g_markup_escape_text(chattopic, -1) : NULL;
22754
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3710 g_string_append_printf(str, _("\n<b>Topic:</b> %s"), topic ? topic : _("(no topic set)"));
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3711 g_free(topic);
cb5419f81e76 Add number of occupants to the tooltip for chats. Fixes #3346
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22662
diff changeset
3712 }
21889
ab9f22496fae Show the topic of a chat, when available, in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21877
diff changeset
3713 }
ab9f22496fae Show the topic of a chat, when available, in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21877
diff changeset
3714
24635
0b5ffa5d7a3b Fix CID #384
Richard Laager <rlaager@pidgin.im>
parents: 24573
diff changeset
3715 if (prpl_info && prpl_info->chat_info != NULL)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3716 cur = prpl_info->chat_info(chat->account->gc);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3717 else
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3718 cur = NULL;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3719
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3720 while (cur != NULL)
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3721 {
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3722 pce = cur->data;
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3723
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3724 if (!pce->secret && (!pce->required &&
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3725 g_hash_table_lookup(chat->components, pce->identifier) == NULL))
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3726 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3727 tmp = purple_text_strip_mnemonic(pce->label);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3728 name = g_markup_escape_text(tmp, -1);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3729 g_free(tmp);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3730 value = g_markup_escape_text(g_hash_table_lookup(
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3731 chat->components, pce->identifier), -1);
10924
248233a58180 [gaim-migrate @ 12695]
Daniel Atallah <datallah@pidgin.im>
parents: 10918
diff changeset
3732 g_string_append_printf(str, "\n<b>%s</b> %s",
248233a58180 [gaim-migrate @ 12695]
Daniel Atallah <datallah@pidgin.im>
parents: 10918
diff changeset
3733 name ? name : "",
248233a58180 [gaim-migrate @ 12695]
Daniel Atallah <datallah@pidgin.im>
parents: 10918
diff changeset
3734 value ? value : "");
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3735 g_free(name);
8020
9c5ae652fc7f [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
3736 g_free(value);
9c5ae652fc7f [gaim-migrate @ 8700]
Nathan Walp <nwalp@pidgin.im>
parents: 8003
diff changeset
3737 }
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3738
5274
71553f31db2e [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
3739 g_free(pce);
28077
c2b493e058f1 Don't use pointers (even opaquely) once they're freed. Closes #9822.
Paul Aurich <darkrain42@pidgin.im>
parents: 27927
diff changeset
3740 cur = g_list_delete_link(cur, cur);
5274
71553f31db2e [gaim-migrate @ 5646]
Nathan Walp <nwalp@pidgin.im>
parents: 5273
diff changeset
3741 }
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3742 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3743 else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_BUDDY(node))
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3744 {
15209
9dd48f6c8805 [gaim-migrate @ 17933]
Evan Schoenberg <evands@pidgin.im>
parents: 15206
diff changeset
3745 /* NOTE: THIS FUNCTION IS NO LONGER CALLED FOR CONTACTS.
9dd48f6c8805 [gaim-migrate @ 17933]
Evan Schoenberg <evands@pidgin.im>
parents: 15206
diff changeset
3746 * It is only called by create_tip_for_node(), and create_tip_for_node() is never called for a contact.
9dd48f6c8805 [gaim-migrate @ 17933]
Evan Schoenberg <evands@pidgin.im>
parents: 15206
diff changeset
3747 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3748 PurpleContact *c;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3749 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3750 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3751 PurpleNotifyUserInfo *user_info;
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3752 GList *connections;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3753 char *tmp;
10567
87b02dd40349 [gaim-migrate @ 11951]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10544
diff changeset
3754 time_t idle_secs, signon;
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3755
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3756 if (PURPLE_BLIST_NODE_IS_CONTACT(node))
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3757 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3758 c = (PurpleContact *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3759 b = purple_contact_get_priority_buddy(c);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3760 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3761 else
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3762 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3763 b = (PurpleBuddy *)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3764 c = purple_buddy_get_contact(b);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
3765 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
3766
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3767 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3768 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3769
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3770 presence = purple_buddy_get_presence(b);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3771 user_info = purple_notify_user_info_new();
15206
70520a610969 [gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents: 15177
diff changeset
3772
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3773 /* Account */
24816
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3774 connections = purple_connections_get_all();
bd870d9ff0ab The other day while struct hiding, I noticed a for loop that was checking
Richard Laager <rlaager@pidgin.im>
parents: 24699
diff changeset
3775 if (full && connections && connections->next)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3776 {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3777 purple_notify_user_info_add_pair_plaintext(user_info, _("Account"),
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3778 purple_account_get_username(purple_buddy_get_account(b)));
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3779 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3780
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3781 /* Alias */
12942
b0b4accb55fb [gaim-migrate @ 15295]
Richard Laager <rlaager@pidgin.im>
parents: 12941
diff changeset
3782 /* If there's not a contact alias, the node is being displayed with
b0b4accb55fb [gaim-migrate @ 15295]
Richard Laager <rlaager@pidgin.im>
parents: 12941
diff changeset
3783 * this alias, so there's no point in showing it in the tooltip. */
21894
c7c35f9b87f7 Make sure we are still in the chat, and the chat can have a topic, when showing the topic in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21891
diff changeset
3784 if (full && c && b->alias != NULL && b->alias[0] != '\0' &&
13218
47708e4d453e [gaim-migrate @ 15581]
Richard Laager <rlaager@pidgin.im>
parents: 13202
diff changeset
3785 (c->alias != NULL && c->alias[0] != '\0') &&
47708e4d453e [gaim-migrate @ 15581]
Richard Laager <rlaager@pidgin.im>
parents: 13202
diff changeset
3786 strcmp(c->alias, b->alias) != 0)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3787 {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3788 purple_notify_user_info_add_pair_plaintext(user_info,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3789 _("Buddy Alias"), b->alias);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3790 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3791
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3792 /* Nickname/Server Alias */
12966
4ef0b7997610 [gaim-migrate @ 15319]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
3793 /* I'd like to only show this if there's a contact or buddy
4ef0b7997610 [gaim-migrate @ 15319]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
3794 * alias, but many people on MSN set long nicknames, which
4ef0b7997610 [gaim-migrate @ 15319]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
3795 * get ellipsized, so the only way to see the whole thing is
4ef0b7997610 [gaim-migrate @ 15319]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
3796 * to look at the tooltip. */
4ef0b7997610 [gaim-migrate @ 15319]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
3797 if (full && b->server_alias != NULL && b->server_alias[0] != '\0')
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3798 {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3799 purple_notify_user_info_add_pair_plaintext(user_info,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3800 _("Nickname"), b->server_alias);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3801 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3802
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3803 /* Logged In */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3804 signon = purple_presence_get_login_time(presence);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3805 if (full && PURPLE_BUDDY_IS_ONLINE(b) && signon > 0)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3806 {
18314
4e4e7aa803b3 This is a less dumb way to make sure we don't wrap
Mark Doliner <markdoliner@pidgin.im>
parents: 18280
diff changeset
3807 if (signon > time(NULL)) {
17698
939730b308fe Get outta my house. This adds a failsafe for the "Logged In"
Mark Doliner <markdoliner@pidgin.im>
parents: 17658
diff changeset
3808 /*
18314
4e4e7aa803b3 This is a less dumb way to make sure we don't wrap
Mark Doliner <markdoliner@pidgin.im>
parents: 18280
diff changeset
3809 * They signed on in the future?! Our local clock
4e4e7aa803b3 This is a less dumb way to make sure we don't wrap
Mark Doliner <markdoliner@pidgin.im>
parents: 18280
diff changeset
3810 * must be wrong, show the actual date instead of
4e4e7aa803b3 This is a less dumb way to make sure we don't wrap
Mark Doliner <markdoliner@pidgin.im>
parents: 18280
diff changeset
3811 * "4 days", etc.
17698
939730b308fe Get outta my house. This adds a failsafe for the "Logged In"
Mark Doliner <markdoliner@pidgin.im>
parents: 17658
diff changeset
3812 */
939730b308fe Get outta my house. This adds a failsafe for the "Logged In"
Mark Doliner <markdoliner@pidgin.im>
parents: 17658
diff changeset
3813 tmp = g_strdup(purple_date_format_long(localtime(&signon)));
939730b308fe Get outta my house. This adds a failsafe for the "Logged In"
Mark Doliner <markdoliner@pidgin.im>
parents: 17658
diff changeset
3814 } else
939730b308fe Get outta my house. This adds a failsafe for the "Logged In"
Mark Doliner <markdoliner@pidgin.im>
parents: 17658
diff changeset
3815 tmp = purple_str_seconds_to_string(time(NULL) - signon);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3816 purple_notify_user_info_add_pair_plaintext(user_info, _("Logged In"), tmp);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3817 g_free(tmp);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3818 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3819
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3820 /* Idle */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3821 if (purple_presence_is_idle(presence))
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3822 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3823 idle_secs = purple_presence_get_idle_time(presence);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3824 if (idle_secs > 0)
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3825 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3826 tmp = purple_str_seconds_to_string(time(NULL) - idle_secs);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3827 purple_notify_user_info_add_pair_plaintext(user_info, _("Idle"), tmp);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3828 g_free(tmp);
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3829 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3830 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3831
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3832 /* Last Seen */
21894
c7c35f9b87f7 Make sure we are still in the chat, and the chat can have a topic, when showing the topic in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21891
diff changeset
3833 if (full && c && !PURPLE_BUDDY_IS_ONLINE(b))
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3834 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3835 struct _pidgin_blist_node *gtknode = ((PurpleBlistNode *)c)->ui_data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3836 PurpleBlistNode *bnode;
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3837 int lastseen = 0;
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3838
21894
c7c35f9b87f7 Make sure we are still in the chat, and the chat can have a topic, when showing the topic in the tooltip.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21891
diff changeset
3839 if (gtknode && (!gtknode->contact_expanded || PURPLE_BLIST_NODE_IS_CONTACT(node)))
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3840 {
11437
20ba0815b4f8 [gaim-migrate @ 13674]
Richard Laager <rlaager@pidgin.im>
parents: 11436
diff changeset
3841 /* We're either looking at a buddy for a collapsed contact or
11438
46e5a461d0aa [gaim-migrate @ 13675]
Richard Laager <rlaager@pidgin.im>
parents: 11437
diff changeset
3842 * an expanded contact itself so we show the most recent
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3843 * (largest) last_seen time for any of the buddies under
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3844 * the contact. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3845 for (bnode = ((PurpleBlistNode *)c)->child ; bnode != NULL ; bnode = bnode->next)
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3846 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3847 int value = purple_blist_node_get_int(bnode, "last_seen");
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3848 if (value > lastseen)
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3849 lastseen = value;
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3850 }
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3851 }
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3852 else
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3853 {
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3854 /* We're dealing with a buddy under an expanded contact,
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3855 * so we show the last_seen time for the buddy. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3856 lastseen = purple_blist_node_get_int(&b->node, "last_seen");
11023
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3857 }
1e39a0e74a18 [gaim-migrate @ 12895]
Richard Laager <rlaager@pidgin.im>
parents: 11018
diff changeset
3858
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3859 if (lastseen > 0)
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3860 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3861 tmp = purple_str_seconds_to_string(time(NULL) - lastseen);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3862 purple_notify_user_info_add_pair_plaintext(user_info, _("Last Seen"), tmp);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3863 g_free(tmp);
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3864 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3865 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
3866
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3867
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3868 /* Offline? */
24927
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3869 /* FIXME: Why is this status special-cased by the core? --rlaager
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3870 * FIXME: Alternatively, why not have the core do all of them? --rlaager */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3871 if (!PURPLE_BUDDY_IS_ONLINE(b)) {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3872 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Offline"));
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3873 }
10992
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10968
diff changeset
3874
19802
5fe45f8b06da Do not bother the prpl about a tooltip for a disconnected account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
3875 if (purple_account_is_connected(b->account) &&
5fe45f8b06da Do not bother the prpl about a tooltip for a disconnected account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
3876 prpl_info && prpl_info->tooltip_text)
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3877 {
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3878 /* Additional text from the PRPL */
15206
70520a610969 [gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents: 15177
diff changeset
3879 prpl_info->tooltip_text(b, user_info, full);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3880 }
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3881
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3882 /* These are Easter Eggs. Patches to remove them will be rejected. */
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3883 if (!g_ascii_strcasecmp(b->name, "robflynn"))
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3884 purple_notify_user_info_add_pair_plaintext(user_info, _("Description"), _("Spooky"));
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3885 if (!g_ascii_strcasecmp(b->name, "seanegn"))
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3886 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Awesome"));
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3887 if (!g_ascii_strcasecmp(b->name, "chipx86"))
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3888 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), _("Rockin'"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3889
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3890 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
15206
70520a610969 [gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents: 15177
diff changeset
3891 g_string_append(str, tmp);
70520a610969 [gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents: 15177
diff changeset
3892 g_free(tmp);
70520a610969 [gaim-migrate @ 17930]
Evan Schoenberg <evands@pidgin.im>
parents: 15177
diff changeset
3893
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3894 purple_notify_user_info_destroy(user_info);
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3895 } else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3896 gint count;
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3897 PurpleGroup *group = (PurpleGroup*)node;
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3898 PurpleNotifyUserInfo *user_info;
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3899
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3900 user_info = purple_notify_user_info_new();
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3901
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3902 count = purple_blist_get_group_online_count(group);
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3903 if (count != 0) {
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3904 /* Online buddies in group */
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3905 char tmp2[12];
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3906 sprintf(tmp2, "%d", count);
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3907 purple_notify_user_info_add_pair_plaintext(user_info,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3908 _("Online Buddies"), tmp2);
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3909 }
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3910
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3911 count = purple_blist_get_group_size(group, FALSE);
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3912 if (count != 0) {
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3913 /* Total buddies (from online accounts) in group */
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3914 char tmp2[12];
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3915 sprintf(tmp2, "%d", count);
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
3916 purple_notify_user_info_add_pair_html(user_info,
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32148
diff changeset
3917 _("Total Buddies"), tmp2);
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
3918 }
22043
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3919
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3920 tmp = purple_notify_user_info_get_text_with_newline(user_info, "\n");
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3921 g_string_append(str, tmp);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3922 g_free(tmp);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3923
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3924 purple_notify_user_info_destroy(user_info);
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3925 }
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3926
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3927 purple_signal_emit(pidgin_blist_get_handle(), "drawing-tooltip",
a0e23e746e07 Add tooltips to groups in the buddy list. The tooltips show the current online
Etan Reisner <deryni@pidgin.im>
parents: 22031
diff changeset
3928 node, str, full);
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3929
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
3930 return g_string_free(str, FALSE);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3931 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3932
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3933 static GHashTable *cached_emblems;
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3934
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3935 static void _cleanup_cached_emblem(gpointer data, GObject *obj) {
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3936 g_hash_table_remove(cached_emblems, data);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3937 }
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3938
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3939 static GdkPixbuf * _pidgin_blist_get_cached_emblem(gchar *path) {
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3940 GdkPixbuf *pb = g_hash_table_lookup(cached_emblems, path);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3941
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3942 if (pb != NULL) {
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3943 /* The caller gets a reference */
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3944 g_object_ref(pb);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3945 g_free(path);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3946 } else {
31889
96183796df0c Start looking at the GError parameter every time we call these functions:
Mark Doliner <markdoliner@pidgin.im>
parents: 31642
diff changeset
3947 pb = pidgin_pixbuf_new_from_file(path);
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3948 if (pb != NULL) {
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3949 /* We don't want to own a ref to the pixbuf, but we need to keep clean up. */
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3950 /* I'm not sure if it would be better to just keep our ref and not let the emblem ever be destroyed */
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3951 g_object_weak_ref(G_OBJECT(pb), _cleanup_cached_emblem, path);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3952 g_hash_table_insert(cached_emblems, path, pb);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3953 } else
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3954 g_free(path);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3955 }
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3956
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3957 return pb;
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3958 }
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3959
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3960 GdkPixbuf *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3961 pidgin_blist_get_emblem(PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3962 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3963 PurpleBuddy *buddy = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
3964 struct _pidgin_blist_node *gtknode = node->ui_data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3965 PurplePlugin *prpl;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3966 PurplePluginProtocolInfo *prpl_info;
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3967 const char *name = NULL;
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3968 char *filename, *path;
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
3969 PurplePresence *p = NULL;
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
3970 PurpleStatus *tune;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3971
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3972 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3973 if(!gtknode->contact_expanded) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3974 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3975 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3976 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3977 buddy = (PurpleBuddy*)node;
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
3978 p = purple_buddy_get_presence(buddy);
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
3979 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
24927
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3980 /* This emblem comes from the small emoticon set now,
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3981 * to reduce duplication. */
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3982 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes",
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
3983 "small", "mobile.png", NULL);
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3984 return _pidgin_blist_get_cached_emblem(path);
18373
f6b2e4dd0e9b Mobile icon trumps prpl icon in expanded buddies. Fixes #515
Sean Egan <seanegan@pidgin.im>
parents: 18372
diff changeset
3985 }
f6b2e4dd0e9b Mobile icon trumps prpl icon in expanded buddies. Fixes #515
Sean Egan <seanegan@pidgin.im>
parents: 18372
diff changeset
3986
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
3987 if (((struct _pidgin_blist_node*)(node->parent->ui_data))->contact_expanded) {
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
3988 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"))
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
3989 return NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3990 return pidgin_create_prpl_icon(((PurpleBuddy*)node)->account, PIDGIN_PRPL_ICON_SMALL);
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
3991 }
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3992 } else {
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3993 return NULL;
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
3994 }
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
3995
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3996 g_return_val_if_fail(buddy != NULL, NULL);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
3997
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
3998 if (!purple_privacy_check(buddy->account, purple_buddy_get_name(buddy))) {
15561
bdb019a1f485 Blocked emblem
Sean Egan <seanegan@pidgin.im>
parents: 15559
diff changeset
3999 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "blocked.png", NULL);
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4000 return _pidgin_blist_get_cached_emblem(path);
15588
e6e89a427ed5 Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
Sean Egan <seanegan@pidgin.im>
parents: 15577
diff changeset
4001 }
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4002
24907
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4003 /* If we came through the contact code flow above, we didn't need
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4004 * to get the presence until now. */
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4005 if (p == NULL)
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4006 p = purple_buddy_get_presence(buddy);
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4007
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4008 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOBILE)) {
24927
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4009 /* This emblem comes from the small emoticon set now, to reduce duplication. */
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4010 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", "small", "mobile.png", NULL);
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4011 return _pidgin_blist_get_cached_emblem(path);
15561
bdb019a1f485 Blocked emblem
Sean Egan <seanegan@pidgin.im>
parents: 15559
diff changeset
4012 }
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4013
24771
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4014 tune = purple_presence_get_status(p, "tune");
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4015 if (tune && purple_status_is_active(tune)) {
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4016 /* Only in MSN.
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4017 * TODO: Replace "Tune" with generalized "Media" in 3.0. */
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4018 if (purple_status_get_attr_string(tune, "game") != NULL) {
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4019 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "game.png", NULL);
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4020 return _pidgin_blist_get_cached_emblem(path);
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4021 }
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4022 /* Only in MSN.
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4023 * TODO: Replace "Tune" with generalized "Media" in 3.0. */
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4024 if (purple_status_get_attr_string(tune, "office") != NULL) {
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4025 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", "office.png", NULL);
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4026 return _pidgin_blist_get_cached_emblem(path);
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4027 }
7a17ecc0c85b Add the Games and Office media to MSN as attributes tacked on to the tune
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24699
diff changeset
4028 /* Regular old "tune" is the only one in all protocols. */
24927
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4029 /* This emblem comes from the small emoticon set now, to reduce duplication. */
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4030 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emotes", "small", "music.png", NULL);
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4031 return _pidgin_blist_get_cached_emblem(path);
20317
8de19a02aa64 Display a music emblem in the buddylist when appropriate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20312
diff changeset
4032 }
8de19a02aa64 Display a music emblem in the buddylist when appropriate.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20312
diff changeset
4033
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4034 prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4035 if (!prpl)
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4036 return NULL;
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4037
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4038 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4039 if (prpl_info && prpl_info->list_emblem)
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4040 name = prpl_info->list_emblem(buddy);
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4041
24906
4070aa2c4ce5 Look at the mood status attribute on a buddy when picking the emblem.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
4042 if (name == NULL) {
24907
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4043 PurpleStatus *status;
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4044
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4045 if (!purple_presence_is_status_primitive_active(p, PURPLE_STATUS_MOOD))
24907
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4046 return NULL;
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4047
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
4048 status = purple_presence_get_status(p, "mood");
24907
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4049 name = purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
4050
24907
13118548c74c Add a PURPLE_STATUS_MOOD primitive and change ICQ to use it.
Richard Laager <rlaager@pidgin.im>
parents: 24906
diff changeset
4051 if (!(name && *name))
24906
4070aa2c4ce5 Look at the mood status attribute on a buddy when picking the emblem.
Richard Laager <rlaager@pidgin.im>
parents: 24635
diff changeset
4052 return NULL;
24927
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4053
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4054 path = get_mood_icon_path(name);
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4055 } else {
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4056 filename = g_strdup_printf("%s.png", name);
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4057 path = g_build_filename(DATADIR, "pixmaps", "pidgin", "emblems", "16", filename, NULL);
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4058 g_free(filename);
953887517fb7 Now that the "Set Mood" UI is in Pidgin, it can do whatever it likes to
Richard Laager <rlaager@pidgin.im>
parents: 24915
diff changeset
4059 }
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4060
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4061 /* _pidgin_blist_get_cached_emblem() assumes ownership of path */
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
4062 return _pidgin_blist_get_cached_emblem(path);
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4063 }
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
4064
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4065
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
4066 GdkPixbuf *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4067 pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4068 {
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4069 GdkPixbuf *ret;
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4070 const char *icon = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4071 struct _pidgin_blist_node *gtknode = node->ui_data;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4072 struct _pidgin_blist_node *gtkbuddynode = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4073 PurpleBuddy *buddy = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4074 PurpleChat *chat = NULL;
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
4075 GtkIconSize icon_size = gtk_icon_size_from_name((size == PIDGIN_STATUS_ICON_LARGE) ? PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL :
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
4076 PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4077
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4078 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4079 if(!gtknode->contact_expanded) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4080 buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
17086
4b6d59cdfaca This is what I actually intended to commit in aee2b2d67b643d59beb0b75b460c553c804e8220. The rest of the mess being pushed is me trying to clean up my mess.
Daniel Atallah <datallah@pidgin.im>
parents: 17082
diff changeset
4081 if (buddy != NULL)
4b6d59cdfaca This is what I actually intended to commit in aee2b2d67b643d59beb0b75b460c553c804e8220. The rest of the mess being pushed is me trying to clean up my mess.
Daniel Atallah <datallah@pidgin.im>
parents: 17082
diff changeset
4082 gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4083 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4084 } else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4085 buddy = (PurpleBuddy*)node;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
4086 gtkbuddynode = node->ui_data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4087 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4088 chat = (PurpleChat*)node;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4089 } else {
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4090 return NULL;
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4091 }
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4092
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4093 if(buddy || chat) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4094 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4095 PurplePlugin *prpl;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4096
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4097 if(buddy)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4098 account = buddy->account;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4099 else
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4100 account = chat->account;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4101
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4102 prpl = purple_find_prpl(purple_account_get_protocol_id(account));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4103 if(!prpl)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4104 return NULL;
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4105 }
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4106
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4107 if(buddy) {
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4108 PurpleConversation *conv = find_conversation_with_buddy(buddy);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4109 PurplePresence *p;
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4110 gboolean trans;
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4111
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4112 if(conv != NULL) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4113 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
19804
ecf7f92f4831 Show the 'new message' icon correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19803
diff changeset
4114 if (gtkconv == NULL && size == PIDGIN_STATUS_ICON_SMALL) {
ecf7f92f4831 Show the 'new message' icon correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19803
diff changeset
4115 PidginBlistNode *ui = buddy->node.ui_data;
ecf7f92f4831 Show the 'new message' icon correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19803
diff changeset
4116 if (ui == NULL || (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE))
ecf7f92f4831 Show the 'new message' icon correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19803
diff changeset
4117 return gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview),
ecf7f92f4831 Show the 'new message' icon correctly.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19803
diff changeset
4118 PIDGIN_STOCK_STATUS_MESSAGE, icon_size, "GtkTreeView");
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4119 }
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4120 }
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4121
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4122 p = purple_buddy_get_presence(buddy);
20365
a7cf3b1462dc show transparent status icons for idle tooltips. Patch from #465
Sean Egan <seanegan@pidgin.im>
parents: 20354
diff changeset
4123 trans = purple_presence_is_idle(p);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4124
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
4125 if (PURPLE_BUDDY_IS_ONLINE(buddy) && gtkbuddynode && gtkbuddynode->recent_signonoff)
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4126 icon = PIDGIN_STOCK_STATUS_LOGIN;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
4127 else if (gtkbuddynode && gtkbuddynode->recent_signonoff)
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4128 icon = PIDGIN_STOCK_STATUS_LOGOUT;
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
4129 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4130 if (trans)
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4131 icon = PIDGIN_STOCK_STATUS_BUSY_I;
15554
9a0b1403e7f2 Faded idle status icons
Sean Egan <seanegan@pidgin.im>
parents: 15552
diff changeset
4132 else
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4133 icon = PIDGIN_STOCK_STATUS_BUSY;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4134 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4135 if (trans)
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4136 icon = PIDGIN_STOCK_STATUS_AWAY_I;
15554
9a0b1403e7f2 Faded idle status icons
Sean Egan <seanegan@pidgin.im>
parents: 15552
diff changeset
4137 else
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4138 icon = PIDGIN_STOCK_STATUS_AWAY;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4139 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY))
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4140 if (trans)
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4141 icon = PIDGIN_STOCK_STATUS_XA_I;
15554
9a0b1403e7f2 Faded idle status icons
Sean Egan <seanegan@pidgin.im>
parents: 15552
diff changeset
4142 else
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4143 icon = PIDGIN_STOCK_STATUS_XA;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4144 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE))
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4145 icon = PIDGIN_STOCK_STATUS_OFFLINE;
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4146 else if (trans)
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4147 icon = PIDGIN_STOCK_STATUS_AVAILABLE_I;
17486
81eb43dbc844 Show the Invisible icon (the same one in the statusbox for buddies that are broadcasting an invisible status to you. This should fix #740, but I'm not positive
Sean Egan <seanegan@pidgin.im>
parents: 17485
diff changeset
4148 else if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_INVISIBLE))
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4149 icon = PIDGIN_STOCK_STATUS_INVISIBLE;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
4150 else
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4151 icon = PIDGIN_STOCK_STATUS_AVAILABLE;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
4152 } else if (chat) {
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4153 icon = PIDGIN_STOCK_STATUS_CHAT;
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
4154 } else {
19718
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4155 icon = PIDGIN_STOCK_STATUS_PERSON;
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4156 }
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4157
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4158 ret = gtk_widget_render_icon (GTK_WIDGET(gtkblist->treeview), icon,
4a89a6e3944c If a conversation doesn't have UI-data, consider it a hidden conversation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19701
diff changeset
4159 icon_size, "GtkTreeView");
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4160 return ret;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4161 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4162
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4163 static const char *
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4164 theme_font_get_color_default(PidginThemeFont *font, const char *def)
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4165 {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4166 const char *ret;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4167 if (!font || !(ret = pidgin_theme_font_get_color_describe(font)))
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4168 ret = def;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4169 return ret;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4170 }
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4171
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4172 static const char *
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4173 theme_font_get_face_default(PidginThemeFont *font, const char *def)
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4174 {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4175 const char *ret;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4176 if (!font || !(ret = pidgin_theme_font_get_font_face(font)))
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4177 ret = def;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4178 return ret;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4179 }
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4180
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4181 gchar *
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4182 pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4183 {
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23968
diff changeset
4184 const char *name, *name_color, *name_font, *status_color, *status_font;
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23968
diff changeset
4185 char *text = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4186 PurplePlugin *prpl;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4187 PurplePluginProtocolInfo *prpl_info = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4188 PurpleContact *contact;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4189 PurplePresence *presence;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4190 struct _pidgin_blist_node *gtkcontactnode = NULL;
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23968
diff changeset
4191 char *idletime = NULL, *statustext = NULL, *nametext = NULL;
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4192 PurpleConversation *conv = find_conversation_with_buddy(b);
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4193 gboolean hidden_conv = FALSE;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4194 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4195 PidginThemeFont *statusfont = NULL, *namefont = NULL;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4196 PidginBlistTheme *theme;
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4197
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4198 if (conv != NULL) {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4199 PidginBlistNode *ui = b->node.ui_data;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4200 if (ui) {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4201 if (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4202 hidden_conv = TRUE;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4203 } else {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4204 if (PIDGIN_CONVERSATION(conv) == NULL)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4205 hidden_conv = TRUE;
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4206 }
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4207 }
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4208
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4209 /* XXX Good luck cleaning up this crap */
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24969
diff changeset
4210 contact = PURPLE_CONTACT(PURPLE_BLIST_NODE(b)->parent);
19375
96de09c01b53 Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@pidgin.im>
parents: 19361
diff changeset
4211 if(contact)
24974
a81952e9babb Update some casts (that the script didn't fix correctly) to GObject macros.
Richard Laager <rlaager@pidgin.im>
parents: 24969
diff changeset
4212 gtkcontactnode = purple_blist_node_get_ui_data(PURPLE_BLIST_NODE(contact));
19375
96de09c01b53 Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@pidgin.im>
parents: 19361
diff changeset
4213
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4214 /* Name */
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
4215 if (gtkcontactnode && !gtkcontactnode->contact_expanded && contact->alias)
19375
96de09c01b53 Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@pidgin.im>
parents: 19361
diff changeset
4216 name = contact->alias;
96de09c01b53 Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@pidgin.im>
parents: 19361
diff changeset
4217 else
96de09c01b53 Double-click infopane to alias or change topic. Also, show alias instead of screenname in infopane
Sean Egan <seanegan@pidgin.im>
parents: 19361
diff changeset
4218 name = purple_buddy_get_alias(b);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4219
29919
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4220 /* Raise a contact pre-draw signal here. THe callback will return an
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4221 * escaped version of the name. */
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4222 nametext = purple_signal_emit_return_1(pidgin_blist_get_handle(), "drawing-buddy", b);
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4223
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4224 if(!nametext)
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
4225 nametext = g_markup_escape_text(name, strlen(name));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4226
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4227 presence = purple_buddy_get_presence(b);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4228
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4229 /* Name is all that is needed */
26542
9f63fd9b74fa Fix displaying of status messages in the conversation infopane.
Paul Aurich <darkrain42@pidgin.im>
parents: 26540
diff changeset
4230 if (!aliased || biglist) {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4231
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4232 /* Status Info */
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4233 prpl = purple_find_prpl(purple_account_get_protocol_id(b->account));
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4234
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4235 if (prpl != NULL)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4236 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4237
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4238 if (prpl_info && prpl_info->status_text && b->account->gc) {
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4239 char *tmp = prpl_info->status_text(b);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4240 const char *end;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4241
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4242 if(tmp && !g_utf8_validate(tmp, -1, &end)) {
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4243 char *new = g_strndup(tmp,
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4244 g_utf8_pointer_to_offset(tmp, end));
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4245 g_free(tmp);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4246 tmp = new;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4247 }
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4248 if(tmp) {
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4249 g_strdelimit(tmp, "\n", ' ');
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4250 purple_str_strip_char(tmp, '\r');
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4251 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4252 statustext = tmp;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4253 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4254
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4255 if(!purple_presence_is_online(presence) && !statustext)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4256 statustext = g_strdup(_("Offline"));
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4257
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4258 /* Idle Text */
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4259 if (purple_presence_is_idle(presence) && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4260 time_t idle_secs = purple_presence_get_idle_time(presence);
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4261
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4262 if (idle_secs > 0) {
18444
3bac793de1ba Show idle times in the buddy list as days, hours, seconds. Patch from
Ka-Hing Cheung <khc@pidgin.im>
parents: 18280
diff changeset
4263 int iday, ihrs, imin;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4264 time_t t;
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4265
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4266 time(&t);
18444
3bac793de1ba Show idle times in the buddy list as days, hours, seconds. Patch from
Ka-Hing Cheung <khc@pidgin.im>
parents: 18280
diff changeset
4267 iday = (t - idle_secs) / (24 * 60 * 60);
3bac793de1ba Show idle times in the buddy list as days, hours, seconds. Patch from
Ka-Hing Cheung <khc@pidgin.im>
parents: 18280
diff changeset
4268 ihrs = ((t - idle_secs) / 60 / 60) % 24;
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4269 imin = ((t - idle_secs) / 60) % 60;
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4270
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
4271 if (iday)
18444
3bac793de1ba Show idle times in the buddy list as days, hours, seconds. Patch from
Ka-Hing Cheung <khc@pidgin.im>
parents: 18280
diff changeset
4272 idletime = g_strdup_printf(_("Idle %dd %dh %02dm"), iday, ihrs, imin);
3bac793de1ba Show idle times in the buddy list as days, hours, seconds. Patch from
Ka-Hing Cheung <khc@pidgin.im>
parents: 18280
diff changeset
4273 else if (ihrs)
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4274 idletime = g_strdup_printf(_("Idle %dh %02dm"), ihrs, imin);
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4275 else
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4276 idletime = g_strdup_printf(_("Idle %dm"), imin);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4277
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
4278 } else
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4279 idletime = g_strdup(_("Idle"));
20879
157cd6ca3ab6 Fix a leak that occurs when getting the formatted buddy name under some conditions.
Daniel Atallah <datallah@pidgin.im>
parents: 20747
diff changeset
4280 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4281 }
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4282
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4283 /* choose the colors of the text */
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4284 theme = pidgin_blist_get_theme();
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4285 name_color = NULL;
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4286
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4287 if (theme) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4288 if (purple_presence_is_idle(presence)) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4289 namefont = statusfont = pidgin_blist_theme_get_idle_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4290 name_color = "dim grey";
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4291 } else if (!purple_presence_is_online(presence)) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4292 namefont = pidgin_blist_theme_get_offline_text_info(theme);
28344
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4293 name_color = "dim grey";
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4294 statusfont = pidgin_blist_theme_get_status_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4295 } else if (purple_presence_is_available(presence)) {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4296 namefont = pidgin_blist_theme_get_online_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4297 statusfont = pidgin_blist_theme_get_status_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4298 } else {
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4299 namefont = pidgin_blist_theme_get_away_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4300 statusfont = pidgin_blist_theme_get_status_text_info(theme);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4301 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4302 } else {
28344
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4303 if (!selected
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4304 && (purple_presence_is_idle(presence)
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4305 || !purple_presence_is_online(presence)))
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4306 {
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4307 name_color = "dim grey";
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
4308 }
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4309 }
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4310
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4311 name_color = theme_font_get_color_default(namefont, name_color);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4312 name_font = theme_font_get_face_default(namefont, "");
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4313
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4314 status_color = theme_font_get_color_default(statusfont, "dim grey");
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
4315 status_font = theme_font_get_face_default(statusfont, "");
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4316
23968
235620a98952 Fixes blist theme bug in buddy markup
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23967
diff changeset
4317 if (aliased && selected) {
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4318 if (theme) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4319 name_color = "black";
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4320 status_color = "black";
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4321 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4322 name_color = NULL;
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4323 status_color = NULL;
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4324 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4325 }
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4326
28756
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4327 if (hidden_conv) {
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4328 char *tmp = nametext;
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4329 nametext = g_strdup_printf("<b>%s</b>", tmp);
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4330 g_free(tmp);
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4331 }
3fb8b08f9902 pidgin: Bold usernames with unread messages in the buddy list again. Closes #10068.
Paul Aurich <darkrain42@pidgin.im>
parents: 28500
diff changeset
4332
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
4333 /* Put it all together */
26542
9f63fd9b74fa Fix displaying of status messages in the conversation infopane.
Paul Aurich <darkrain42@pidgin.im>
parents: 26540
diff changeset
4334 if ((!aliased || biglist) && (statustext || idletime)) {
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
4335 /* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4336 if (name_color) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4337 text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n"
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4338 "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4339 name_font, name_color, nametext, status_font, status_color,
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4340 idletime != NULL ? idletime : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4341 (idletime != NULL && statustext != NULL) ? " - " : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4342 statustext != NULL ? statustext : "");
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4343 } else if (status_color) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4344 text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4345 "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4346 name_font, nametext, status_font, status_color,
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4347 idletime != NULL ? idletime : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4348 (idletime != NULL && statustext != NULL) ? " - " : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4349 statustext != NULL ? statustext : "");
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4350 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4351 text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4352 "<small><span font_desc='%s'>%s%s%s</span></small>",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4353 name_font, nametext, status_font,
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4354 idletime != NULL ? idletime : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4355 (idletime != NULL && statustext != NULL) ? " - " : "",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4356 statustext != NULL ? statustext : "");
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4357 }
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4358 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4359 if (name_color) {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
4360 text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4361 name_font, name_color, nametext);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4362 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4363 text = g_strdup_printf("<span font_desc='%s'>%s</span>", name_font,
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4364 nametext);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4365 }
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
4366 }
23969
0c3fe3967b97 fixed some leaks and made theme loading safer
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23968
diff changeset
4367 g_free(nametext);
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
4368 g_free(statustext);
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
4369 g_free(idletime);
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4370
15559
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4371 if (hidden_conv) {
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4372 char *tmp = text;
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4373 text = g_strdup_printf("<b>%s</b>", tmp);
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4374 g_free(tmp);
58a8f57c6970 Restore 'hidden convo' status icon in blist. Additionally, make the name text bold when you have a hidden convo
Sean Egan <seanegan@pidgin.im>
parents: 15554
diff changeset
4375 }
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4376
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4377 return text;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4378 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4379
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
4380 static void pidgin_blist_restore_position(void)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4381 {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4382 int blist_x, blist_y, blist_width, blist_height;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4383
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4384 blist_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width");
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4385
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4386 /* if the window exists, is hidden, we're saving positions, and the
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4387 * position is sane... */
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4388 if (gtkblist && gtkblist->window &&
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4389 !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4390
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4391 blist_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4392 blist_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4393 blist_height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/height");
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4394
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4395 /* ...check position is on screen... */
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4396 if (blist_x >= gdk_screen_width())
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4397 blist_x = gdk_screen_width() - 100;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4398 else if (blist_x + blist_width < 0)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4399 blist_x = 100;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4400
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4401 if (blist_y >= gdk_screen_height())
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4402 blist_y = gdk_screen_height() - 100;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4403 else if (blist_y + blist_height < 0)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4404 blist_y = 100;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4405
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4406 /* ...and move it back. */
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4407 gtk_window_move(GTK_WINDOW(gtkblist->window), blist_x, blist_y);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4408 gtk_window_resize(GTK_WINDOW(gtkblist->window), blist_width, blist_height);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4409 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized"))
12279
9418540cb3bb [gaim-migrate @ 14583]
Casey Harkins <charkins@pidgin.im>
parents: 12246
diff changeset
4410 gtk_window_maximize(GTK_WINDOW(gtkblist->window));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4411 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4412 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4413
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4414 static gboolean pidgin_blist_refresh_timer(PurpleBuddyList *list)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4415 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4416 PurpleBlistNode *gnode, *cnode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4417
21113
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
4418 if (gtk_blist_visibility == GDK_VISIBILITY_FULLY_OBSCURED
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
4419 || !GTK_WIDGET_VISIBLE(gtkblist->window))
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
4420 return TRUE;
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
4421
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4422 for(gnode = list->root; gnode; gnode = gnode->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4423 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
4424 continue;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4425 for(cnode = gnode->child; cnode; cnode = cnode->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4426 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4427 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4428
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4429 buddy = purple_contact_get_priority_buddy((PurpleContact*)cnode);
10012
da9fdfbf4c5a [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
4430
da9fdfbf4c5a [gaim-migrate @ 10929]
Nathan Walp <nwalp@pidgin.im>
parents: 10006
diff changeset
4431 if (buddy &&
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4432 purple_presence_is_idle(purple_buddy_get_presence(buddy)))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4433 pidgin_blist_update_contact(list, (PurpleBlistNode*)buddy);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4434 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4435 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4436 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4437
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4438 /* keep on going */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4439 return TRUE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4440 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4441
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4442 static void pidgin_blist_hide_node(PurpleBuddyList *list, PurpleBlistNode *node, gboolean update)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4443 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4444 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
5260
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4445 GtkTreeIter iter;
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4446
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4447 if (!gtknode || !gtknode->row || !gtkblist)
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4448 return;
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4449
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4450 if(gtkblist->selected_node == node)
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4451 gtkblist->selected_node = NULL;
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4452 if (get_iter_from_node(node, &iter)) {
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4453 gtk_tree_store_remove(gtkblist->treemodel, &iter);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4454 if(update && (PURPLE_BLIST_NODE_IS_CONTACT(node) ||
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4455 PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CHAT(node))) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4456 pidgin_blist_update(list, node->parent);
5260
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4457 }
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4458 }
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4459 gtk_tree_row_reference_free(gtknode->row);
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4460 gtknode->row = NULL;
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4461 }
7c37cf580e7c [gaim-migrate @ 5632]
Ethan Blanton <elb@pidgin.im>
parents: 5256
diff changeset
4462
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4463 static const char *require_connection[] =
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4464 {
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4465 N_("/Buddies/New Instant Message..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4466 N_("/Buddies/Join a Chat..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4467 N_("/Buddies/Get User Info..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4468 N_("/Buddies/Add Buddy..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4469 N_("/Buddies/Add Chat..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4470 N_("/Buddies/Add Group..."),
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4471 };
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4472
10357
f5ad7a664200 [gaim-migrate @ 11575]
Mark Doliner <markdoliner@pidgin.im>
parents: 10354
diff changeset
4473 static const int require_connection_size = sizeof(require_connection)
f5ad7a664200 [gaim-migrate @ 11575]
Mark Doliner <markdoliner@pidgin.im>
parents: 10354
diff changeset
4474 / sizeof(*require_connection);
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4475
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4476 /**
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4477 * Rebuild dynamic menus and make menu items sensitive/insensitive
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4478 * where appropriate.
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4479 */
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4480 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4481 update_menu_bar(PidginBuddyList *gtkblist)
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4482 {
8937
b436e9cbd701 [gaim-migrate @ 9707]
Mark Doliner <markdoliner@pidgin.im>
parents: 8911
diff changeset
4483 GtkWidget *widget;
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4484 gboolean sensitive;
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4485 int i;
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4486
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4487 g_return_if_fail(gtkblist != NULL);
8259
7ed91862683d [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
4488
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4489 pidgin_blist_update_accounts_menu();
8937
b436e9cbd701 [gaim-migrate @ 9707]
Mark Doliner <markdoliner@pidgin.im>
parents: 8911
diff changeset
4490
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4491 sensitive = (purple_connections_get_all() != NULL);
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4492
10357
f5ad7a664200 [gaim-migrate @ 11575]
Mark Doliner <markdoliner@pidgin.im>
parents: 10354
diff changeset
4493 for (i = 0; i < require_connection_size; i++)
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4494 {
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4495 widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]);
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4496 gtk_widget_set_sensitive(widget, sensitive);
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4497 }
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4498
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
4499 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Join a Chat..."));
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4500 gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable());
8940
3e22cf150db0 [gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents: 8939
diff changeset
4501
11988
7ed733ed806b [gaim-migrate @ 14281]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11986
diff changeset
4502 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Add Chat..."));
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4503 gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable());
11988
7ed733ed806b [gaim-migrate @ 14281]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11986
diff changeset
4504
8938
d13ed7491e43 [gaim-migrate @ 9708]
Mark Doliner <markdoliner@pidgin.im>
parents: 8937
diff changeset
4505 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy"));
21440
458937dee9af Don't allow tooltips to interfere with editing blist entries. Fixes #3830.
Daniel Atallah <datallah@pidgin.im>
parents: 21113
diff changeset
4506 gtk_widget_set_sensitive(widget, sensitive);
12136
027b7ebee256 [gaim-migrate @ 14436]
Kevin Stange <kstange@pidgin.im>
parents: 12133
diff changeset
4507
027b7ebee256 [gaim-migrate @ 14436]
Kevin Stange <kstange@pidgin.im>
parents: 12133
diff changeset
4508 widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List"));
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4509 gtk_widget_set_sensitive(widget, pidgin_roomlist_is_showable());
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4510 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4511
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4512 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4513 sign_on_off_cb(PurpleConnection *gc, PurpleBuddyList *blist)
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4514 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4515 PidginBuddyList *gtkblist = PIDGIN_BLIST(blist);
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4516
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4517 update_menu_bar(gtkblist);
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
4518 }
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
4519
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
4520 static void
30427
10e743b47871 gpointer* is redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30364
diff changeset
4521 plugin_changed_cb(PurplePlugin *p, gpointer data)
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
4522 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4523 pidgin_blist_update_plugin_actions();
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
4524 }
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
4525
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4526 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 22087
diff changeset
4527 unseen_conv_menu(void)
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4528 {
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4529 static GtkWidget *menu = NULL;
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4530 GList *convs = NULL;
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4531 GList *chats, *ims;
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4532
15110
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4533 if (menu) {
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4534 gtk_widget_destroy(menu);
15110
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4535 menu = NULL;
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4536 }
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4537
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4538 ims = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4539 PIDGIN_UNSEEN_TEXT, FALSE, 0);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4540
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4541 chats = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4542 PIDGIN_UNSEEN_NICK, FALSE, 0);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4543
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4544 if(ims && chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4545 convs = g_list_concat(ims, chats);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4546 else if(ims && !chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4547 convs = ims;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4548 else if(!ims && chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4549 convs = chats;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4550
15110
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4551 if (!convs)
12175
3e790a58d906 [gaim-migrate @ 14477]
Casey Harkins <charkins@pidgin.im>
parents: 12163
diff changeset
4552 /* no conversations added, don't show the menu */
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4553 return;
15110
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4554
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4555 menu = gtk_menu_new();
2e4ae8a8dcec [gaim-migrate @ 17832]
Daniel Atallah <datallah@pidgin.im>
parents: 15096
diff changeset
4556
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4557 pidgin_conversations_fill_menu(menu, convs);
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4558 g_list_free(convs);
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4559 gtk_widget_show_all(menu);
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4560 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3,
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4561 gtk_get_current_event_time());
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4562 }
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4563
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4564 static gboolean
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4565 menutray_press_cb(GtkWidget *widget, GdkEventButton *event)
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4566 {
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4567 GList *convs;
12208
63faaf557886 [gaim-migrate @ 14510]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12191
diff changeset
4568
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4569 switch (event->button) {
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4570 case 1:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4571 convs = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4572 PIDGIN_UNSEEN_TEXT, FALSE, 1);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4573
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4574 if(!convs)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4575 convs = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4576 PIDGIN_UNSEEN_NICK, FALSE, 1);
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4577 if (convs) {
21012
f03dae654cec Make clicking on the menutray in the buddy list present the first pending
Casey Harkins <charkins@pidgin.im>
parents: 20954
diff changeset
4578 pidgin_conv_present_conversation((PurpleConversation*)convs->data);
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4579 g_list_free(convs);
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4580 }
12133
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4581 break;
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4582 case 3:
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4583 unseen_conv_menu();
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4584 break;
c627533bb7a4 [gaim-migrate @ 14433]
Casey Harkins <charkins@pidgin.im>
parents: 12124
diff changeset
4585 }
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4586 return TRUE;
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4587 }
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4588
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
4589 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4590 conversation_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4591 PidginBuddyList *gtkblist)
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4592 {
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4593 GList *convs = NULL;
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4594 GList *ims, *chats;
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4595 GList *l = NULL;
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4596
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4597 if (type != PURPLE_CONV_UPDATE_UNSEEN)
12175
3e790a58d906 [gaim-migrate @ 14477]
Casey Harkins <charkins@pidgin.im>
parents: 12163
diff changeset
4598 return;
3e790a58d906 [gaim-migrate @ 14477]
Casey Harkins <charkins@pidgin.im>
parents: 12163
diff changeset
4599
12744
45d72d69f399 [gaim-migrate @ 15091]
Casey Harkins <charkins@pidgin.im>
parents: 12713
diff changeset
4600 if(conv->account != NULL && conv->name != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4601 PurpleBuddy *buddy = purple_find_buddy(conv->account, conv->name);
12744
45d72d69f399 [gaim-migrate @ 15091]
Casey Harkins <charkins@pidgin.im>
parents: 12713
diff changeset
4602 if(buddy != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4603 pidgin_blist_update_buddy(NULL, (PurpleBlistNode *)buddy, TRUE);
12744
45d72d69f399 [gaim-migrate @ 15091]
Casey Harkins <charkins@pidgin.im>
parents: 12713
diff changeset
4604 }
45d72d69f399 [gaim-migrate @ 15091]
Casey Harkins <charkins@pidgin.im>
parents: 12713
diff changeset
4605
12175
3e790a58d906 [gaim-migrate @ 14477]
Casey Harkins <charkins@pidgin.im>
parents: 12163
diff changeset
4606 if (gtkblist->menutrayicon) {
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4607 gtk_widget_destroy(gtkblist->menutrayicon);
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4608 gtkblist->menutrayicon = NULL;
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4609 }
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4610
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4611 ims = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4612 PIDGIN_UNSEEN_TEXT, FALSE, 0);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4613
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4614 chats = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4615 PIDGIN_UNSEEN_NICK, FALSE, 0);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4616
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4617 if(ims && chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4618 convs = g_list_concat(ims, chats);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4619 else if(ims && !chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4620 convs = ims;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4621 else if(!ims && chats)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4622 convs = chats;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4623
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4624 if (convs) {
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4625 GtkWidget *img = NULL;
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4626 GString *tooltip_text = NULL;
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4627
12117
b3781ac3f1da [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
4628 tooltip_text = g_string_new("");
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4629 l = convs;
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4630 while (l != NULL) {
21036
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4631 int count = 0;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4632 PidginConversation *gtkconv = PIDGIN_CONVERSATION((PurpleConversation *)l->data);
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4633
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4634 if(gtkconv)
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4635 count = gtkconv->unseen_count;
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4636 else if(purple_conversation_get_data(l->data, "unseen-count"))
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4637 count = GPOINTER_TO_INT(purple_conversation_get_data(l->data, "unseen-count"));
1c196194f91f Make the docklet and buddy list menutray agree on unread messages. Both
Casey Harkins <charkins@pidgin.im>
parents: 21012
diff changeset
4638
19810
b065c65f6a63 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19804
diff changeset
4639 g_string_append_printf(tooltip_text,
b065c65f6a63 Make changes in the buddylist menutray icon for hidden conversations to work
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19804
diff changeset
4640 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", count),
21056
356b2a5f4d21 Use the conversation title for unread message tooltips. Fixes #3557.
Casey Harkins <charkins@pidgin.im>
parents: 21036
diff changeset
4641 count, purple_conversation_get_title(l->data));
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4642 l = l->next;
12117
b3781ac3f1da [gaim-migrate @ 14417]
Nathan Walp <nwalp@pidgin.im>
parents: 12116
diff changeset
4643 }
12239
e4f62729e2c7 [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
4644 if(tooltip_text->len > 0) {
12302
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4645 /* get rid of the last newline */
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
4646 g_string_truncate(tooltip_text, tooltip_text->len -1);
15692
ecda27df58b9 Some more pidgininfication
Daniel Atallah <datallah@pidgin.im>
parents: 15670
diff changeset
4647 img = gtk_image_new_from_stock(PIDGIN_STOCK_TOOLBAR_PENDING,
15623
bf485c598199 toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@pidgin.im>
parents: 15622
diff changeset
4648 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
12302
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4649
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4650 gtkblist->menutrayicon = gtk_event_box_new();
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4651 gtk_container_add(GTK_CONTAINER(gtkblist->menutrayicon), img);
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4652 gtk_widget_show(img);
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4653 gtk_widget_show(gtkblist->menutrayicon);
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4654 g_signal_connect(G_OBJECT(gtkblist->menutrayicon), "button-press-event", G_CALLBACK(menutray_press_cb), NULL);
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4655
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4656 pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkblist->menutray), gtkblist->menutrayicon, tooltip_text->str);
12239
e4f62729e2c7 [gaim-migrate @ 14541]
Nathan Walp <nwalp@pidgin.im>
parents: 12232
diff changeset
4657 }
12302
191d0fc44cfc [gaim-migrate @ 14606]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12301
diff changeset
4658 g_string_free(tooltip_text, TRUE);
12468
fe558afb01b4 [gaim-migrate @ 14778]
Casey Harkins <charkins@pidgin.im>
parents: 12466
diff changeset
4659 g_list_free(convs);
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4660 }
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4661 }
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
4662
12208
63faaf557886 [gaim-migrate @ 14510]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12191
diff changeset
4663 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4664 conversation_deleting_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4665 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4666 conversation_updated_cb(conv, PURPLE_CONV_UPDATE_UNSEEN, gtkblist);
12208
63faaf557886 [gaim-migrate @ 14510]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12191
diff changeset
4667 }
63faaf557886 [gaim-migrate @ 14510]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12191
diff changeset
4668
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4669 static void
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4670 conversation_deleted_update_ui_cb(PurpleConversation *conv, struct _pidgin_blist_node *ui)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4671 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4672 if (ui->conv.conv != conv)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4673 return;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4674 ui->conv.conv = NULL;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4675 ui->conv.flags = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4676 ui->conv.last_message = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4677 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4678
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4679 static void
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4680 written_msg_update_ui_cb(PurpleAccount *account, const char *who, const char *message,
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4681 PurpleConversation *conv, PurpleMessageFlags flag, PurpleBlistNode *node)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4682 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4683 PidginBlistNode *ui = node->ui_data;
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4684 if (ui->conv.conv != conv || !pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv)) ||
20312
f1b5a671b0d5 Do not boldify the chat in the buddylist for unread system messages.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20311
diff changeset
4685 !(flag & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)))
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4686 return;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4687 ui->conv.flags |= PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4688 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4689 && (flag & PURPLE_MESSAGE_NICK))
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4690 ui->conv.flags |= PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK;
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4691
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4692 ui->conv.last_message = time(NULL); /* XXX: for lack of better data */
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4693 pidgin_blist_update(purple_get_blist(), node);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4694 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4695
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4696 static void
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4697 displayed_msg_update_ui_cb(PidginConversation *gtkconv, PurpleBlistNode *node)
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4698 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4699 PidginBlistNode *ui = node->ui_data;
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4700 if (ui->conv.conv != gtkconv->active_conv)
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4701 return;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4702 ui->conv.flags &= ~(PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE |
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
4703 PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK);
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4704 pidgin_blist_update(purple_get_blist(), node);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4705 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4706
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4707 static void
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4708 conversation_created_cb(PurpleConversation *conv, PidginBuddyList *gtkblist)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4709 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4710 switch (conv->type) {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4711 case PURPLE_CONV_TYPE_IM:
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4712 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4713 GSList *buddies = purple_find_buddies(conv->account, conv->name);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4714 while (buddies) {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4715 PurpleBlistNode *buddy = buddies->data;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4716 struct _pidgin_blist_node *ui = buddy->ui_data;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4717 buddies = g_slist_delete_link(buddies, buddies);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4718 if (!ui)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4719 continue;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4720 ui->conv.conv = conv;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4721 ui->conv.flags = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4722 ui->conv.last_message = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4723 purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation",
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4724 ui, PURPLE_CALLBACK(conversation_deleted_update_ui_cb), ui);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4725 purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg",
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4726 ui, PURPLE_CALLBACK(written_msg_update_ui_cb), buddy);
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4727 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed",
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4728 ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), buddy);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4729 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4730 }
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4731 break;
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4732 case PURPLE_CONV_TYPE_CHAT:
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4733 {
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4734 PurpleChat *chat = purple_blist_find_chat(conv->account, conv->name);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4735 struct _pidgin_blist_node *ui;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4736 if (!chat)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4737 break;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4738 ui = chat->node.ui_data;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4739 if (!ui)
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4740 break;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4741 ui->conv.conv = conv;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4742 ui->conv.flags = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4743 ui->conv.last_message = 0;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4744 purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation",
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4745 ui, PURPLE_CALLBACK(conversation_deleted_update_ui_cb), ui);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4746 purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg",
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4747 ui, PURPLE_CALLBACK(written_msg_update_ui_cb), chat);
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4748 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed",
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4749 ui, PURPLE_CALLBACK(displayed_msg_update_ui_cb), chat);
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4750 }
21891
43b8ee31fb10 Fix boldifying the chat entries in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21889
diff changeset
4751 break;
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4752 default:
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4753 break;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4754 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4755 }
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
4756
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4757 /**********************************************************************************
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4758 * Public API Functions *
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4759 **********************************************************************************/
9774
220712654b8e [gaim-migrate @ 10642]
Gary Kramlich <grim@pidgin.im>
parents: 9773
diff changeset
4760
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4761 static void pidgin_blist_new_list(PurpleBuddyList *blist)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4762 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4763 PidginBuddyList *gtkblist;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4764
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4765 gtkblist = g_new0(PidginBuddyList, 1);
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4766 gtkblist->connection_errors = g_hash_table_new_full(g_direct_hash,
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4767 g_direct_equal, NULL, g_free);
22235
16d50b31a47b Plug a small leak.
Daniel Atallah <datallah@pidgin.im>
parents: 22214
diff changeset
4768 gtkblist->priv = g_new0(PidginBuddyListPrivate, 1);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4769
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4770 blist->ui_data = gtkblist;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4771 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4772
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4773 static void pidgin_blist_new_node(PurpleBlistNode *node)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4774 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4775 node->ui_data = g_new0(struct _pidgin_blist_node, 1);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4776 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4777
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4778 gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4779 {
17710
9a0fbabde044 Fix pidgin_blist_node_is_contact_expanded() to not crash on buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17658
diff changeset
4780 if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
11018
a3843543f132 [gaim-migrate @ 12888]
Richard Laager <rlaager@pidgin.im>
parents: 11016
diff changeset
4781 node = node->parent;
17710
9a0fbabde044 Fix pidgin_blist_node_is_contact_expanded() to not crash on buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17658
diff changeset
4782 if (node == NULL)
9a0fbabde044 Fix pidgin_blist_node_is_contact_expanded() to not crash on buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17658
diff changeset
4783 return FALSE;
9a0fbabde044 Fix pidgin_blist_node_is_contact_expanded() to not crash on buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17658
diff changeset
4784 }
11018
a3843543f132 [gaim-migrate @ 12888]
Richard Laager <rlaager@pidgin.im>
parents: 11016
diff changeset
4785
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4786 g_return_val_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(node), FALSE);
11018
a3843543f132 [gaim-migrate @ 12888]
Richard Laager <rlaager@pidgin.im>
parents: 11016
diff changeset
4787
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4788 return ((struct _pidgin_blist_node *)node->ui_data)->contact_expanded;
11018
a3843543f132 [gaim-migrate @ 12888]
Richard Laager <rlaager@pidgin.im>
parents: 11016
diff changeset
4789 }
a3843543f132 [gaim-migrate @ 12888]
Richard Laager <rlaager@pidgin.im>
parents: 11016
diff changeset
4790
10433
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4791 enum {
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4792 DRAG_BUDDY,
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4793 DRAG_ROW,
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4794 DRAG_VCARD,
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4795 DRAG_TEXT,
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4796 DRAG_URI,
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4797 NUM_TARGETS
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4798 };
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4799
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
4800 static const char *
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4801 item_factory_translate_func (const char *path, gpointer func_data)
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4802 {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4803 return _((char *)path);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4804 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4805
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4806 void pidgin_blist_setup_sort_methods()
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4807 {
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4808 const char *id;
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4809
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4810 pidgin_blist_sort_method_reg("none", _("Manually"), sort_method_none);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4811 pidgin_blist_sort_method_reg("alphabetical", _("Alphabetically"), sort_method_alphabetical);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4812 pidgin_blist_sort_method_reg("status", _("By status"), sort_method_status);
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
4813 pidgin_blist_sort_method_reg("log_size", _("By recent log activity"), sort_method_log_activity);
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4814
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4815 id = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type");
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4816 if (id == NULL) {
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4817 purple_debug_warning("gtkblist", "Sort method was NULL, resetting to alphabetical\n");
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4818 id = "alphabetical";
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4819 }
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
4820 pidgin_blist_sort_method_set(id);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4821 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4822
22108
cb9819851163 Squash some compiler warnings, some from my -Wstrict-prototypes fixing.
Richard Laager <rlaager@pidgin.im>
parents: 22104
diff changeset
4823 static void _prefs_change_redo_list(const char *name, PurplePrefType type,
cb9819851163 Squash some compiler warnings, some from my -Wstrict-prototypes fixing.
Richard Laager <rlaager@pidgin.im>
parents: 22104
diff changeset
4824 gconstpointer val, gpointer data)
10433
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4825 {
13511
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4826 GtkTreeSelection *sel;
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4827 GtkTreeIter iter;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4828 PurpleBlistNode *node = NULL;
13511
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4829
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4830 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4831 if (gtk_tree_selection_get_selected(sel, NULL, &iter))
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4832 {
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4833 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1);
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4834 }
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4835
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4836 redo_buddy_list(purple_get_blist(), FALSE, FALSE);
13162
43420c10065b [gaim-migrate @ 15524]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13147
diff changeset
4837 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview));
13511
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4838
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4839 if (node)
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4840 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4841 struct _pidgin_blist_node *gtknode;
13511
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4842 GtkTreePath *path;
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4843
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4844 gtknode = node->ui_data;
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4845 if (gtknode && gtknode->row)
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4846 {
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4847 path = gtk_tree_row_reference_get_path(gtknode->row);
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4848 gtk_tree_selection_select_path(sel, path);
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4849 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0);
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4850 gtk_tree_path_free(path);
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4851 }
743387e8099e [gaim-migrate @ 15886]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13510
diff changeset
4852 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4853 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
4854
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4855 static void _prefs_change_sort_method(const char *pref_name, PurplePrefType type,
12816
5f93e09fa9a6 [gaim-migrate @ 15164]
Mark Doliner <markdoliner@pidgin.im>
parents: 12799
diff changeset
4856 gconstpointer val, gpointer data)
10433
04cf48e72655 [gaim-migrate @ 11689]
Mark Doliner <markdoliner@pidgin.im>
parents: 10418
diff changeset
4857 {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
4858 if(!strcmp(pref_name, PIDGIN_PREFS_ROOT "/blist/sort_type"))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4859 pidgin_blist_sort_method_set(val);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4860 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4861
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4862 static gboolean pidgin_blist_select_notebook_page_cb(gpointer user_data)
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4863 {
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4864 PidginBuddyList *gtkblist = (PidginBuddyList *)user_data;
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4865 int errors = 0;
21763
95ce28fc860a Patch from DB42 to add a little 'Ɨ' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21704
diff changeset
4866 GList *list = NULL;
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4867 PidginBuddyListPrivate *priv;
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4868
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4869 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4870
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4871 /* this is far too ugly thanks to me not wanting to fix #3989 properly right now */
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4872 if (priv->error_scrollbook != NULL) {
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4873 errors = gtk_notebook_get_n_pages(GTK_NOTEBOOK(priv->error_scrollbook->notebook));
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4874 }
21763
95ce28fc860a Patch from DB42 to add a little 'Ɨ' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21704
diff changeset
4875 if ((list = purple_accounts_get_all_active()) != NULL || errors) {
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
4876 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 1);
15088
d5bb04caf6e1 [gaim-migrate @ 17809]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15086
diff changeset
4877 g_list_free(list);
d5bb04caf6e1 [gaim-migrate @ 17809]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15086
diff changeset
4878 } else
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
4879 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
4880
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4881 return FALSE;
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4882 }
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4883
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4884 static void pidgin_blist_select_notebook_page(PidginBuddyList *gtkblist)
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4885 {
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4886 purple_timeout_add(0, pidgin_blist_select_notebook_page_cb, gtkblist);
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4887 }
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4888
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4889 static void account_modified(PurpleAccount *account, PidginBuddyList *gtkblist)
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4890 {
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4891 if (!gtkblist)
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4892 return;
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4893
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4894 pidgin_blist_select_notebook_page(gtkblist);
12522
5d2871278151 [gaim-migrate @ 14834]
Richard Laager <rlaager@pidgin.im>
parents: 12519
diff changeset
4895 update_menu_bar(gtkblist);
5d2871278151 [gaim-migrate @ 14834]
Richard Laager <rlaager@pidgin.im>
parents: 12519
diff changeset
4896 }
5d2871278151 [gaim-migrate @ 14834]
Richard Laager <rlaager@pidgin.im>
parents: 12519
diff changeset
4897
12766
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4898 static void
26871
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4899 account_actions_changed(PurpleAccount *account, gpointer data)
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4900 {
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4901 pidgin_blist_update_accounts_menu();
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4902 }
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4903
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
4904 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4905 account_status_changed(PurpleAccount *account, PurpleStatus *old,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
4906 PurpleStatus *new, PidginBuddyList *gtkblist)
12766
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4907 {
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4908 if (!gtkblist)
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4909 return;
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4910
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
4911 account_modified(account, gtkblist);
12766
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4912 }
b292b7a49197 [gaim-migrate @ 15113]
Nick Hebner <hebnern@gmail.com>
parents: 12744
diff changeset
4913
12124
97ff43883157 [gaim-migrate @ 14424]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12119
diff changeset
4914 static gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4915 gtk_blist_window_key_press_cb(GtkWidget *w, GdkEventKey *event, PidginBuddyList *gtkblist)
12461
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4916 {
17844
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4917 GtkWidget *widget;
12461
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4918
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4919 if (!gtkblist)
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4920 return FALSE;
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4921
25606
6096de8d7120 Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 25584
diff changeset
4922 /* clear any tooltips */
6096de8d7120 Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 25584
diff changeset
4923 pidgin_blist_tooltip_destroy();
6096de8d7120 Close the tooltip window on a keypress event. Fixes #8150.
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 25584
diff changeset
4924
17844
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4925 widget = gtk_window_get_focus(GTK_WINDOW(gtkblist->window));
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4926
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4927 if (GTK_IS_IMHTML(widget) || GTK_IS_ENTRY(widget)) {
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4928 if (gtk_bindings_activate(GTK_OBJECT(widget), event->keyval, event->state))
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4929 return TRUE;
77ca8872df94 Fix #1284. "Pressing Ctrl+C while editing a buddy list alias shouldn't "Join a chat""
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 17360
diff changeset
4930 }
12461
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4931 return FALSE;
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4932 }
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
4933
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4934 static gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4935 headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist)
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4936 {
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4937 gdk_window_set_cursor(widget->window, gtkblist->hand_cursor);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4938 return FALSE;
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4939 }
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4940
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4941 static gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4942 headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist)
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4943 {
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4944 gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4945 return FALSE;
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4946 }
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4947
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4948 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4949 reset_headline(PidginBuddyList *gtkblist)
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4950 {
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4951 gtkblist->headline_callback = NULL;
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4952 gtkblist->headline_data = NULL;
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4953 gtkblist->headline_destroy = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4954 pidgin_set_urgent(GTK_WINDOW(gtkblist->window), FALSE);
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4955 }
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4956
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4957 static gboolean
22822
e82a3ebf132b Fix a null pointer deref (hopefully). I haven't been able to consistently
Daniel Atallah <datallah@pidgin.im>
parents: 22806
diff changeset
4958 headline_click_callback(gpointer unused)
e82a3ebf132b Fix a null pointer deref (hopefully). I haven't been able to consistently
Daniel Atallah <datallah@pidgin.im>
parents: 22806
diff changeset
4959 {
e82a3ebf132b Fix a null pointer deref (hopefully). I haven't been able to consistently
Daniel Atallah <datallah@pidgin.im>
parents: 22806
diff changeset
4960 if (gtkblist->headline_callback)
e82a3ebf132b Fix a null pointer deref (hopefully). I haven't been able to consistently
Daniel Atallah <datallah@pidgin.im>
parents: 22806
diff changeset
4961 ((GSourceFunc) gtkblist->headline_callback)(gtkblist->headline_data);
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4962 reset_headline(gtkblist);
15259
5d4dc3a3019f [gaim-migrate @ 17987]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15246
diff changeset
4963 return FALSE;
5d4dc3a3019f [gaim-migrate @ 17987]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15246
diff changeset
4964 }
5d4dc3a3019f [gaim-migrate @ 17987]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15246
diff changeset
4965
5d4dc3a3019f [gaim-migrate @ 17987]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15246
diff changeset
4966 static gboolean
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4967 headline_close_press_cb(GtkButton *button, PidginBuddyList *gtkblist)
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4968 {
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4969 gtk_widget_hide(gtkblist->headline_hbox);
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4970 return FALSE;
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4971 }
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4972
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4973 static gboolean
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
4974 headline_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginBuddyList *gtkblist)
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4975 {
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4976 gtk_widget_hide(gtkblist->headline_hbox);
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
4977 if (gtkblist->headline_callback)
22822
e82a3ebf132b Fix a null pointer deref (hopefully). I haven't been able to consistently
Daniel Atallah <datallah@pidgin.im>
parents: 22806
diff changeset
4978 g_idle_add(headline_click_callback, NULL);
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4979 else {
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4980 if (gtkblist->headline_destroy)
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4981 gtkblist->headline_destroy(gtkblist->headline_data);
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4982 reset_headline(gtkblist);
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
4983 }
15259
5d4dc3a3019f [gaim-migrate @ 17987]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15246
diff changeset
4984 return TRUE;
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4985 }
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
4986
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4987 /***********************************/
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4988 /* Connection error handling stuff */
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4989 /***********************************/
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
4990
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4991 #define OBJECT_DATA_KEY_ACCOUNT "account"
22427
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
4992 #define DO_NOT_CLEAR_ERROR "do-not-clear-error"
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4993
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4994 static gboolean
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4995 find_account_widget(GObject *widget,
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4996 PurpleAccount *account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4997 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4998 if (g_object_get_data(widget, OBJECT_DATA_KEY_ACCOUNT) == account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
4999 return 0; /* found */
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5000 else
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5001 return 1;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5002 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5003
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5004 static void
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5005 pack_prpl_icon_start(GtkWidget *box,
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5006 PurpleAccount *account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5007 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5008 GdkPixbuf *pixbuf;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5009 GtkWidget *image;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5010
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5011 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5012 if (pixbuf != NULL) {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5013 image = gtk_image_new_from_pixbuf(pixbuf);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5014 g_object_unref(pixbuf);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5015
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5016 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5017 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5018 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5019
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5020 static void
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5021 add_error_dialog(PidginBuddyList *gtkblist,
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5022 GtkWidget *dialog)
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5023 {
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5024 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5025 gtk_container_add(GTK_CONTAINER(priv->error_scrollbook), dialog);
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5026 }
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5027
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5028 static GtkWidget *
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5029 find_child_widget_by_account(GtkContainer *container,
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5030 PurpleAccount *account)
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5031 {
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5032 GList *l = NULL;
21703
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5033 GList *children = NULL;
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5034 GtkWidget *ret = NULL;
21703
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5035 /* XXX: Workaround for the currently incomplete implementation of PidginScrollBook */
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5036 if (PIDGIN_IS_SCROLL_BOOK(container))
21704
e87adfc3233f Squish a compile warning
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21703
diff changeset
5037 container = GTK_CONTAINER(PIDGIN_SCROLL_BOOK(container)->notebook);
21703
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5038 children = gtk_container_get_children(container);
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5039 l = g_list_find_custom(children, account, (GCompareFunc) find_account_widget);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5040 if (l)
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5041 ret = GTK_WIDGET(l->data);
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5042 g_list_free(children);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5043 return ret;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5044 }
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5045
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5046 static void
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5047 remove_child_widget_by_account(GtkContainer *container,
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5048 PurpleAccount *account)
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5049 {
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5050 GtkWidget *widget = find_child_widget_by_account(container, account);
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5051 if(widget) {
22427
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5052 /* Since we are destroying the widget in response to a change in
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5053 * error, we should not clear the error.
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5054 */
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5055 g_object_set_data(G_OBJECT(widget), DO_NOT_CLEAR_ERROR,
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5056 GINT_TO_POINTER(TRUE));
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5057 gtk_widget_destroy(widget);
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5058 }
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5059 }
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5060
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5061 /* Generic error buttons */
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5062
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5063 static void
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5064 generic_error_modify_cb(PurpleAccount *account)
13316
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5065 {
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5066 purple_account_clear_current_error(account);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5067 pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, account);
13316
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5068 }
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5069
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5070 static void
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5071 generic_error_enable_cb(PurpleAccount *account)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5072 {
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5073 purple_account_clear_current_error(account);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5074 purple_account_set_enabled(account, purple_core_get_ui(), TRUE);
13316
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5075 }
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5076
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5077 static void
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5078 generic_error_destroy_cb(GtkObject *dialog,
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5079 PurpleAccount *account)
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5080 {
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5081 g_hash_table_remove(gtkblist->connection_errors, account);
22427
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5082 /* If the error dialog is being destroyed in response to the
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5083 * account-error-changed signal, we don't want to clear the current
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5084 * error.
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5085 */
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5086 if (g_object_get_data(G_OBJECT(dialog), DO_NOT_CLEAR_ERROR) == NULL)
2cd89959da02 Don't clear account errors during account-error-changed emission. I can't
Will Thompson <resiak@pidgin.im>
parents: 22240
diff changeset
5087 purple_account_clear_current_error(account);
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5088 }
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5089
21517
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5090 #define SSL_FAQ_URI "http://d.pidgin.im/wiki/FAQssl"
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5091
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5092 static void
26087
168b66075e08 I have no idea how we've gone nearly 16 months with no one noticing that the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26059
diff changeset
5093 ssl_faq_clicked_cb(PidginMiniDialog *mini_dialog,
168b66075e08 I have no idea how we've gone nearly 16 months with no one noticing that the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26059
diff changeset
5094 GtkButton *button,
168b66075e08 I have no idea how we've gone nearly 16 months with no one noticing that the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26059
diff changeset
5095 gpointer ignored)
21517
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5096 {
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5097 purple_notify_uri(NULL, SSL_FAQ_URI);
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5098 }
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5099
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5100 static void
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5101 add_generic_error_dialog(PurpleAccount *account,
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5102 const PurpleConnectionErrorInfo *err)
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5103 {
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5104 GtkWidget *mini_dialog;
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5105 const char *username = purple_account_get_username(account);
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5106 gboolean enabled =
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5107 purple_account_get_enabled(account, purple_core_get_ui());
21334
6eba68488cb4 Say that an account has been disabled if it has been in the title of a generic
Will Thompson <resiak@pidgin.im>
parents: 21332
diff changeset
5108 char *primary;
21763
95ce28fc860a Patch from DB42 to add a little 'Ɨ' in a scrollbook. I edited the patch in
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21704
diff changeset
5109
21334
6eba68488cb4 Say that an account has been disabled if it has been in the title of a generic
Will Thompson <resiak@pidgin.im>
parents: 21332
diff changeset
5110 if (enabled)
6eba68488cb4 Say that an account has been disabled if it has been in the title of a generic
Will Thompson <resiak@pidgin.im>
parents: 21332
diff changeset
5111 primary = g_strdup_printf(_("%s disconnected"), username);
6eba68488cb4 Say that an account has been disabled if it has been in the title of a generic
Will Thompson <resiak@pidgin.im>
parents: 21332
diff changeset
5112 else
6eba68488cb4 Say that an account has been disabled if it has been in the title of a generic
Will Thompson <resiak@pidgin.im>
parents: 21332
diff changeset
5113 primary = g_strdup_printf(_("%s disabled"), username);
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5114
21514
123f7b8b4aea Use the error icon rather than the disconnect icon in connection error
Will Thompson <resiak@pidgin.im>
parents: 21505
diff changeset
5115 mini_dialog = pidgin_make_mini_dialog(NULL, PIDGIN_STOCK_DIALOG_ERROR,
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5116 primary, err->description, account,
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5117 (enabled ? _("Reconnect") : _("Re-enable")),
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5118 (enabled ? PURPLE_CALLBACK(purple_account_connect)
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5119 : PURPLE_CALLBACK(generic_error_enable_cb)),
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5120 _("Modify Account"), PURPLE_CALLBACK(generic_error_modify_cb),
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5121 NULL);
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5122
13630
b41b3225c2ce [gaim-migrate @ 16016]
Daniel Atallah <datallah@pidgin.im>
parents: 13613
diff changeset
5123 g_free(primary);
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5124
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5125 g_object_set_data(G_OBJECT(mini_dialog), OBJECT_DATA_KEY_ACCOUNT,
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5126 account);
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5127
26087
168b66075e08 I have no idea how we've gone nearly 16 months with no one noticing that the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26059
diff changeset
5128 if(err->type == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT)
31642
ad20028f085c Finally merged the code that fixes #5038 to i.p.p.
Ivan Komarov <ivan.komarov@pidgin.im>
parents: 31600
diff changeset
5129 pidgin_mini_dialog_add_non_closing_button(PIDGIN_MINI_DIALOG(mini_dialog),
26087
168b66075e08 I have no idea how we've gone nearly 16 months with no one noticing that the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26059
diff changeset
5130 _("SSL FAQs"), ssl_faq_clicked_cb, NULL);
21517
bc6bde362440 Add a clickable link to the SSL FAQ to errors about accounts which need SSL
Will Thompson <resiak@pidgin.im>
parents: 21514
diff changeset
5131
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5132 g_signal_connect_after(mini_dialog, "destroy",
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5133 (GCallback)generic_error_destroy_cb,
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5134 account);
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5135
21332
bbf010fd6cc7 Hide the description label of the PidginMiniDialog used for signed on elsewhere
Will Thompson <resiak@pidgin.im>
parents: 21331
diff changeset
5136 add_error_dialog(gtkblist, mini_dialog);
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5137 }
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5138
21294
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5139 static void
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5140 remove_generic_error_dialog(PurpleAccount *account)
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5141 {
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5142 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
5143 remove_child_widget_by_account(
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5144 GTK_CONTAINER(priv->error_scrollbook), account);
21305
31497b8518f9 Break creating and removing generic error boxes by account into their own
Will Thompson <resiak@pidgin.im>
parents: 21303
diff changeset
5145 }
31497b8518f9 Break creating and removing generic error boxes by account into their own
Will Thompson <resiak@pidgin.im>
parents: 21303
diff changeset
5146
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5147
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5148 static void
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5149 update_generic_error_message(PurpleAccount *account,
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5150 const char *description)
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5151 {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5152 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5153 GtkWidget *mini_dialog = find_child_widget_by_account(
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5154 GTK_CONTAINER(priv->error_scrollbook), account);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5155 pidgin_mini_dialog_set_description(PIDGIN_MINI_DIALOG(mini_dialog),
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5156 description);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5157 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5158
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5159
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5160 /* Notifications about accounts which were disconnected with
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5161 * PURPLE_CONNECTION_ERROR_NAME_IN_USE
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5162 */
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5163
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5164 typedef void (*AccountFunction)(PurpleAccount *);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5165
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5166 static void
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5167 elsewhere_foreach_account(PidginMiniDialog *mini_dialog,
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5168 AccountFunction f)
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5169 {
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5170 PurpleAccount *account;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5171 GList *labels = gtk_container_get_children(
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5172 GTK_CONTAINER(mini_dialog->contents));
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5173 GList *l;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5174
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5175 for (l = labels; l; l = l->next) {
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5176 account = g_object_get_data(G_OBJECT(l->data), OBJECT_DATA_KEY_ACCOUNT);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5177 if (account)
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5178 f(account);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5179 else
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5180 purple_debug_warning("gtkblist", "mini_dialog's child "
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5181 "didn't have an account stored in it!");
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5182 }
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5183 g_list_free(labels);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5184 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5185
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5186 static void
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5187 enable_account(PurpleAccount *account)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5188 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5189 purple_account_set_enabled(account, purple_core_get_ui(), TRUE);
13316
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5190 }
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5191
f3825018dc2b [gaim-migrate @ 15681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13294
diff changeset
5192 static void
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5193 reconnect_elsewhere_accounts(PidginMiniDialog *mini_dialog,
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5194 GtkButton *button,
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5195 gpointer unused)
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5196 {
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5197 elsewhere_foreach_account(mini_dialog, enable_account);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5198 }
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5199
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5200 static void
21960
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5201 clear_elsewhere_errors(PidginMiniDialog *mini_dialog,
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5202 gpointer unused)
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5203 {
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5204 elsewhere_foreach_account(mini_dialog, purple_account_clear_current_error);
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5205 }
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5206
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5207 static void
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5208 ensure_signed_on_elsewhere_minidialog(PidginBuddyList *gtkblist)
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5209 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5210 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5211 PidginMiniDialog *mini_dialog;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5212
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5213 if(priv->signed_on_elsewhere)
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5214 return;
21703
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5215
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5216 mini_dialog = priv->signed_on_elsewhere =
21775
b5a91c9d9841 Having a long sentence as a title is a bit overly-bold, and I really want this dialog to say 'Welcome back'
Sean Egan <seanegan@pidgin.im>
parents: 21773
diff changeset
5217 pidgin_mini_dialog_new(_("Welcome back!"), NULL, PIDGIN_STOCK_DISCONNECT);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5218
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5219 pidgin_mini_dialog_add_button(mini_dialog, _("Re-enable"),
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5220 reconnect_elsewhere_accounts, NULL);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5221
21960
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5222 /* Make dismissing the dialog clear the errors. The "destroy" signal
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5223 * does not appear to fire at quit, which is fortunate!
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5224 */
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5225 g_signal_connect(G_OBJECT(mini_dialog), "destroy",
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5226 (GCallback) clear_elsewhere_errors, NULL);
156628be3fe9 Dismissing the signed on elsewhere minidialog should clear all the errors;
Will Thompson <resiak@pidgin.im>
parents: 21894
diff changeset
5227
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5228 add_error_dialog(gtkblist, GTK_WIDGET(mini_dialog));
21332
bbf010fd6cc7 Hide the description label of the PidginMiniDialog used for signed on elsewhere
Will Thompson <resiak@pidgin.im>
parents: 21331
diff changeset
5229
bbf010fd6cc7 Hide the description label of the PidginMiniDialog used for signed on elsewhere
Will Thompson <resiak@pidgin.im>
parents: 21331
diff changeset
5230 /* Set priv->signed_on_elsewhere to NULL when the dialog is destroyed */
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5231 g_signal_connect(G_OBJECT(mini_dialog), "destroy",
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5232 (GCallback) gtk_widget_destroyed, &(priv->signed_on_elsewhere));
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5233 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5234
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5235 static void
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5236 update_signed_on_elsewhere_minidialog_title(void)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5237 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5238 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5239 PidginMiniDialog *mini_dialog = priv->signed_on_elsewhere;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5240 guint accounts;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5241 char *title;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5242
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5243 if (mini_dialog == NULL)
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5244 return;
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5245
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5246 accounts = pidgin_mini_dialog_get_num_children(mini_dialog);
21703
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5247 if (accounts == 0) {
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5248 gtk_widget_destroy(GTK_WIDGET(mini_dialog));
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5249 return;
2c68babda535 Workarounds to fix some issues with the minidialog and scrollbook.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21670
diff changeset
5250 }
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5251
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5252 title = g_strdup_printf(
21775
b5a91c9d9841 Having a long sentence as a title is a bit overly-bold, and I really want this dialog to say 'Welcome back'
Sean Egan <seanegan@pidgin.im>
parents: 21773
diff changeset
5253 ngettext("%d account was disabled because you signed on from another location:",
b5a91c9d9841 Having a long sentence as a title is a bit overly-bold, and I really want this dialog to say 'Welcome back'
Sean Egan <seanegan@pidgin.im>
parents: 21773
diff changeset
5254 "%d accounts were disabled because you signed on from another location:",
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5255 accounts),
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5256 accounts);
21775
b5a91c9d9841 Having a long sentence as a title is a bit overly-bold, and I really want this dialog to say 'Welcome back'
Sean Egan <seanegan@pidgin.im>
parents: 21773
diff changeset
5257 pidgin_mini_dialog_set_description(mini_dialog, title);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5258 g_free(title);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5259 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5260
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5261 static GtkWidget *
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5262 create_account_label(PurpleAccount *account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5263 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5264 GtkWidget *hbox, *label;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5265 const char *username = purple_account_get_username(account);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5266 char *markup;
13049
5b9fac63e263 [gaim-migrate @ 15410]
Mark Doliner <markdoliner@pidgin.im>
parents: 13038
diff changeset
5267
17141
f7d7dbca47cd Pack connection error buttons the same way the statusbox is. Fixes #120
Sean Egan <seanegan@pidgin.im>
parents: 17086
diff changeset
5268 hbox = gtk_hbox_new(FALSE, 6);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5269 g_object_set_data(G_OBJECT(hbox), OBJECT_DATA_KEY_ACCOUNT, account);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5270
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5271 pack_prpl_icon_start(hbox, account);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5272
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5273 label = gtk_label_new(NULL);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5274 markup = g_strdup_printf("<span size=\"smaller\">%s</span>", username);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5275 gtk_label_set_markup(GTK_LABEL(label), markup);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5276 g_free(markup);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5277 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
21317
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5278 g_object_set(G_OBJECT(label), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5279 #if GTK_CHECK_VERSION(2,12,0)
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5280 { /* avoid unused variable warnings on pre-2.12 Gtk */
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5281 char *description =
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5282 purple_account_get_current_error(account)->description;
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5283 if (description != NULL && *description != '\0')
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5284 gtk_widget_set_tooltip_text(label, description);
27e27a132a1c Add a tooltip to each account's label in the signed on elsewhere minidialog,
Will Thompson <resiak@pidgin.im>
parents: 21316
diff changeset
5285 }
13022
60db2ca976bf [gaim-migrate @ 15375]
Etan Reisner <deryni@pidgin.im>
parents: 13016
diff changeset
5286 #endif
17141
f7d7dbca47cd Pack connection error buttons the same way the statusbox is. Fixes #120
Sean Egan <seanegan@pidgin.im>
parents: 17086
diff changeset
5287 gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
13022
60db2ca976bf [gaim-migrate @ 15375]
Etan Reisner <deryni@pidgin.im>
parents: 13016
diff changeset
5288
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5289 return hbox;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5290 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5291
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5292 static void
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5293 add_to_signed_on_elsewhere(PurpleAccount *account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5294 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5295 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5296 PidginMiniDialog *mini_dialog;
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5297 GtkWidget *account_label;
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5298
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5299 ensure_signed_on_elsewhere_minidialog(gtkblist);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5300 mini_dialog = priv->signed_on_elsewhere;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5301
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5302 if(find_child_widget_by_account(GTK_CONTAINER(mini_dialog->contents), account))
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5303 return;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5304
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5305 account_label = create_account_label(account);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5306 gtk_box_pack_start(mini_dialog->contents, account_label, FALSE, FALSE, 0);
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5307 gtk_widget_show_all(account_label);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5308
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5309 update_signed_on_elsewhere_minidialog_title();
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5310 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5311
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5312 static void
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5313 remove_from_signed_on_elsewhere(PurpleAccount *account)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5314 {
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5315 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5316 PidginMiniDialog *mini_dialog = priv->signed_on_elsewhere;
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5317 if(mini_dialog == NULL)
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5318 return;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5319
21331
a372fff82b03 Use PidginMiniDialog to display signed in elsewhere errors in the blist.
Will Thompson <resiak@pidgin.im>
parents: 21322
diff changeset
5320 remove_child_widget_by_account(GTK_CONTAINER(mini_dialog->contents), account);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5321
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5322 update_signed_on_elsewhere_minidialog_title();
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5323 }
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5324
21316
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5325
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5326 static void
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5327 update_signed_on_elsewhere_tooltip(PurpleAccount *account,
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5328 const char *description)
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5329 {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5330 #if GTK_CHECK_VERSION(2,12,0)
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5331 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5332 GtkContainer *c = GTK_CONTAINER(priv->signed_on_elsewhere->contents);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5333 GtkWidget *label = find_child_widget_by_account(c, account);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5334 gtk_widget_set_tooltip_text(label, description);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5335 #endif
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5336 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5337
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5338
32148
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5339 /**
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5340 * Was used by the connection API to tell the blist if an account has a
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5341 * connection error or no longer has a connection error, but the blist now does
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5342 * this itself with the @ref account-error-changed signal.
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5343 *
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5344 * @param account The account that either has a connection error
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5345 * or no longer has a connection error.
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5346 * @param message The connection error message, or NULL if this
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5347 * account is no longer in an error state.
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5348 */
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5349 static void
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5350 pidgin_blist_update_account_error_state(PurpleAccount *account, const char *text)
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5351 {
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5352 /* connection_errors isn't actually used anywhere; it's just kept in
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5353 * sync with reality in case a plugin uses it.
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5354 */
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5355 if (text == NULL)
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5356 g_hash_table_remove(gtkblist->connection_errors, account);
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5357 else
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5358 g_hash_table_insert(gtkblist->connection_errors, account, g_strdup(text));
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5359 }
73329b082d7d Remove some deprecated stuff
Mark Doliner <markdoliner@pidgin.im>
parents: 31945
diff changeset
5360
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5361 /* Call appropriate error notification code based on error types */
21305
31497b8518f9 Break creating and removing generic error boxes by account into their own
Will Thompson <resiak@pidgin.im>
parents: 21303
diff changeset
5362 static void
21294
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5363 update_account_error_state(PurpleAccount *account,
21299
114d986fa9cc The two PurpleConnectionErrorInfo parameters are meant to be const.
Will Thompson <resiak@pidgin.im>
parents: 21298
diff changeset
5364 const PurpleConnectionErrorInfo *old,
114d986fa9cc The two PurpleConnectionErrorInfo parameters are meant to be const.
Will Thompson <resiak@pidgin.im>
parents: 21298
diff changeset
5365 const PurpleConnectionErrorInfo *new,
21294
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5366 PidginBuddyList *gtkblist)
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5367 {
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5368 gboolean descriptions_differ;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5369 const char *desc;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5370
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5371 if (old == NULL && new == NULL)
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5372 return;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5373
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5374 /* For backwards compatibility: */
21294
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5375 if (new)
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
5376 pidgin_blist_update_account_error_state(account, new->description);
21290
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
5377 else
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
5378 pidgin_blist_update_account_error_state(account, NULL);
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5379
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5380 if (new != NULL)
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5381 pidgin_blist_select_notebook_page(gtkblist);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5382
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5383 if (old != NULL && new == NULL) {
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5384 if(old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5385 remove_from_signed_on_elsewhere(account);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5386 else
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5387 remove_generic_error_dialog(account);
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5388 return;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5389 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5390
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5391 if (old == NULL && new != NULL) {
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5392 if(new->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE)
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5393 add_to_signed_on_elsewhere(account);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
5394 else
21319
512958751033 Use minidialogs rather than horrifying buttons with red text to notify the user
Will Thompson <resiak@pidgin.im>
parents: 21318
diff changeset
5395 add_generic_error_dialog(account, new);
22428
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5396 return;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5397 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5398
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5399 /* else, new and old are both non-NULL */
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5400
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5401 descriptions_differ = strcmp(old->description, new->description);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5402 desc = new->description;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5403
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5404 switch (new->type) {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5405 case PURPLE_CONNECTION_ERROR_NAME_IN_USE:
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5406 if (old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5407 && descriptions_differ) {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5408 update_signed_on_elsewhere_tooltip(account, desc);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5409 } else {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5410 remove_generic_error_dialog(account);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5411 add_to_signed_on_elsewhere(account);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5412 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5413 break;
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5414 default:
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5415 if (old->type == PURPLE_CONNECTION_ERROR_NAME_IN_USE) {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5416 remove_from_signed_on_elsewhere(account);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5417 add_generic_error_dialog(account, new);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5418 } else if (descriptions_differ) {
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5419 update_generic_error_message(account, desc);
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5420 }
c5365599756d Rework update_account_error_state to reuse existing mini-dialogs if they exist,
Will Thompson <resiak@pidgin.im>
parents: 22427
diff changeset
5421 break;
21301
c84e67d3eedd * When an account error changes, just recreate its button rather than every
Will Thompson <resiak@pidgin.im>
parents: 21299
diff changeset
5422 }
21290
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
5423 }
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
5424
21316
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5425 /* In case accounts are loaded before the blist (which they currently are),
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5426 * let's call update_account_error_state ourselves on every account's current
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5427 * state when the blist starts.
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5428 */
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5429 static void
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5430 show_initial_account_errors(PidginBuddyList *gtkblist)
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5431 {
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5432 GList *l = purple_accounts_get_all();
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5433 PurpleAccount *account;
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5434 const PurpleConnectionErrorInfo *err;
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5435
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5436 for (; l; l = l->next)
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5437 {
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5438 account = l->data;
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5439 err = purple_account_get_current_error(account);
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5440
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5441 update_account_error_state(account, NULL, err, gtkblist);
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
5442 }
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5443 }
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5444
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5445 static gboolean
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5446 paint_headline_hbox (GtkWidget *widget,
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5447 GdkEventExpose *event,
15300
454ddc38e700 [gaim-migrate @ 18028]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15286
diff changeset
5448 gpointer user_data)
454ddc38e700 [gaim-migrate @ 18028]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15286
diff changeset
5449 {
454ddc38e700 [gaim-migrate @ 18028]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15286
diff changeset
5450 gtk_paint_flat_box (widget->style,
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5451 widget->window,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5452 GTK_STATE_NORMAL,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5453 GTK_SHADOW_OUT,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5454 NULL,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5455 widget,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5456 "tooltip",
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5457 widget->allocation.x + 1,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5458 widget->allocation.y + 1,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5459 widget->allocation.width - 2,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5460 widget->allocation.height - 2);
15300
454ddc38e700 [gaim-migrate @ 18028]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15286
diff changeset
5461 return FALSE;
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5462 }
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5463
15621
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5464 /* This assumes there are not things like groupless buddies or multi-leveled groups.
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5465 * I'm sure other things in this code assumes that also.
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5466 */
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5467 static void
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5468 treeview_style_set (GtkWidget *widget,
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5469 GtkStyle *prev_style,
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5470 gpointer data)
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5471 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5472 PurpleBuddyList *list = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5473 PurpleBlistNode *node = list->root;
15621
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5474 while (node) {
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5475 pidgin_blist_update_group(list, node);
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5476 node = node->next;
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5477 }
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5478 }
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5479
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5480 static void
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5481 headline_style_set (GtkWidget *widget,
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5482 GtkStyle *prev_style)
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5483 {
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5484 GtkTooltips *tooltips;
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5485 GtkStyle *style;
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5486
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5487 if (gtkblist->changing_style)
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5488 return;
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5489
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5490 tooltips = gtk_tooltips_new ();
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5491 g_object_ref_sink (tooltips);
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5492
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5493 gtk_tooltips_force_window (tooltips);
22084
6b0cc6e80030 Patch from Ignacio Casal Quinteiro (nacho) to fix style issues with the headline in the buddylist. Closes #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22064
diff changeset
5494 #if GTK_CHECK_VERSION(2, 12, 0)
6b0cc6e80030 Patch from Ignacio Casal Quinteiro (nacho) to fix style issues with the headline in the buddylist. Closes #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22064
diff changeset
5495 gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips");
6b0cc6e80030 Patch from Ignacio Casal Quinteiro (nacho) to fix style issues with the headline in the buddylist. Closes #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22064
diff changeset
5496 #endif
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5497 gtk_widget_ensure_style (tooltips->tip_window);
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5498 style = gtk_widget_get_style (tooltips->tip_window);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5499
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5500 gtkblist->changing_style = TRUE;
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5501 gtk_widget_set_style (gtkblist->headline_hbox, style);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5502 gtkblist->changing_style = FALSE;
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5503
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5504 g_object_unref (tooltips);
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5505 }
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5506
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5507 /******************************************/
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5508 /* End of connection error handling stuff */
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5509 /******************************************/
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5510
15413
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5511 static int
22996
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5512 blist_focus_cb(GtkWidget *widget, GdkEventFocus *event, PidginBuddyList *gtkblist)
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5513 {
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5514 if(event->in) {
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5515 gtk_blist_focused = TRUE;
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5516 pidgin_set_urgent(GTK_WINDOW(gtkblist->window), FALSE);
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5517 } else {
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5518 gtk_blist_focused = FALSE;
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5519 }
15413
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5520 return 0;
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5521 }
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5522
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5523 #if 0
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5524 static GtkWidget *
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5525 kiosk_page()
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5526 {
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
5527 GtkWidget *ret = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5528 GtkWidget *label;
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5529 GtkWidget *entry;
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5530 GtkWidget *bbox;
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5531 GtkWidget *button;
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5532
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5533 label = gtk_label_new(NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5534 gtk_box_pack_start(GTK_BOX(ret), label, TRUE, TRUE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5535
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5536 label = gtk_label_new(NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5537 gtk_label_set_markup(GTK_LABEL(label), _("<b>Username:</b>"));
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5538 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5539 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5540 entry = gtk_entry_new();
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5541 gtk_box_pack_start(GTK_BOX(ret), entry, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5542
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5543 label = gtk_label_new(NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5544 gtk_label_set_markup(GTK_LABEL(label), _("<b>Password:</b>"));
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5545 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5546 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5547 entry = gtk_entry_new();
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5548 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5549 gtk_box_pack_start(GTK_BOX(ret), entry, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5550
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5551 label = gtk_label_new(" ");
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5552 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5553
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5554 bbox = gtk_hbutton_box_new();
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5555 button = gtk_button_new_with_mnemonic(_("_Login"));
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5556 gtk_box_pack_start(GTK_BOX(ret), bbox, FALSE, FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5557 gtk_container_add(GTK_CONTAINER(bbox), button);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5558
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5559
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5560 label = gtk_label_new(NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5561 gtk_box_pack_start(GTK_BOX(ret), label, TRUE, TRUE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5562
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
5563 gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5564
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5565 gtk_widget_show_all(ret);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5566 return ret;
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5567 }
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5568 #endif
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5569
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5570 /* builds the blist layout according to to the current theme */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5571 static void
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5572 pidgin_blist_build_layout(PurpleBuddyList *list)
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5573 {
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5574 GtkTreeViewColumn *column;
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5575 PidginBlistLayout *layout;
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5576 PidginBlistTheme *theme;
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5577 GtkCellRenderer *rend;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5578 gint i, status_icon = 0, text = 1, emblem = 2, protocol_icon = 3, buddy_icon = 4;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
5579
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5580
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5581 column = gtkblist->text_column;
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5582
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5583 if ((theme = pidgin_blist_get_theme()) != NULL && (layout = pidgin_blist_theme_get_layout(theme)) != NULL) {
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
5584 status_icon = layout->status_icon ;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5585 text = layout->text;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5586 emblem = layout->emblem;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5587 protocol_icon = layout->protocol_icon;
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5588 buddy_icon = layout->buddy_icon;
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5589 }
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5590
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5591 gtk_tree_view_column_clear(column);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5592
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5593 /* group */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5594 rend = pidgin_cell_renderer_expander_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5595 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5596 gtk_tree_view_column_set_attributes(column, rend,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5597 "visible", GROUP_EXPANDER_VISIBLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5598 "expander-visible", GROUP_EXPANDER_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5599 "sensitive", GROUP_EXPANDER_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5600 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5601 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5602
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5603 /* contact */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5604 rend = pidgin_cell_renderer_expander_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5605 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5606 gtk_tree_view_column_set_attributes(column, rend,
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5607 "visible", CONTACT_EXPANDER_VISIBLE_COLUMN,
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5608 "expander-visible", CONTACT_EXPANDER_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5609 "sensitive", CONTACT_EXPANDER_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5610 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5611 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5612
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5613 for (i = 0; i < 5; i++) {
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5614
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
5615 if (status_icon == i) {
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5616 /* status icons */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5617 rend = gtk_cell_renderer_pixbuf_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5618 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5619 gtk_tree_view_column_set_attributes(column, rend,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5620 "pixbuf", STATUS_ICON_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5621 "visible", STATUS_ICON_VISIBLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5622 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5623 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5624 g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5625
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5626 } else if (text == i) {
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5627 /* name */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5628 gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23970
diff changeset
5629 gtk_tree_view_column_pack_start(column, rend, TRUE);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5630 gtk_tree_view_column_set_attributes(column, rend,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5631 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5632 "markup", NAME_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5633 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5634 g_signal_connect(G_OBJECT(rend), "editing-started", G_CALLBACK(gtk_blist_renderer_editing_started_cb), NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5635 g_signal_connect(G_OBJECT(rend), "editing-canceled", G_CALLBACK(gtk_blist_renderer_editing_cancelled_cb), list);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5636 g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), list);
23973
189295d2ee8e clean up formatting, and added render settings for the names/markup on the blist
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23970
diff changeset
5637 g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5638 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5639
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5640 /* idle */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5641 rend = gtk_cell_renderer_text_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5642 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5643 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5644 gtk_tree_view_column_set_attributes(column, rend,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5645 "markup", IDLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5646 "visible", IDLE_VISIBLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5647 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5648 NULL);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5649 } else if (emblem == i) {
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5650 /* emblem */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5651 rend = gtk_cell_renderer_pixbuf_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5652 g_object_set(rend, "xalign", 1.0, "yalign", 0.5, "ypad", 0, "xpad", 3, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5653 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5654 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", EMBLEM_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5655 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5656 "visible", EMBLEM_VISIBLE_COLUMN, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5657
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5658 } else if (protocol_icon == i) {
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5659 /* protocol icon */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5660 rend = gtk_cell_renderer_pixbuf_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5661 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5662 gtk_tree_view_column_set_attributes(column, rend,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5663 "pixbuf", PROTOCOL_ICON_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5664 "visible", PROTOCOL_ICON_VISIBLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5665 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5666 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5667 g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5668
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5669 } else if (buddy_icon == i) {
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5670 /* buddy icon */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5671 rend = gtk_cell_renderer_pixbuf_new();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5672 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5673 gtk_tree_view_column_pack_start(column, rend, FALSE);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5674 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", BUDDY_ICON_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5675 "cell-background-gdk", BGCOLOR_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5676 "visible", BUDDY_ICON_VISIBLE_COLUMN,
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5677 NULL);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5678 }
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5679
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5680 }/* end for loop */
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
5681
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5682 }
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5683
29244
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5684 static gboolean
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5685 pidgin_blist_search_equal_func(GtkTreeModel *model, gint column,
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5686 const gchar *key, GtkTreeIter *iter, gpointer data)
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5687 {
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5688 PurpleBlistNode *node = NULL;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5689 gboolean res = TRUE;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5690 const char *compare = NULL;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5691
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5692 if (!pidgin_tree_view_search_equal_func(model, column, key, iter, data))
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5693 return FALSE;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5694
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5695 /* If the search string does not match the displayed label, then look
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5696 * at the alternate labels for the nodes and search in them. Currently,
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5697 * alternate labels that make sense are usernames/email addresses for
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5698 * buddies (but only for the ones who don't have a local alias).
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5699 */
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5700
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5701 gtk_tree_model_get(model, iter, NODE_COLUMN, &node, -1);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5702 if (!node)
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5703 return TRUE;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5704
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5705 compare = NULL;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5706 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) {
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5707 PurpleBuddy *b = purple_contact_get_priority_buddy(PURPLE_CONTACT(node));
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5708 if (!purple_buddy_get_local_buddy_alias(b))
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5709 compare = purple_buddy_get_name(b);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5710 } else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) {
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5711 if (!purple_buddy_get_local_buddy_alias(PURPLE_BUDDY(node)))
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5712 compare = purple_buddy_get_name(PURPLE_BUDDY(node));
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5713 }
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5714
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5715 if (compare) {
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5716 char *tmp, *enteredstring;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5717 tmp = g_utf8_normalize(key, -1, G_NORMALIZE_DEFAULT);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5718 enteredstring = g_utf8_casefold(tmp, -1);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5719 g_free(tmp);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5720
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5721 if (purple_str_has_prefix(compare, enteredstring))
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5722 res = FALSE;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5723 g_free(enteredstring);
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5724 }
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5725
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5726 return res;
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5727 }
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5728
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5729 static void pidgin_blist_show(PurpleBuddyList *list)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5730 {
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5731 PidginBuddyListPrivate *priv;
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
5732 void *handle;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5733 GtkTreeViewColumn *column;
10178
16a2e27759fe [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
5734 GtkWidget *menu;
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5735 GtkWidget *ebox;
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14603
diff changeset
5736 GtkWidget *sep;
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5737 GtkWidget *label;
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5738 GtkWidget *close;
16071
044392e01c96 make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents: 16068
diff changeset
5739 char *pretty, *tmp;
26750
47b78bc68845 Fix assertion when the blist theme preference is empty.
Michael Ruprecht <maiku@pidgin.im>
parents: 26611
diff changeset
5740 const char *theme_name;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5741 GtkAccelGroup *accel_group;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5742 GtkTreeSelection *selection;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5743 GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
8089
0adbe5c66985 [gaim-migrate @ 8788]
Sean Egan <seanegan@pidgin.im>
parents: 8083
diff changeset
5744 {"application/x-im-contact", 0, DRAG_BUDDY},
9495
e9b2ece77b70 [gaim-migrate @ 10321]
Sean Egan <seanegan@pidgin.im>
parents: 9466
diff changeset
5745 {"text/x-vcard", 0, DRAG_VCARD },
9525
28a430d517db [gaim-migrate @ 10352]
Sean Egan <seanegan@pidgin.im>
parents: 9498
diff changeset
5746 {"text/uri-list", 0, DRAG_URI},
28a430d517db [gaim-migrate @ 10352]
Sean Egan <seanegan@pidgin.im>
parents: 9498
diff changeset
5747 {"text/plain", 0, DRAG_TEXT}};
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5748 GtkTargetEntry ste[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
9556
26e2e1141081 [gaim-migrate @ 10392]
Sean Egan <seanegan@pidgin.im>
parents: 9533
diff changeset
5749 {"application/x-im-contact", 0, DRAG_BUDDY},
26e2e1141081 [gaim-migrate @ 10392]
Sean Egan <seanegan@pidgin.im>
parents: 9533
diff changeset
5750 {"text/x-vcard", 0, DRAG_VCARD }};
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5751 if (gtkblist && gtkblist->window) {
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
5752 purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible"));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5753 return;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5754 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5755
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5756 gtkblist = PIDGIN_BLIST(list);
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5757 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5758
27196
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
5759 if (priv->current_theme)
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
5760 g_object_unref(priv->current_theme);
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
5761
26750
47b78bc68845 Fix assertion when the blist theme preference is empty.
Michael Ruprecht <maiku@pidgin.im>
parents: 26611
diff changeset
5762 theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme");
47b78bc68845 Fix assertion when the blist theme preference is empty.
Michael Ruprecht <maiku@pidgin.im>
parents: 26611
diff changeset
5763 if (theme_name && *theme_name)
27196
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
5764 priv->current_theme = g_object_ref(PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist")));
26750
47b78bc68845 Fix assertion when the blist theme preference is empty.
Michael Ruprecht <maiku@pidgin.im>
parents: 26611
diff changeset
5765 else
47b78bc68845 Fix assertion when the blist theme preference is empty.
Michael Ruprecht <maiku@pidgin.im>
parents: 26611
diff changeset
5766 priv->current_theme = NULL;
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
5767
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
5768 gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
5769 gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
5770
17213
25a0ae0d0ff7 Added to gtkutils.c:
Gabriel Schulhof <nix@go-nix.ca>
parents: 17180
diff changeset
5771 gtkblist->window = pidgin_create_window(_("Buddy List"), 0, "buddy_list", TRUE);
15413
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5772 g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event",
3f4d28fe3423 [gaim-migrate @ 18144]
Sean Egan <seanegan@pidgin.im>
parents: 15409
diff changeset
5773 G_CALLBACK(blist_focus_cb), gtkblist);
22996
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5774 g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event",
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
5775 G_CALLBACK(blist_focus_cb), gtkblist);
12328
4a2611214a15 [gaim-migrate @ 14632]
Nathan Walp <nwalp@pidgin.im>
parents: 12326
diff changeset
5776 GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5777
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5778 gtkblist->main_vbox = gtk_vbox_new(FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5779 gtk_widget_show(gtkblist->main_vbox);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5780 gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->main_vbox);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5781
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
5782 g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5783 g_signal_connect(G_OBJECT(gtkblist->window), "configure_event", G_CALLBACK(gtk_blist_configure_cb), NULL);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
5784 g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL);
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
5785 g_signal_connect(G_OBJECT(gtkblist->window), "window_state_event", G_CALLBACK(gtk_blist_window_state_cb), NULL);
12461
960ff25e0214 [gaim-migrate @ 14771]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12458
diff changeset
5786 g_signal_connect(G_OBJECT(gtkblist->window), "key_press_event", G_CALLBACK(gtk_blist_window_key_press_cb), gtkblist);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5787 gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5788
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5789 /******************************* Menu bar *************************************/
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5790 accel_group = gtk_accel_group_new();
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5791 gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5792 g_object_unref(accel_group);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5793 gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<PurpleMain>", accel_group);
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5794 gtk_item_factory_set_translate_func(gtkblist->ift,
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13091
diff changeset
5795 (GtkTranslateFunc)item_factory_translate_func,
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5796 NULL, NULL);
5427
a45fa07ef20d [gaim-migrate @ 5806]
Mark Doliner <markdoliner@pidgin.im>
parents: 5422
diff changeset
5797 gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu),
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5798 blist_menu, NULL);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5799 pidgin_load_accels();
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
5800 g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL);
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
5801
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
5802 menu = gtk_item_factory_get_widget(gtkblist->ift, "<PurpleMain>");
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5803 gtkblist->menutray = pidgin_menu_tray_new();
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
5804 gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
5805 gtk_widget_show(gtkblist->menutray);
10178
16a2e27759fe [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
5806 gtk_widget_show(menu);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5807 gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5808
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
5809 accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts"));
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
5810
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5811
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5812 /****************************** Notebook *************************************/
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5813 gtkblist->notebook = gtk_notebook_new();
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5814 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkblist->notebook), FALSE);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5815 gtk_notebook_set_show_border(GTK_NOTEBOOK(gtkblist->notebook), FALSE);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5816 gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), gtkblist->notebook, TRUE, TRUE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5817
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5818 #if 0
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5819 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook), kiosk_page(), NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5820 #endif
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5821
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5822 /* Translators: Please maintain the use of -> and <- to refer to menu heirarchy */
16071
044392e01c96 make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents: 16068
diff changeset
5823 tmp = g_strdup_printf(_("<span weight='bold' size='larger'>Welcome to %s!</span>\n\n"
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5824
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5825 "You have no accounts enabled. Enable your IM accounts from the "
23453
92539a16ec2a Bring back the unintentionally hidden 'Manage Accounts' dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23450
diff changeset
5826 "<b>Accounts</b> window at <b>Accounts->Manage Accounts</b>. Once you "
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5827 "enable accounts, you'll be able to sign on, set your status, "
16071
044392e01c96 make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents: 16068
diff changeset
5828 "and talk to your friends."), PIDGIN_NAME);
044392e01c96 make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents: 16068
diff changeset
5829 pretty = pidgin_make_pretty_arrows(tmp);
044392e01c96 make things cleaner for translators
Nathan Walp <nwalp@pidgin.im>
parents: 16068
diff changeset
5830 g_free(tmp);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5831 label = gtk_label_new(NULL);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
5832 gtk_widget_set_size_request(label, purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 12, -1);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5833 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5834 gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5835 gtk_label_set_markup(GTK_LABEL(label), pretty);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5836 g_free(pretty);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5837 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook),label, NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5838 gtkblist->vbox = gtk_vbox_new(FALSE, 0);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5839 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook), gtkblist->vbox, NULL);
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5840 gtk_widget_show_all(gtkblist->notebook);
21670
9ce6e7374523 This fixes the problem where all accounts are disabled due to connection
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21669
diff changeset
5841 pidgin_blist_select_notebook_page(gtkblist);
15086
c680354b7c95 [gaim-migrate @ 17806]
Sean Egan <seanegan@pidgin.im>
parents: 15063
diff changeset
5842
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5843 ebox = gtk_event_box_new();
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5844 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), ebox, FALSE, FALSE, 0);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5845 gtkblist->headline_hbox = gtk_hbox_new(FALSE, 3);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5846 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline_hbox), 6);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5847 gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5848 gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL);
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5849 gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0);
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5850 gtkblist->headline_label = gtk_label_new(NULL);
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5851 gtk_widget_set_size_request(gtkblist->headline_label,
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
5852 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1);
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5853 gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE);
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5854 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5855 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0);
22087
ce5388a6bf3a nacho points out that we need to connect to 'style-set' on a widget that uses the default style, because the signal is not emitted for widgets that uses custom styles. This is part of his earlier patch. References #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22084
diff changeset
5856 g_signal_connect(gtkblist->headline_label, /* connecting on headline_hbox doesn't work, because
ce5388a6bf3a nacho points out that we need to connect to 'style-set' on a widget that uses the default style, because the signal is not emitted for widgets that uses custom styles. This is part of his earlier patch. References #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22084
diff changeset
5857 the signal is not emitted when theme is changed */
ce5388a6bf3a nacho points out that we need to connect to 'style-set' on a widget that uses the default style, because the signal is not emitted for widgets that uses custom styles. This is part of his earlier patch. References #4351.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22084
diff changeset
5858 "style-set",
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5859 G_CALLBACK(headline_style_set),
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5860 NULL);
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5861 g_signal_connect (gtkblist->headline_hbox,
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5862 "expose_event",
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5863 G_CALLBACK (paint_headline_hbox),
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5864 NULL);
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5865 gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips");
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
5866
29897
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5867 gtkblist->headline_close = gtk_widget_render_icon(ebox, GTK_STOCK_CLOSE,
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5868 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC), NULL);
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5869 gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5870 gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR);
15300
454ddc38e700 [gaim-migrate @ 18028]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15286
diff changeset
5871
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5872 /* Close button. */
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5873 close = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
29897
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5874 close = pidgin_create_small_button(close);
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5875 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), close, FALSE, FALSE, 0);
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5876 #if GTK_CHECK_VERSION(2,12,0)
29897
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5877 gtk_widget_set_tooltip_text(close, _("Close"));
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5878 #endif
29897
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
5879 g_signal_connect(close, "clicked", G_CALLBACK(headline_close_press_cb), gtkblist);
29896
fd9614c33141 Use a small GtkButton instead of the custom "X" for close in various
Kosta Arvanitis <karvanitis@hotmail.com>
parents: 29873
diff changeset
5880
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5881 g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), gtkblist);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5882 g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), gtkblist);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5883 g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5884
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5885 /****************************** GtkTreeView **********************************/
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
5886 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5887 GDK_TYPE_PIXBUF, /* Status icon */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5888 G_TYPE_BOOLEAN, /* Status icon visible */
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5889 G_TYPE_STRING, /* Name */
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5890 G_TYPE_STRING, /* Idle */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5891 G_TYPE_BOOLEAN, /* Idle visible */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5892 GDK_TYPE_PIXBUF, /* Buddy icon */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5893 G_TYPE_BOOLEAN, /* Buddy icon visible */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5894 G_TYPE_POINTER, /* Node */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5895 GDK_TYPE_COLOR, /* bgcolor */
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5896 G_TYPE_BOOLEAN, /* Group expander */
16182
88b7040408c8 Set the disable maximize button hint on the blist. I couldn't find a window manager that supports this, but I bet win32 does.
Sean Egan <seanegan@pidgin.im>
parents: 16162
diff changeset
5897 G_TYPE_BOOLEAN, /* Group expander visible */
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
5898 G_TYPE_BOOLEAN, /* Contact expander */
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
5899 G_TYPE_BOOLEAN, /* Contact expander visible */
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
5900 GDK_TYPE_PIXBUF, /* Emblem */
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
5901 G_TYPE_BOOLEAN, /* Emblem visible */
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
5902 GDK_TYPE_PIXBUF, /* Protocol icon */
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
5903 G_TYPE_BOOLEAN /* Protocol visible */
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
5904 );
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5905
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5906 gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel));
14230
82177a4e23ab [gaim-migrate @ 16818]
Sean Egan <seanegan@pidgin.im>
parents: 14215
diff changeset
5907
10178
16a2e27759fe [gaim-migrate @ 11293]
Christian Hammond <chipx86@chipx86.com>
parents: 10144
diff changeset
5908 gtk_widget_show(gtkblist->treeview);
16259
73b7c796c8d3 I don't like the pidginfoo_bar widget names that resulted from the sed.
Richard Laager <rlaager@pidgin.im>
parents: 16254
diff changeset
5909 gtk_widget_set_name(gtkblist->treeview, "pidgin_blist_treeview");
15621
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5910
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5911 g_signal_connect(gtkblist->treeview,
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5912 "style-set",
947891574425 Make group background colors update when the theme changes.
Sean Egan <seanegan@pidgin.im>
parents: 15614
diff changeset
5913 G_CALLBACK(treeview_style_set), list);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5914 /* Set up selection stuff */
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5915 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview));
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5916 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(pidgin_blist_selection_changed), NULL);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5917
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5918 /* Set up dnd */
7650
bd193cc04594 [gaim-migrate @ 8293]
Mark Doliner <markdoliner@pidgin.im>
parents: 7642
diff changeset
5919 gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(gtkblist->treeview),
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5920 GDK_BUTTON1_MASK, ste, 3,
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5921 GDK_ACTION_COPY);
7650
bd193cc04594 [gaim-migrate @ 8293]
Mark Doliner <markdoliner@pidgin.im>
parents: 7642
diff changeset
5922 gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(gtkblist->treeview),
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5923 dte, 5,
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
5924 GDK_ACTION_COPY | GDK_ACTION_MOVE);
7636
34f4cb560c8e [gaim-migrate @ 8278]
Sean Egan <seanegan@pidgin.im>
parents: 7628
diff changeset
5925
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5926 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-received", G_CALLBACK(pidgin_blist_drag_data_rcv_cb), NULL);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5927 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-data-get", G_CALLBACK(pidgin_blist_drag_data_get_cb), NULL);
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
5928 #ifdef _WIN32
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5929 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-begin", G_CALLBACK(pidgin_blist_drag_begin), NULL);
11059
52e4f595fd27 [gaim-migrate @ 13012]
Daniel Atallah <datallah@pidgin.im>
parents: 11038
diff changeset
5930 #endif
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5931 g_signal_connect(G_OBJECT(gtkblist->treeview), "drag-motion", G_CALLBACK(pidgin_blist_drag_motion_cb), NULL);
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
5932 g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(pidgin_blist_motion_cb), NULL);
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
5933 g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(pidgin_blist_leave_cb), NULL);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5934
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5935 /* Tooltips */
21903
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
5936 pidgin_tooltip_setup_for_treeview(gtkblist->treeview, NULL,
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
5937 pidgin_blist_create_tooltip,
5b5ad54ae1da Some utility functions for showing tooltips. This is used by the buddylist,
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 21894
diff changeset
5938 pidgin_blist_paint_tip);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5939
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5940 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5941
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5942 /* expander columns */
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5943 column = gtk_tree_view_column_new();
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5944 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5945 gtk_tree_view_column_set_visible(column, FALSE);
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5946 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5947
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5948 /* everything else column */
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5949 gtkblist->text_column = gtk_tree_view_column_new ();
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5950 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), gtkblist->text_column);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
5951 pidgin_blist_build_layout(list);
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
5952
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5953 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5954 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5955 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5956 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
5957 g_signal_connect(G_OBJECT(gtkblist->treeview), "key-press-event", G_CALLBACK(gtk_blist_key_press_cb), NULL);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
5958 g_signal_connect(G_OBJECT(gtkblist->treeview), "popup-menu", G_CALLBACK(pidgin_blist_popup_menu_cb), NULL);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5959
5419
062efd736788 [gaim-migrate @ 5798]
Mark Doliner <markdoliner@pidgin.im>
parents: 5398
diff changeset
5960 /* Enable CTRL+F searching */
062efd736788 [gaim-migrate @ 5798]
Mark Doliner <markdoliner@pidgin.im>
parents: 5398
diff changeset
5961 gtk_tree_view_set_search_column(GTK_TREE_VIEW(gtkblist->treeview), NAME_COLUMN);
29244
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5962 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview),
6cf3b8073458 Search friends by email addresses in the buddylist.
Luoh Ren-Shan <lcamel@gmail.com>
parents: 29242
diff changeset
5963 pidgin_blist_search_equal_func, NULL, NULL);
5419
062efd736788 [gaim-migrate @ 5798]
Mark Doliner <markdoliner@pidgin.im>
parents: 5398
diff changeset
5964
31321
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31304
diff changeset
5965 gtk_box_pack_start(GTK_BOX(gtkblist->vbox),
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31304
diff changeset
5966 pidgin_make_scrollable(gtkblist->treeview, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_NONE, -1, -1),
1fef3832cfa2 Add pidgin_make_scrollable and use it. Cleans up a bunch of duplicate code. Net code loss of 180 lines. Fixes #13073.
Gabriel Schulhof <nix@go-nix.ca>
parents: 31304
diff changeset
5967 TRUE, TRUE, 0);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5968
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5969 sep = gtk_hseparator_new();
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5970 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sep, FALSE, FALSE, 0);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
5971
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15571
diff changeset
5972 gtkblist->scrollbook = pidgin_scroll_book_new();
15096
128dd2bdf71d [gaim-migrate @ 17817]
Sean Egan <seanegan@pidgin.im>
parents: 15094
diff changeset
5973 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
5974
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5975 /* Create an vbox which holds the scrollbook which is actually used to
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5976 * display connection errors. The vbox needs to still exist for
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5977 * backwards compatibility.
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5978 */
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5979 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0);
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5980 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0);
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5981 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->error_buttons), 0);
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5982
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
5983 priv->error_scrollbook = PIDGIN_SCROLL_BOOK(pidgin_scroll_book_new());
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5984 gtk_box_pack_start(GTK_BOX(gtkblist->error_buttons),
21585
7bdd57d17c4b Remove account error dialogs from the scrollbook's notebook, not from the
Will Thompson <resiak@pidgin.im>
parents: 21517
diff changeset
5985 GTK_WIDGET(priv->error_scrollbook), FALSE, FALSE, 0);
21322
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5986
d81c71e84543 Display all connection errors in a scrollbook, which is packed inside
Will Thompson <resiak@pidgin.im>
parents: 21321
diff changeset
5987
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
5988 /* Add the statusbox */
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15571
diff changeset
5989 gtkblist->statusbox = pidgin_status_box_new();
14195
0f7cb3b272b2 [gaim-migrate @ 16775]
Sean Egan <seanegan@pidgin.im>
parents: 14137
diff changeset
5990 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->statusbox, FALSE, TRUE, 0);
16259
73b7c796c8d3 I don't like the pidginfoo_bar widget names that resulted from the sed.
Richard Laager <rlaager@pidgin.im>
parents: 16254
diff changeset
5991 gtk_widget_set_name(gtkblist->statusbox, "pidgin_blist_statusbox");
14608
6eea6c122238 [gaim-migrate @ 17269]
Sean Egan <seanegan@pidgin.im>
parents: 14603
diff changeset
5992 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->statusbox), 3);
12583
d4f1bc373c67 [gaim-migrate @ 14911]
Sean Egan <seanegan@pidgin.im>
parents: 12576
diff changeset
5993 gtk_widget_show(gtkblist->statusbox);
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
5994
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5995 /* set the Show Offline Buddies option. must be done
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5996 * after the treeview or faceprint gets mad. -Robot101
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5997 */
19774
f6bd9c4ece3a More typos.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19771
diff changeset
5998 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Offline Buddies"))),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
5999 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"));
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6000
19774
f6bd9c4ece3a More typos.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19771
diff changeset
6001 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Empty Groups"))),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6002 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups"));
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6003
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
6004 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6005 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"));
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6006
19774
f6bd9c4ece3a More typos.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19771
diff changeset
6007 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Buddy Details"))),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6008 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"));
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6009
19774
f6bd9c4ece3a More typos.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19771
diff changeset
6010 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Idle Times"))),
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6011 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time"));
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6012
19774
f6bd9c4ece3a More typos.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19771
diff changeset
6013 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Protocol Icons"))),
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6014 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"));
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6015
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6016 if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none"))
11494
60bfb30f6cba [gaim-migrate @ 13738]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11490
diff changeset
6017 gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6018
10353
830e54bb7fa0 [gaim-migrate @ 11570]
Mark Doliner <markdoliner@pidgin.im>
parents: 10352
diff changeset
6019 /* Update some dynamic things */
830e54bb7fa0 [gaim-migrate @ 11570]
Mark Doliner <markdoliner@pidgin.im>
parents: 10352
diff changeset
6020 update_menu_bar(gtkblist);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6021 pidgin_blist_update_plugin_actions();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6022 pidgin_blist_update_sort_methods();
10353
830e54bb7fa0 [gaim-migrate @ 11570]
Mark Doliner <markdoliner@pidgin.im>
parents: 10352
diff changeset
6023
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6024 /* OK... let's show this bad boy. */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6025 pidgin_blist_refresh(list);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6026 pidgin_blist_restore_position();
14543
cc2f90ffee6f [gaim-migrate @ 17200]
Casey Harkins <charkins@pidgin.im>
parents: 14526
diff changeset
6027 gtk_widget_show_all(GTK_WIDGET(gtkblist->vbox));
14574
4a60d4fadfc4 [gaim-migrate @ 17232]
Casey Harkins <charkins@pidgin.im>
parents: 14543
diff changeset
6028 gtk_widget_realize(GTK_WIDGET(gtkblist->window));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6029 purple_blist_set_visible(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible"));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6030
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6031 /* start the refresh timer */
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 26750
diff changeset
6032 gtkblist->refresh_timer = purple_timeout_add_seconds(30, (GSourceFunc)pidgin_blist_refresh_timer, list);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6033
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6034 handle = pidgin_blist_get_handle();
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
6035
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6036 /* things that affect how buddies are displayed */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6037 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_buddy_icons",
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
6038 _prefs_change_redo_list, NULL);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6039 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_idle_time",
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6040 _prefs_change_redo_list, NULL);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6041 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_empty_groups",
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
6042 _prefs_change_redo_list, NULL);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6043 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_offline_buddies",
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
6044 _prefs_change_redo_list, NULL);
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6045 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons",
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6046 _prefs_change_redo_list, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6047
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6048 /* sorting */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6049 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/sort_type",
10087
e5b80a38939d [gaim-migrate @ 11098]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10079
diff changeset
6050 _prefs_change_sort_method, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6051
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
6052 /* menus */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6053 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/sound/mute",
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6054 pidgin_blist_mute_pref_cb, NULL);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6055 purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/sound/method",
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6056 pidgin_blist_sound_method_pref_cb, NULL);
10074
4fab99572bf1 [gaim-migrate @ 11054]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10046
diff changeset
6057
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6058 /* Setup some purple signal handlers. */
21289
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6059
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6060 handle = purple_accounts_get_handle();
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6061 purple_signal_connect(handle, "account-enabled", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6062 PURPLE_CALLBACK(account_modified), gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6063 purple_signal_connect(handle, "account-disabled", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6064 PURPLE_CALLBACK(account_modified), gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6065 purple_signal_connect(handle, "account-removed", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6066 PURPLE_CALLBACK(account_modified), gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6067 purple_signal_connect(handle, "account-status-changed", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6068 PURPLE_CALLBACK(account_status_changed),
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6069 gtkblist);
21290
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
6070 purple_signal_connect(handle, "account-error-changed", gtkblist,
21294
1fe885468da2 Add the old error to the account-error-changed signal.
Will Thompson <resiak@pidgin.im>
parents: 21290
diff changeset
6071 PURPLE_CALLBACK(update_account_error_state),
21290
24f3a8fa27c1 Call pidgin_blist_update_account_error_state in response to
Will Thompson <resiak@pidgin.im>
parents: 21289
diff changeset
6072 gtkblist);
26871
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
6073 purple_signal_connect(handle, "account-actions-changed", gtkblist,
d62964222795 Add a new signal which is emitted (after the account is connected) if the
Paul Aurich <darkrain42@pidgin.im>
parents: 26840
diff changeset
6074 PURPLE_CALLBACK(account_actions_changed), NULL);
21289
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6075
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6076 handle = pidgin_account_get_handle();
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6077 purple_signal_connect(handle, "account-modified", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6078 PURPLE_CALLBACK(account_modified), gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6079
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6080 handle = purple_connections_get_handle();
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6081 purple_signal_connect(handle, "signed-on", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6082 PURPLE_CALLBACK(sign_on_off_cb), list);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6083 purple_signal_connect(handle, "signed-off", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6084 PURPLE_CALLBACK(sign_on_off_cb), list);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6085
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6086 handle = purple_plugins_get_handle();
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6087 purple_signal_connect(handle, "plugin-load", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6088 PURPLE_CALLBACK(plugin_changed_cb), NULL);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6089 purple_signal_connect(handle, "plugin-unload", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6090 PURPLE_CALLBACK(plugin_changed_cb), NULL);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6091
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6092 handle = purple_conversations_get_handle();
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6093 purple_signal_connect(handle, "conversation-updated", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6094 PURPLE_CALLBACK(conversation_updated_cb),
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6095 gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6096 purple_signal_connect(handle, "deleting-conversation", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6097 PURPLE_CALLBACK(conversation_deleting_cb),
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6098 gtkblist);
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6099 purple_signal_connect(handle, "conversation-created", gtkblist,
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6100 PURPLE_CALLBACK(conversation_created_cb),
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6101 gtkblist);
12116
17bf39d2678f [gaim-migrate @ 14416]
Casey Harkins <charkins@pidgin.im>
parents: 12115
diff changeset
6102
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
6103 gtk_widget_hide(gtkblist->headline_hbox);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
6104
21316
9d1f5f988b4e Restore error notifications on the buddy list after a restart. Make the Ignore
Will Thompson <resiak@pidgin.im>
parents: 21308
diff changeset
6105 show_initial_account_errors(gtkblist);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
6106
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
6107 /* emit our created signal */
21289
9c87198018c3 Remove repeated calls to purple_*_get_handle().
Will Thompson <resiak@pidgin.im>
parents: 21233
diff changeset
6108 handle = pidgin_blist_get_handle();
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6109 purple_signal_emit(handle, "gtkblist-created", list);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6110 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6111
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6112 static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6113 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6114 PurpleBlistNode *node;
15307
57f6de61c714 [gaim-migrate @ 18035]
Mark Doliner <markdoliner@pidgin.im>
parents: 15306
diff changeset
6115
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6116 gtkblist = PIDGIN_BLIST(list);
15306
b4bb51751de0 [gaim-migrate @ 18034]
Ethan Blanton <elb@pidgin.im>
parents: 15300
diff changeset
6117 if(!gtkblist || !gtkblist->treeview)
b4bb51751de0 [gaim-migrate @ 18034]
Ethan Blanton <elb@pidgin.im>
parents: 15300
diff changeset
6118 return;
b4bb51751de0 [gaim-migrate @ 18034]
Ethan Blanton <elb@pidgin.im>
parents: 15300
diff changeset
6119
15307
57f6de61c714 [gaim-migrate @ 18035]
Mark Doliner <markdoliner@pidgin.im>
parents: 15306
diff changeset
6120 node = list->root;
12112
86a24bbf9a2c [gaim-migrate @ 14412]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12080
diff changeset
6121
86a24bbf9a2c [gaim-migrate @ 14412]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12080
diff changeset
6122 while (node)
86a24bbf9a2c [gaim-migrate @ 14412]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12080
diff changeset
6123 {
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
6124 /* This is only needed when we're reverting to a non-GTK+ sorted
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
6125 * status. We shouldn't need to remove otherwise.
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
6126 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6127 if (remove && !PURPLE_BLIST_NODE_IS_GROUP(node))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6128 pidgin_blist_hide_node(list, node, FALSE);
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
6129
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6130 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6131 pidgin_blist_update_buddy(list, node, rerender);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6132 else if (PURPLE_BLIST_NODE_IS_CHAT(node))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6133 pidgin_blist_update(list, node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6134 else if (PURPLE_BLIST_NODE_IS_GROUP(node))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6135 pidgin_blist_update(list, node);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6136 node = purple_blist_node_next(node, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6137 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6138
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6139 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6140
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6141 void pidgin_blist_refresh(PurpleBuddyList *list)
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
6142 {
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
6143 redo_buddy_list(list, FALSE, TRUE);
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
6144 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
6145
5297
d0fa35e02d4a [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
6146 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6147 pidgin_blist_update_refresh_timeout()
5297
d0fa35e02d4a [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
6148 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6149 PurpleBuddyList *blist;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6150 PidginBuddyList *gtkblist;
5297
d0fa35e02d4a [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
6151
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6152 blist = purple_get_blist();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6153 gtkblist = PIDGIN_BLIST(purple_get_blist());
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6154
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 26750
diff changeset
6155 gtkblist->refresh_timer = purple_timeout_add_seconds(30,(GSourceFunc)pidgin_blist_refresh_timer, blist);
5297
d0fa35e02d4a [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
6156 }
d0fa35e02d4a [gaim-migrate @ 5669]
Luke Schierer <lschiere@pidgin.im>
parents: 5296
diff changeset
6157
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6158 static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6159 struct _pidgin_blist_node *gtknode = (struct _pidgin_blist_node *)node->ui_data;
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6160 GtkTreePath *path;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6161
5263
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6162 if (!gtknode) {
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6163 return FALSE;
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6164 }
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6165
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6166 if (!gtkblist) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6167 purple_debug_error("gtkblist", "get_iter_from_node was called, but we don't seem to have a blist\n");
5263
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6168 return FALSE;
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6169 }
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6170
ed3dfef87785 [gaim-migrate @ 5635]
Ethan Blanton <elb@pidgin.im>
parents: 5260
diff changeset
6171 if (!gtknode->row)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6172 return FALSE;
11494
60bfb30f6cba [gaim-migrate @ 13738]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11490
diff changeset
6173
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6174
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6175 if ((path = gtk_tree_row_reference_get_path(gtknode->row)) == NULL)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6176 return FALSE;
11016
9990e360ee9c [gaim-migrate @ 12885]
Sean Egan <seanegan@pidgin.im>
parents: 10992
diff changeset
6177
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6178 if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), iter, path)) {
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6179 gtk_tree_path_free(path);
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6180 return FALSE;
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6181 }
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6182 gtk_tree_path_free(path);
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6183 return TRUE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6184 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6185
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6186 static void pidgin_blist_remove(PurpleBuddyList *list, PurpleBlistNode *node)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6187 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6188 struct _pidgin_blist_node *gtknode = node->ui_data;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
6189
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6190 purple_request_close_with_handle(node);
10222
5371b5459fb9 [gaim-migrate @ 11351]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10209
diff changeset
6191
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6192 pidgin_blist_hide_node(list, node, TRUE);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6193
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6194 if(node->parent)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6195 pidgin_blist_update(list, node->parent);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6196
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
6197 /* There's something I don't understand here - Ethan */
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
6198 /* Ethan said that back in 2003, but this g_free has been left commented
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
6199 * out ever since. I can't find any reason at all why this is bad and
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
6200 * valgrind found several reasons why it's good. If this causes problems
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10501
diff changeset
6201 * comment it out again. Stu */
10510
a9d90a5b7556 [gaim-migrate @ 11808]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10504
diff changeset
6202 /* Of course it still causes problems - this breaks dragging buddies into
10515
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6203 * contacts, the dragged buddy mysteriously 'disappears'. Stu. */
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6204 /* I think it's fixed now. Stu. */
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
6205
11915
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6206 if(gtknode) {
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6207 if(gtknode->recent_signonoff_timer > 0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6208 purple_timeout_remove(gtknode->recent_signonoff_timer);
11915
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6209
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6210 purple_signals_disconnect_by_handle(node->ui_data);
11915
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6211 g_free(node->ui_data);
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6212 node->ui_data = NULL;
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
6213 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6214 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6215
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6216 static gboolean do_selection_changed(PurpleBlistNode *new_selection)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6217 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6218 PurpleBlistNode *old_selection = NULL;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6219
5254
6717daf94719 [gaim-migrate @ 5626]
Robert McQueen <robot101@debian.org>
parents: 5241
diff changeset
6220 /* test for gtkblist because crazy timeout means we can be called after the blist is gone */
6717daf94719 [gaim-migrate @ 5626]
Robert McQueen <robot101@debian.org>
parents: 5241
diff changeset
6221 if (gtkblist && new_selection != gtkblist->selected_node) {
6717daf94719 [gaim-migrate @ 5626]
Robert McQueen <robot101@debian.org>
parents: 5241
diff changeset
6222 old_selection = gtkblist->selected_node;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6223 gtkblist->selected_node = new_selection;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6224 if(new_selection)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6225 pidgin_blist_update(NULL, new_selection);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6226 if(old_selection)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6227 pidgin_blist_update(NULL, old_selection);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6228 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6229
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6230 return FALSE;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6231 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6232
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6233 static void pidgin_blist_selection_changed(GtkTreeSelection *selection, gpointer data)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6234 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6235 PurpleBlistNode *new_selection = NULL;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6236 GtkTreeIter iter;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6237
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6238 if(gtk_tree_selection_get_selected(selection, NULL, &iter)){
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6239 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6240 NODE_COLUMN, &new_selection, -1);
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6241 }
5254
6717daf94719 [gaim-migrate @ 5626]
Robert McQueen <robot101@debian.org>
parents: 5241
diff changeset
6242
17542
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6243 /* we set this up as a timeout, otherwise the blist flickers ...
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6244 * but we don't do it for groups, because it causes total bizarness -
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6245 * the previously selected buddy node might rendered at half height.
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6246 */
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6247 if ((new_selection != NULL) && PURPLE_BLIST_NODE_IS_GROUP(new_selection)) {
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6248 do_selection_changed(new_selection);
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6249 } else {
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6250 g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection);
6179ea7a4334 We use a timeout in our blist selection changed callback to prevent buddy
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17486
diff changeset
6251 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6252 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6253
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6254 static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTreeIter *iter)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6255 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6256 GtkTreeIter parent_iter, cur, *curptr = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6257 struct _pidgin_blist_node *gtknode = node->ui_data;
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6258 GtkTreePath *newpath;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6259
10515
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6260 if(!iter)
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6261 return FALSE;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6262
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6263 if(node->parent && !get_iter_from_node(node->parent, &parent_iter))
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6264 return FALSE;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6265
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6266 if(get_iter_from_node(node, &cur))
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6267 curptr = &cur;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6268
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6269 if(PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node)) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
6270 current_sort_method->func(node, list, parent_iter, curptr, iter);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6271 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
6272 sort_method_none(node, list, parent_iter, curptr, iter);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6273 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6274
10515
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6275 if(gtknode != NULL) {
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6276 gtk_tree_row_reference_free(gtknode->row);
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6277 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6278 pidgin_blist_new_node(node);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6279 gtknode = (struct _pidgin_blist_node *)node->ui_data;
10515
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6280 }
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6281
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6282 newpath = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel),
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6283 iter);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6284 gtknode->row =
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6285 gtk_tree_row_reference_new(GTK_TREE_MODEL(gtkblist->treemodel),
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6286 newpath);
11494
60bfb30f6cba [gaim-migrate @ 13738]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11490
diff changeset
6287
5256
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6288 gtk_tree_path_free(newpath);
9d90b7aaf38e [gaim-migrate @ 5628]
Oh-One-inator
parents: 5254
diff changeset
6289
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6290 if (!editing_blist)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6291 gtk_tree_store_set(gtkblist->treemodel, iter,
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6292 NODE_COLUMN, node,
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6293 -1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6294
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6295 if(node->parent) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6296 GtkTreePath *expand = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6297 struct _pidgin_blist_node *gtkparentnode = node->parent->ui_data;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6298
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6299 if(PURPLE_BLIST_NODE_IS_GROUP(node->parent)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6300 if(!purple_blist_node_get_bool(node->parent, "collapsed"))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6301 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6302 } else if(PURPLE_BLIST_NODE_IS_CONTACT(node->parent) &&
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6303 gtkparentnode->contact_expanded) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6304 expand = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &parent_iter);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6305 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6306 if(expand) {
7693
1f736efbd12d [gaim-migrate @ 8338]
Nathan Walp <nwalp@pidgin.im>
parents: 7662
diff changeset
6307 gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, FALSE);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6308 gtk_tree_path_free(expand);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6309 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6310 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6311
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6312 return TRUE;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6313 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6314
21669
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6315 static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group)
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6316 {
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6317 PurpleBlistNode *gnode, *cnode, *bnode;
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6318
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6319 gnode = (PurpleBlistNode *)group;
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6320 for(cnode = gnode->child; cnode; cnode = cnode->next) {
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6321 if(PURPLE_BLIST_NODE_IS_CONTACT(cnode)) {
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6322 for(bnode = cnode->child; bnode; bnode = bnode->next) {
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6323 PurpleBuddy *buddy = (PurpleBuddy *)bnode;
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6324 if (purple_account_is_connected(buddy->account) &&
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6325 purple_blist_node_get_bool(bnode, "show_offline"))
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6326 return TRUE;
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6327 }
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6328 }
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6329 }
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6330 return FALSE;
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6331 }
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6332
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6333 /* This version of pidgin_blist_update_group can take the original buddy or a
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6334 * group, but has much better algorithmic performance with a pre-known buddy.
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6335 */
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6336 static void pidgin_blist_update_group(PurpleBuddyList *list,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6337 PurpleBlistNode *node)
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6338 {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6339 gint count;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6340 PurpleGroup *group;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6341 PurpleBlistNode* gnode;
21669
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6342 gboolean show = FALSE, show_offline = FALSE;
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6343
13982
b1d1248b2789 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13951
diff changeset
6344 g_return_if_fail(node != NULL);
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6345
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6346 if (editing_blist)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6347 return;
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6348
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6349 if (PURPLE_BLIST_NODE_IS_GROUP(node))
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6350 gnode = node;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6351 else if (PURPLE_BLIST_NODE_IS_BUDDY(node))
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6352 gnode = node->parent->parent;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6353 else if (PURPLE_BLIST_NODE_IS_CONTACT(node) || PURPLE_BLIST_NODE_IS_CHAT(node))
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6354 gnode = node->parent;
13982
b1d1248b2789 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13951
diff changeset
6355 else
b1d1248b2789 [gaim-migrate @ 16432]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13951
diff changeset
6356 return;
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6357
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6358 group = (PurpleGroup*)gnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6359
21669
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6360 show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies");
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6361
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6362 if(show_offline)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6363 count = purple_blist_get_group_size(group, FALSE);
8203
23f66d41ff8c [gaim-migrate @ 8926]
Alex Smith <madalex@users.sourceforge.net>
parents: 8198
diff changeset
6364 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6365 count = purple_blist_get_group_online_count(group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6366
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6367 if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups"))
12341
a4b5f9eb0d83 [gaim-migrate @ 14645]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12338
diff changeset
6368 show = TRUE;
27252
c989a290be33 Patch to change around some logic that should fix missing buddies that are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27251
diff changeset
6369 else if (PURPLE_BLIST_NODE_IS_BUDDY(node) && buddy_is_displayable((PurpleBuddy*)node)) { /* Or chat? */
c989a290be33 Patch to change around some logic that should fix missing buddies that are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27251
diff changeset
6370 show = TRUE;
c989a290be33 Patch to change around some logic that should fix missing buddies that are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27251
diff changeset
6371 } else if (!show_offline) {
21669
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6372 show = pidgin_blist_group_has_show_offline_buddy(group);
078b500a766d Fix showing groups that contain offline buddies that have the "Show when
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
6373 }
12341
a4b5f9eb0d83 [gaim-migrate @ 14645]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12338
diff changeset
6374
a4b5f9eb0d83 [gaim-migrate @ 14645]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12338
diff changeset
6375 if (show) {
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6376 gchar *title;
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6377 gboolean biglist;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6378 GtkTreeIter iter;
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6379 GtkTreePath *path;
14722
6f567e2961ae [gaim-migrate @ 17406]
Etan Reisner <deryni@pidgin.im>
parents: 14682
diff changeset
6380 gboolean expanded;
23662
5128417a88fc fixed group coloring
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23661
diff changeset
6381 GdkColor *bgcolor = NULL;
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6382 GdkPixbuf *avatar = NULL;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6383 PidginBlistTheme *theme = NULL;
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
6384
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6385 if(!insert_node(list, gnode, &iter))
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6386 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6387
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6388 if ((theme = pidgin_blist_get_theme()) == NULL)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6389 bgcolor = NULL;
23662
5128417a88fc fixed group coloring
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23661
diff changeset
6390 else if (purple_blist_node_get_bool(gnode, "collapsed") || count <= 0)
5128417a88fc fixed group coloring
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23661
diff changeset
6391 bgcolor = pidgin_blist_theme_get_collapsed_background_color(theme);
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6392 else
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6393 bgcolor = pidgin_blist_theme_get_expanded_background_color(theme);
14501
17032cb417f9 [gaim-migrate @ 17153]
Gary Kramlich <grim@reaperworld.com>
parents: 14476
diff changeset
6394
17032cb417f9 [gaim-migrate @ 17153]
Gary Kramlich <grim@reaperworld.com>
parents: 14476
diff changeset
6395 path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
17032cb417f9 [gaim-migrate @ 17153]
Gary Kramlich <grim@reaperworld.com>
parents: 14476
diff changeset
6396 expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(gtkblist->treeview), path);
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6397 gtk_tree_path_free(path);
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6398
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
6399 title = pidgin_get_group_title(gnode, expanded);
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6400 biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6401
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6402 if (biglist) {
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6403 avatar = pidgin_blist_get_buddy_icon(gnode, TRUE, TRUE);
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6404 }
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
6405
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6406 gtk_tree_store_set(gtkblist->treemodel, &iter,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6407 STATUS_ICON_VISIBLE_COLUMN, FALSE,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6408 STATUS_ICON_COLUMN, NULL,
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6409 NAME_COLUMN, title,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6410 NODE_COLUMN, gnode,
23662
5128417a88fc fixed group coloring
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23661
diff changeset
6411 BGCOLOR_COLUMN, bgcolor,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
6412 GROUP_EXPANDER_COLUMN, TRUE,
16182
88b7040408c8 Set the disable maximize button hint on the blist. I couldn't find a window manager that supports this, but I bet win32 does.
Sean Egan <seanegan@pidgin.im>
parents: 16162
diff changeset
6413 GROUP_EXPANDER_VISIBLE_COLUMN, TRUE,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6414 CONTACT_EXPANDER_VISIBLE_COLUMN, FALSE,
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6415 BUDDY_ICON_COLUMN, avatar,
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6416 BUDDY_ICON_VISIBLE_COLUMN, biglist,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6417 IDLE_VISIBLE_COLUMN, FALSE,
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
6418 EMBLEM_VISIBLE_COLUMN, FALSE,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6419 -1);
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6420 g_free(title);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6421 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6422 pidgin_blist_hide_node(list, gnode, TRUE);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6423 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6424 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6425
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6426 static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6427 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6428 PurpleGroup *group;
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6429 gboolean selected;
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6430 char group_count[12] = "";
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6431 char *mark, *esc;
18372
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6432 PurpleBlistNode *selected_node = NULL;
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6433 GtkTreeIter iter;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6434 PidginThemeFont *pair;
26785
a4411d5d13d1 PidginBlistTheme now copies all its parameters instead of taking ownership.
Paul Aurich <darkrain42@pidgin.im>
parents: 26753
diff changeset
6435 gchar const *text_color, *text_font;
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
6436 PidginBlistTheme *theme;
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6437
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6438 group = (PurpleGroup*)gnode;
20655
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
6439
18372
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6440 if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview)), NULL, &iter)) {
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6441 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6442 NODE_COLUMN, &selected_node, -1);
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6443 }
9eee190f0584 Patch from SuperMMX to correct group colors. Fixes #1640
Sean Egan <seanegan@pidgin.im>
parents: 18347
diff changeset
6444 selected = (gnode == selected_node);
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6445
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6446 if (!expanded) {
27590
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6447 g_snprintf(group_count, sizeof(group_count), "%d/%d",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6448 purple_blist_get_group_online_count(group),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6449 purple_blist_get_group_size(group, FALSE));
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6450 }
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6451
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
6452 theme = pidgin_blist_get_theme();
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6453 if (theme == NULL)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6454 pair = NULL;
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6455 else if (expanded)
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6456 pair = pidgin_blist_theme_get_expanded_text_info(theme);
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6457 else
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6458 pair = pidgin_blist_theme_get_collapsed_text_info(theme);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6459
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6460
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6461 text_color = selected ? NULL : theme_font_get_color_default(pair, NULL);
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6462 text_font = theme_font_get_face_default(pair, "");
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6463
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6464 esc = g_markup_escape_text(group->name, -1);
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6465 if (text_color) {
27590
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6466 mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s%s%s</span>",
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6467 text_color, text_font,
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6468 esc ? esc : "",
27669
48863e05054b Apparently font_weight was only relatively recently added to pango, so use
Etan Reisner <deryni@pidgin.im>
parents: 27666
diff changeset
6469 !expanded ? " <span weight='light'>(</span>" : "",
27590
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6470 group_count,
27669
48863e05054b Apparently font_weight was only relatively recently added to pango, so use
Etan Reisner <deryni@pidgin.im>
parents: 27666
diff changeset
6471 !expanded ? "<span weight='light'>)</span>" : "");
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6472 } else {
27590
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6473 mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s%s%s</span>",
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6474 text_font, esc ? esc : "",
27669
48863e05054b Apparently font_weight was only relatively recently added to pango, so use
Etan Reisner <deryni@pidgin.im>
parents: 27666
diff changeset
6475 !expanded ? " <span weight='light'>(</span>" : "",
27590
08b862f1b4e6 De-emphasize the () around the collapsed group counts. I can't actually see
Etan Reisner <deryni@pidgin.im>
parents: 27589
diff changeset
6476 group_count,
27669
48863e05054b Apparently font_weight was only relatively recently added to pango, so use
Etan Reisner <deryni@pidgin.im>
parents: 27666
diff changeset
6477 !expanded ? "<span weight='light'>)</span>" : "");
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6478 }
15385
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6479
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6480 g_free(esc);
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6481 return mark;
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6482 }
d9ef6b4281fd [gaim-migrate @ 18114]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15380
diff changeset
6483
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6484 static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6485 {
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6486 PurplePresence *presence = purple_buddy_get_presence(buddy);
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6487 GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6488 GdkColor *color = NULL;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6489 char *mark;
11257
9743367c935e [gaim-migrate @ 13432]
Sean Egan <seanegan@pidgin.im>
parents: 11256
diff changeset
6490 char *idle = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6491 gboolean expanded = ((struct _pidgin_blist_node *)(node->parent->ui_data))->contact_expanded;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6492 gboolean selected = (gtkblist->selected_node == node);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6493 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6494 PidginBlistTheme *theme;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6495
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6496 if (editing_blist)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6497 return;
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6498
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6499 status = pidgin_blist_get_status_icon((PurpleBlistNode*)buddy,
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
6500 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6501
16950
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6502 /* Speed it up if we don't want buddy icons. */
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6503 if(biglist)
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6504 avatar = pidgin_blist_get_buddy_icon((PurpleBlistNode *)buddy, TRUE, TRUE);
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6505 else
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6506 avatar = NULL;
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6507
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
6508 if (!avatar) {
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
6509 g_object_ref(G_OBJECT(gtkblist->empty_avatar));
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
6510 avatar = gtkblist->empty_avatar;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6511 } else if ((!PURPLE_BUDDY_IS_ONLINE(buddy) || purple_presence_is_idle(presence))) {
29759
89d25a5185e9 Simplify: dest always equals src. No need to copy everything.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29749
diff changeset
6512 do_alphashift(avatar, 77);
15552
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
6513 }
e66ed02bc8c9 dim buddy icons on idle and offline. Still need to do status icons.
Sean Egan <seanegan@pidgin.im>
parents: 15551
diff changeset
6514
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6515 emblem = pidgin_blist_get_emblem((PurpleBlistNode*) buddy);
18274
b4eb1720fddf Show screenname instead of alias in conversation infopanes
Sean Egan <seanegan@pidgin.im>
parents: 18270
diff changeset
6516 mark = pidgin_blist_get_name_markup(buddy, selected, TRUE);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6517
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6518 theme = pidgin_blist_get_theme();
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6519
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
6520 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") &&
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6521 purple_presence_is_idle(presence) && !biglist)
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6522 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6523 time_t idle_secs = purple_presence_get_idle_time(presence);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6524
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6525 if (idle_secs > 0)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6526 {
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6527 PidginThemeFont *pair = NULL;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6528 const gchar *textcolor;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6529 time_t t;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6530 int ihrs, imin;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6531 time(&t);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6532
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6533 ihrs = (t - idle_secs) / 3600;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
6534 imin = ((t - idle_secs) / 60) % 60;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6535
28344
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
6536 if (selected)
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
6537 textcolor = NULL;
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
6538 else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL)
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6539 textcolor = pidgin_theme_font_get_color_describe(pair);
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
6540 else
28344
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
6541 /* If no theme them default to making idle buddy names grey */
7f13e35b4edb Make idle and offline buddy names and the idle time in the small list grey
Mark Doliner <markdoliner@pidgin.im>
parents: 28278
diff changeset
6542 textcolor = "dim grey";
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6543
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6544 if (textcolor) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6545 idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>",
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6546 textcolor, theme_font_get_face_default(pair, ""),
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6547 ihrs, imin);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6548 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6549 idle = g_strdup_printf("<span font_desc='%s'>%d:%02d</span>",
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
6550 theme_font_get_face_default(pair, ""),
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6551 ihrs, imin);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6552 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6553 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6554 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6555
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6556 prpl_icon = pidgin_create_prpl_icon(buddy->account, PIDGIN_PRPL_ICON_SMALL);
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6557
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6558 if (theme != NULL)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6559 color = pidgin_blist_theme_get_contact_color(theme);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6560
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6561 gtk_tree_store_set(gtkblist->treemodel, iter,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6562 STATUS_ICON_COLUMN, status,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6563 STATUS_ICON_VISIBLE_COLUMN, TRUE,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6564 NAME_COLUMN, mark,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6565 IDLE_COLUMN, idle,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6566 IDLE_VISIBLE_COLUMN, !biglist && idle,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6567 BUDDY_ICON_COLUMN, avatar,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6568 BUDDY_ICON_VISIBLE_COLUMN, biglist,
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
6569 EMBLEM_COLUMN, emblem,
20912
ef52cd4f525e We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <datallah@pidgin.im>
parents: 20885
diff changeset
6570 EMBLEM_VISIBLE_COLUMN, (emblem != NULL),
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6571 PROTOCOL_ICON_COLUMN, prpl_icon,
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6572 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"),
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6573 BGCOLOR_COLUMN, color,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6574 CONTACT_EXPANDER_COLUMN, NULL,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6575 CONTACT_EXPANDER_VISIBLE_COLUMN, expanded,
16182
88b7040408c8 Set the disable maximize button hint on the blist. I couldn't find a window manager that supports this, but I bet win32 does.
Sean Egan <seanegan@pidgin.im>
parents: 16162
diff changeset
6576 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6577 -1);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6578
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6579 g_free(mark);
12656
77de7b9c23bf [gaim-migrate @ 14999]
Mark Doliner <markdoliner@pidgin.im>
parents: 12649
diff changeset
6580 g_free(idle);
20912
ef52cd4f525e We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <datallah@pidgin.im>
parents: 20885
diff changeset
6581 if(emblem)
ef52cd4f525e We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <datallah@pidgin.im>
parents: 20885
diff changeset
6582 g_object_unref(emblem);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6583 if(status)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6584 g_object_unref(status);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6585 if(avatar)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6586 g_object_unref(avatar);
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6587 if(prpl_icon)
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6588 g_object_unref(prpl_icon);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6589 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6590
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6591 /* This is a variation on the original gtk_blist_update_contact. Here we
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6592 can know in advance which buddy has changed so we can just update that */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6593 static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6594 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6595 PurpleBlistNode *cnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6596 PurpleContact *contact;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6597 PurpleBuddy *buddy;
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
6598 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6599 struct _pidgin_blist_node *gtknode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6600
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6601 if (editing_blist)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6602 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6603
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6604 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6605 cnode = node->parent;
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6606 else
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6607 cnode = node;
14239
661d2bb9eb86 [gaim-migrate @ 16827]
Daniel Atallah <datallah@pidgin.im>
parents: 14230
diff changeset
6608
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6609 g_return_if_fail(PURPLE_BLIST_NODE_IS_CONTACT(cnode));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6610
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6611 /* First things first, update the group */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6612 if (PURPLE_BLIST_NODE_IS_BUDDY(node))
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6613 pidgin_blist_update_group(list, node);
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6614 else
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6615 pidgin_blist_update_group(list, cnode->parent);
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6616
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6617 contact = (PurpleContact*)cnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6618 buddy = purple_contact_get_priority_buddy(contact);
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
6619
11890
3126a9d03cbd [gaim-migrate @ 14181]
Nathan Walp <nwalp@pidgin.im>
parents: 11798
diff changeset
6620 if (buddy_is_displayable(buddy))
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9993
diff changeset
6621 {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6622 GtkTreeIter iter;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6623
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6624 if(!insert_node(list, cnode, &iter))
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6625 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6626
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6627 gtknode = (struct _pidgin_blist_node *)cnode->ui_data;
10515
865130ede44a [gaim-migrate @ 11816]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10510
diff changeset
6628
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6629 if(gtknode->contact_expanded) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6630 GdkPixbuf *status;
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6631 gchar *mark, *tmp;
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6632 const gchar *fg_color, *font;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6633 GdkColor *color = NULL;
28500
100254601c7c No need to call this twice.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 28380
diff changeset
6634 PidginBlistTheme *theme;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6635 PidginThemeFont *pair;
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
6636 gboolean selected = (gtkblist->selected_node == cnode);
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6637
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6638 mark = g_markup_escape_text(purple_contact_get_alias(contact), -1);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6639
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6640 theme = pidgin_blist_get_theme();
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6641 if (theme == NULL)
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6642 pair = NULL;
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6643 else {
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6644 pair = pidgin_blist_theme_get_contact_text_info(theme);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6645 color = pidgin_blist_theme_get_contact_color(theme);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6646 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6647
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6648 font = theme_font_get_face_default(pair, "");
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6649 fg_color = selected ? NULL : theme_font_get_color_default(pair, NULL);
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6650
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6651 if (fg_color) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6652 tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6653 font, fg_color, mark);
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6654 } else {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
6655 tmp = g_strdup_printf("<span font_desc='%s'>%s</span>", font,
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6656 mark);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6657 }
25861
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6658 g_free(mark);
291378dab55a This patch fixes a few string leaks (don't g_strdup the FontColorPair? values) and also fixes the bug where, with no theme, everyone on the buddy list is colored "dim grey" (chunks 2, 3, and 4 in the patch)
Paul Aurich <darkrain42@pidgin.im>
parents: 25855
diff changeset
6659 mark = tmp;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6660
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6661 status = pidgin_blist_get_status_icon(cnode,
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
6662 biglist? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6663
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6664 gtk_tree_store_set(gtkblist->treemodel, &iter,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6665 STATUS_ICON_COLUMN, status,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6666 STATUS_ICON_VISIBLE_COLUMN, TRUE,
14603
ad5c97d0d32b [gaim-migrate @ 17262]
Sean Egan <seanegan@pidgin.im>
parents: 14574
diff changeset
6667 NAME_COLUMN, mark,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6668 IDLE_COLUMN, NULL,
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6669 IDLE_VISIBLE_COLUMN, FALSE,
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6670 BGCOLOR_COLUMN, color,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6671 BUDDY_ICON_COLUMN, NULL,
14623
046a118a3b04 [gaim-migrate @ 17284]
Sean Egan <seanegan@pidgin.im>
parents: 14622
diff changeset
6672 CONTACT_EXPANDER_COLUMN, TRUE,
14471
edec88079240 [gaim-migrate @ 17117]
Sean Egan <seanegan@pidgin.im>
parents: 14456
diff changeset
6673 CONTACT_EXPANDER_VISIBLE_COLUMN, TRUE,
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
6674 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE,
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6675 -1);
14603
ad5c97d0d32b [gaim-migrate @ 17262]
Sean Egan <seanegan@pidgin.im>
parents: 14574
diff changeset
6676 g_free(mark);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6677 if(status)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6678 g_object_unref(status);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6679 } else {
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6680 buddy_node(buddy, &iter, cnode);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6681 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6682 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6683 pidgin_blist_hide_node(list, cnode, TRUE);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6684 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6685 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6686
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6687
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6688
19701
d5c5982757d5 Do not try to update a buddy in the buddylist when there's no buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19672
diff changeset
6689 static void pidgin_blist_update_buddy(PurpleBuddyList *list, PurpleBlistNode *node, gboolean status_change)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6690 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6691 PurpleBuddy *buddy;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6692 struct _pidgin_blist_node *gtkparentnode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6693
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6694 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6695
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6696 if (node->parent == NULL)
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
6697 return;
13951
4a340b669170 [gaim-migrate @ 16370]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 13942
diff changeset
6698
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6699 buddy = (PurpleBuddy*)node;
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
6700
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6701 /* First things first, update the contact */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6702 pidgin_blist_update_contact(list, node);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6703
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6704 gtkparentnode = (struct _pidgin_blist_node *)node->parent->ui_data;
10918
77103f5ad580 [gaim-migrate @ 12681]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10884
diff changeset
6705
12341
a4b5f9eb0d83 [gaim-migrate @ 14645]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12338
diff changeset
6706 if (gtkparentnode->contact_expanded && buddy_is_displayable(buddy))
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9993
diff changeset
6707 {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6708 GtkTreeIter iter;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6709
10006
800a81666868 [gaim-migrate @ 10923]
Dave West <kat@users.sourceforge.net>
parents: 9993
diff changeset
6710 if (!insert_node(list, node, &iter))
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6711 return;
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6712
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6713 buddy_node(buddy, &iter, node);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6714
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6715 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6716 pidgin_blist_hide_node(list, node, TRUE);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6717 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6718
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6719 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6720
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6721 static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *node)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6722 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6723 PurpleChat *chat;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6724
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6725 g_return_if_fail(PURPLE_BLIST_NODE_IS_CHAT(node));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6726
17720
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6727 if (editing_blist)
07050b4c845f Do not update the blist TreeStore if a node is currently being edited. Then, when the node is finished editing, force a refresh. Fixes #397 in which aliasing gets rudely cut off anytime the buddy list changes
Sean Egan <seanegan@pidgin.im>
parents: 17712
diff changeset
6728 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6729
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6730 /* First things first, update the group */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6731 pidgin_blist_update_group(list, node->parent);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6732
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6733 chat = (PurpleChat*)node;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6734
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6735 if(purple_account_is_connected(chat->account)) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6736 GtkTreeIter iter;
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6737 GdkPixbuf *status, *avatar, *emblem, *prpl_icon;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6738 const gchar *color, *font;
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6739 gchar *mark, *tmp;
16950
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6740 gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
6741 gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6742 PidginBlistNode *ui;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6743 PurpleConversation *conv;
26546
5a42c71a28c9 hidden is never initialized
Ka-Hing Cheung <khc@pidgin.im>
parents: 26540
diff changeset
6744 gboolean hidden = FALSE;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6745 GdkColor *bgcolor = NULL;
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6746 PidginThemeFont *pair;
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6747 PidginBlistTheme *theme;
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
6748 gboolean selected = (gtkblist->selected_node == node);
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6749 gboolean nick_said = FALSE;
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6750
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6751 if (!insert_node(list, node, &iter))
8252
15c6f400498a [gaim-migrate @ 8975]
Nathan Walp <nwalp@pidgin.im>
parents: 8235
diff changeset
6752 return;
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
6753
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6754 ui = node->ui_data;
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6755 conv = ui->conv.conv;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6756 if (conv && pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) {
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6757 hidden = (ui->conv.flags & PIDGIN_BLIST_NODE_HAS_PENDING_MESSAGE);
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6758 nick_said = (ui->conv.flags & PIDGIN_BLIST_CHAT_HAS_PENDING_MESSAGE_WITH_NICK);
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6759 }
19803
89bbabbe51a1 Add some stuff so that we don't have to traverse over a list to determine
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19774
diff changeset
6760
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6761 status = pidgin_blist_get_status_icon(node,
21773
b4650781e8bb Had this laying around. Weeks (months?) ago all the small listers and Hylke agreed that Small list looks better with conversation tab sized icons
Sean Egan <seanegan@pidgin.im>
parents: 21772
diff changeset
6762 biglist ? PIDGIN_STATUS_ICON_LARGE : PIDGIN_STATUS_ICON_SMALL);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6763 emblem = pidgin_blist_get_emblem(node);
16950
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6764
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6765 /* Speed it up if we don't want buddy icons. */
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6766 if(showicons)
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6767 avatar = pidgin_blist_get_buddy_icon(node, TRUE, FALSE);
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6768 else
53c231f0ab5c Speed up blist manipulations, by Scott Wolchok (EvilSporkMan)
Ethan Blanton <elb@pidgin.im>
parents: 16903
diff changeset
6769 avatar = NULL;
15490
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
6770
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6771 mark = g_markup_escape_text(purple_chat_get_name(chat), -1);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6772
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6773 theme = pidgin_blist_get_theme();
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6774
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6775 if (theme == NULL)
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6776 pair = NULL;
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6777 else if (nick_said)
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6778 pair = pidgin_blist_theme_get_unread_message_nick_said_text_info(theme);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6779 else if (hidden)
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6780 pair = pidgin_blist_theme_get_unread_message_text_info(theme);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
6781 else pair = pidgin_blist_theme_get_online_text_info(theme);
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6782
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6783
26803
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6784 font = theme_font_get_face_default(pair, "");
d48e945e622f Several changes:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26785
diff changeset
6785 if (selected || !(color = theme_font_get_color_default(pair, NULL)))
25863
b724badf6cd2 Adding the patch to extend the blist theme to allow coloring of chat nodes with unread messages mentioning your nick.
Paul Aurich <darkrain42@pidgin.im>
parents: 25861
diff changeset
6786 /* nick_said color is the same as gtkconv:tab-label-attention */
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6787 color = (nick_said ? "#006aff" : NULL);
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6788
26059
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6789 if (color) {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6790 tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6791 font, color, hidden ? "bold" : "normal", mark);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6792 } else {
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6793 tmp = g_strdup_printf("<span font_desc='%s' weight='%s'>%s</span>",
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6794 font, hidden ? "bold" : "normal", mark);
a02f9d608eaa Use text colours from the GTK+ theme instead of black when no buddy list theme
Marcus Lundblad <malu@pidgin.im>
parents: 25911
diff changeset
6795 }
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6796 g_free(mark);
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6797 mark = tmp;
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
6798
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6799 prpl_icon = pidgin_create_prpl_icon(chat->account, PIDGIN_PRPL_ICON_SMALL);
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6800
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6801 if (theme != NULL)
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6802 bgcolor = pidgin_blist_theme_get_contact_color(theme);
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6803
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
6804 gtk_tree_store_set(gtkblist->treemodel, &iter,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6805 STATUS_ICON_COLUMN, status,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6806 STATUS_ICON_VISIBLE_COLUMN, TRUE,
15490
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
6807 BUDDY_ICON_COLUMN, avatar ? avatar : gtkblist->empty_avatar,
23299
0eff43856b96 Add support for setting and removing custom buddy icons to contacts, chats,
Etan Reisner <deryni@pidgin.im>
parents: 23008
diff changeset
6808 BUDDY_ICON_VISIBLE_COLUMN, showicons,
19723
0e5c0170c280 Boldify the hidden chats in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19718
diff changeset
6809 EMBLEM_COLUMN, emblem,
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15509
diff changeset
6810 EMBLEM_VISIBLE_COLUMN, emblem != NULL,
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6811 PROTOCOL_ICON_COLUMN, prpl_icon,
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
6812 PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"),
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6813 NAME_COLUMN, mark,
23665
c9944e9b97e1 Added text and font coloring for buddies, contacts and chats, as well as fix a few small bugs
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23664
diff changeset
6814 BGCOLOR_COLUMN, bgcolor,
16182
88b7040408c8 Set the disable maximize button hint on the blist. I couldn't find a window manager that supports this, but I bet win32 does.
Sean Egan <seanegan@pidgin.im>
parents: 16162
diff changeset
6815 GROUP_EXPANDER_VISIBLE_COLUMN, FALSE,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6816 -1);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6817
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6818 g_free(mark);
20912
ef52cd4f525e We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <datallah@pidgin.im>
parents: 20885
diff changeset
6819 if(emblem)
ef52cd4f525e We need to unref the pixmaps after adding them to a list store.
Daniel Atallah <datallah@pidgin.im>
parents: 20885
diff changeset
6820 g_object_unref(emblem);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6821 if(status)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6822 g_object_unref(status);
15490
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
6823 if(avatar)
b96a1c748fca this would use the protocol icons in place of the buddy icon for chats,
Nathan Walp <nwalp@pidgin.im>
parents: 15479
diff changeset
6824 g_object_unref(avatar);
20954
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6825 if(prpl_icon)
ed97ffbed7af Prevent leakage of the prpl icon pixbuf because of an extra ref (it's bad enough that they aren't shared).
Daniel Atallah <datallah@pidgin.im>
parents: 20919
diff changeset
6826 g_object_unref(prpl_icon);
23666
a36697aac125 fixed some small font bugs, the coloring when selected, and a segfault
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23665
diff changeset
6827
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6828 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6829 pidgin_blist_hide_node(list, node, TRUE);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6830 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6831 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6832
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6833 static void pidgin_blist_update(PurpleBuddyList *list, PurpleBlistNode *node)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6834 {
15282
376816e3cb9e [gaim-migrate @ 18010]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15260
diff changeset
6835 if (list)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6836 gtkblist = PIDGIN_BLIST(list);
15306
b4bb51751de0 [gaim-migrate @ 18034]
Ethan Blanton <elb@pidgin.im>
parents: 15300
diff changeset
6837 if(!gtkblist || !gtkblist->treeview || !node)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6838 return;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6839
13196
b34319a69167 [gaim-migrate @ 15558]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13162
diff changeset
6840 if (node->ui_data == NULL)
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6841 pidgin_blist_new_node(node);
13196
b34319a69167 [gaim-migrate @ 15558]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13162
diff changeset
6842
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6843 switch(node->type) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6844 case PURPLE_BLIST_GROUP_NODE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6845 pidgin_blist_update_group(list, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6846 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6847 case PURPLE_BLIST_CONTACT_NODE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6848 pidgin_blist_update_contact(list, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6849 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6850 case PURPLE_BLIST_BUDDY_NODE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6851 pidgin_blist_update_buddy(list, node, TRUE);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6852 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6853 case PURPLE_BLIST_CHAT_NODE:
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6854 pidgin_blist_update_chat(list, node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6855 break;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6856 case PURPLE_BLIST_OTHER_NODE:
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6857 return;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6858 }
5234
8320a1cb0274 [gaim-migrate @ 5604]
Nathan Walp <nwalp@pidgin.im>
parents: 5228
diff changeset
6859
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6860 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6861
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6862 static void pidgin_blist_destroy(PurpleBuddyList *list)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6863 {
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
6864 PidginBuddyListPrivate *priv;
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
6865
27739
67040a12ab53 Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <darkrain42@pidgin.im>
parents: 27669
diff changeset
6866 if (!list || !list->ui_data)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6867 return;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6868
27752
9464619de670 Fix a reversed assertion.
Paul Aurich <darkrain42@pidgin.im>
parents: 27739
diff changeset
6869 g_return_if_fail(list->ui_data == gtkblist);
27739
67040a12ab53 Free the buddy list data some more at shutdown and some deprecations.
Paul Aurich <darkrain42@pidgin.im>
parents: 27669
diff changeset
6870
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6871 purple_signals_disconnect_by_handle(gtkblist);
8259
7ed91862683d [gaim-migrate @ 8982]
Christian Hammond <chipx86@chipx86.com>
parents: 8254
diff changeset
6872
29897
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
6873 if (gtkblist->headline_close)
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
6874 gdk_pixbuf_unref(gtkblist->headline_close);
5f4ff4e10c72 Maintain ABI compatibility by keeping headline_close a GdkPixbuf.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29896
diff changeset
6875
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6876 gtk_widget_destroy(gtkblist->window);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6877
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6878 pidgin_blist_tooltip_destroy();
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6879
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6880 if (gtkblist->refresh_timer)
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 26750
diff changeset
6881 purple_timeout_remove(gtkblist->refresh_timer);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6882 if (gtkblist->timeout)
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6883 g_source_remove(gtkblist->timeout);
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
6884 if (gtkblist->drag_timeout)
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
6885 g_source_remove(gtkblist->drag_timeout);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6886
13015
79ca1e6153bd [gaim-migrate @ 15368]
Mark Doliner <markdoliner@pidgin.im>
parents: 13001
diff changeset
6887 g_hash_table_destroy(gtkblist->connection_errors);
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6888 gtkblist->refresh_timer = 0;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6889 gtkblist->timeout = 0;
10354
997ffe337bad [gaim-migrate @ 11571]
Sean Egan <seanegan@pidgin.im>
parents: 10353
diff changeset
6890 gtkblist->drag_timeout = 0;
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6891 gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
22214
e8a9916cb99e It turns out the tree-models need to be unref'ed.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22213
diff changeset
6892 g_object_unref(G_OBJECT(gtkblist->treemodel));
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6893 gtkblist->treemodel = NULL;
5427
a45fa07ef20d [gaim-migrate @ 5806]
Mark Doliner <markdoliner@pidgin.im>
parents: 5422
diff changeset
6894 g_object_unref(G_OBJECT(gtkblist->ift));
15458
39c79dc7c965 A lot of status icon changes:
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
6895 g_object_unref(G_OBJECT(gtkblist->empty_avatar));
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
6896
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
6897 gdk_cursor_unref(gtkblist->hand_cursor);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
6898 gdk_cursor_unref(gtkblist->arrow_cursor);
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
6899 gtkblist->hand_cursor = NULL;
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
6900 gtkblist->arrow_cursor = NULL;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6901
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
6902 priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
27196
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
6903 if (priv->current_theme)
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
6904 g_object_unref(priv->current_theme);
21307
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
6905 g_free(priv);
63bb9b16256e Group all NAME_IN_USE errors together into one neat mini-dialog on the buddy
Will Thompson <resiak@pidgin.im>
parents: 21305
diff changeset
6906
15282
376816e3cb9e [gaim-migrate @ 18010]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15260
diff changeset
6907 g_free(gtkblist);
376816e3cb9e [gaim-migrate @ 18010]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15260
diff changeset
6908 accountmenu = NULL;
376816e3cb9e [gaim-migrate @ 18010]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15260
diff changeset
6909 gtkblist = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6910 purple_prefs_disconnect_by_handle(pidgin_blist_get_handle());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6911 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6912
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6913 static void pidgin_blist_set_visible(PurpleBuddyList *list, gboolean show)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6914 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6915 if (!(gtkblist && gtkblist->window))
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6916 return;
10325
9bb530214bae [gaim-migrate @ 11532]
Mark Doliner <markdoliner@pidgin.im>
parents: 10320
diff changeset
6917
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6918 if (show) {
15571
812bd6c69c8c dialogs
Sean Egan <seanegan@pidgin.im>
parents: 15570
diff changeset
6919 if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window))
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6920 purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist);
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6921 pidgin_blist_restore_position();
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6922 gtk_window_present(GTK_WINDOW(gtkblist->window));
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6923 } else {
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
6924 if(visibility_manager_count) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6925 purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
6926 gtk_widget_hide(gtkblist->window);
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
6927 } else {
12479
01ea9120820a [gaim-migrate @ 14790]
Casey Harkins <charkins@pidgin.im>
parents: 12478
diff changeset
6928 if (!GTK_WIDGET_VISIBLE(gtkblist->window))
01ea9120820a [gaim-migrate @ 14790]
Casey Harkins <charkins@pidgin.im>
parents: 12478
diff changeset
6929 gtk_widget_show(gtkblist->window);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
6930 gtk_window_iconify(GTK_WINDOW(gtkblist->window));
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
6931 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6932 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6933 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6934
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6935 static GList *
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6936 groups_tree(void)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6937 {
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6938 static GList *list = NULL;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6939 char *tmp2;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6940 PurpleGroup *g;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6941 PurpleBlistNode *gnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6942
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6943 g_list_free(list);
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6944 list = NULL;
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6945
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6946 if (purple_get_blist()->root == NULL)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6947 {
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6948 list = g_list_append(list, (gpointer)_("Buddies"));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6949 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6950 else
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6951 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6952 for (gnode = purple_get_blist()->root;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6953 gnode != NULL;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6954 gnode = gnode->next)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6955 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6956 if (PURPLE_BLIST_NODE_IS_GROUP(gnode))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6957 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6958 g = (PurpleGroup *)gnode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6959 tmp2 = g->name;
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6960 list = g_list_append(list, tmp2);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6961 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6962 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6963 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6964
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
6965 return list;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6966 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6967
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6968 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
6969 add_buddy_select_account_cb(GObject *w, PurpleAccount *account,
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6970 PidginAddBuddyData *data)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6971 {
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6972 PurpleConnection *pc = NULL;
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6973 PurplePlugin *prpl = NULL;
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6974 PurplePluginProtocolInfo *prpl_info = NULL;
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6975 gboolean invite_enabled = TRUE;
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6976
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6977 /* Save our account */
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
6978 data->rq_data.account = account;
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6979
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6980 if (account)
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6981 pc = purple_account_get_connection(account);
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6982 if (pc)
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6983 prpl = purple_connection_get_prpl(pc);
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6984 if (prpl)
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6985 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6986 if (prpl_info && !(prpl_info->options & OPT_PROTO_INVITE_MESSAGE))
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6987 invite_enabled = FALSE;
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6988
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
6989 gtk_widget_set_sensitive(data->entry_for_invite, invite_enabled);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6990 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6991
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6992 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6993 destroy_add_buddy_dialog_cb(GtkWidget *win, PidginAddBuddyData *data)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6994 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6995 g_free(data);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6996 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6997
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
6998 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
6999 add_buddy_cb(GtkWidget *w, int resp, PidginAddBuddyData *data)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7000 {
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7001 const char *grp, *who, *whoalias, *invite;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7002 PurpleAccount *account;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7003 PurpleGroup *g;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7004 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7005 PurpleConversation *c;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7006 PurpleBuddyIcon *icon;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7007
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7008 if (resp == GTK_RESPONSE_OK)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7009 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7010 who = gtk_entry_get_text(GTK_ENTRY(data->entry));
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
7011 grp = pidgin_text_combo_box_entry_get_text(data->combo);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7012 whoalias = gtk_entry_get_text(GTK_ENTRY(data->entry_for_alias));
9658
261c1ce87287 [gaim-migrate @ 10506]
Mark Doliner <markdoliner@pidgin.im>
parents: 9646
diff changeset
7013 if (*whoalias == '\0')
261c1ce87287 [gaim-migrate @ 10506]
Mark Doliner <markdoliner@pidgin.im>
parents: 9646
diff changeset
7014 whoalias = NULL;
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7015 invite = gtk_entry_get_text(GTK_ENTRY(data->entry_for_invite));
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7016 if (*invite == '\0')
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7017 invite = NULL;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7018
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7019 account = data->rq_data.account;
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7020
20388
a4b776cdf65b Patch from db42. Fixes #3191
Sean Egan <seanegan@pidgin.im>
parents: 20385
diff changeset
7021 g = NULL;
25507
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7022 if ((grp != NULL) && (*grp != '\0'))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7023 {
25507
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7024 if ((g = purple_find_group(grp)) == NULL)
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7025 {
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7026 g = purple_group_new(grp);
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7027 purple_blist_add_group(g, NULL);
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7028 }
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7029
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7030 b = purple_find_buddy_in_group(account, who, g);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7031 }
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7032 else if ((b = purple_find_buddy(account, who)) != NULL)
25507
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7033 {
26540
773ecd857e4b Remove an extra tab
Paul Aurich <darkrain42@pidgin.im>
parents: 26529
diff changeset
7034 g = purple_buddy_get_group(b);
25507
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7035 }
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7036
f69df2268d26 Fix situation in which group was not specified and
Paul Aurich <darkrain42@pidgin.im>
parents: 25502
diff changeset
7037 if (b == NULL)
24867
69105eeaf010 The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents: 24816
diff changeset
7038 {
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7039 b = purple_buddy_new(account, who, whoalias);
24867
69105eeaf010 The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents: 24816
diff changeset
7040 purple_blist_add_buddy(b, NULL, g, NULL);
69105eeaf010 The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents: 24816
diff changeset
7041 }
69105eeaf010 The Add Buddy dialog should not blindly create a duplicate buddy in a group
Paul Aurich <darkrain42@pidgin.im>
parents: 24816
diff changeset
7042
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7043 purple_account_add_buddy_with_invite(account, b, invite);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7044
23467
04b760aaa0bf Make the Add Buddy dialog cause the auto-personize prompt where appropriate.
Kevin Stange <kstange@pidgin.im>
parents: 23453
diff changeset
7045 /* Offer to merge people with the same alias. */
24192
f1ca2fb37c50 Path from Toby Schaffer to fix a null ptr deref when adding a buddy. Fixes #6821.
Daniel Atallah <datallah@pidgin.im>
parents: 23536
diff changeset
7046 if (whoalias != NULL && g != NULL)
23488
890b3242e780 silence a warning
Ka-Hing Cheung <khc@pidgin.im>
parents: 23487
diff changeset
7047 gtk_blist_auto_personize((PurpleBlistNode *)g, whoalias);
23467
04b760aaa0bf Make the Add Buddy dialog cause the auto-personize prompt where appropriate.
Kevin Stange <kstange@pidgin.im>
parents: 23453
diff changeset
7048
7887
4b2925a88897 [gaim-migrate @ 8545]
Mark Doliner <markdoliner@pidgin.im>
parents: 7879
diff changeset
7049 /*
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9236
diff changeset
7050 * XXX
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
7051 * It really seems like it would be better if the call to
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7052 * purple_account_add_buddy() and purple_conversation_update() were done in
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7053 * blist.c, possibly in the purple_blist_add_buddy() function. Maybe
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7054 * purple_account_add_buddy() should be renamed to
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7055 * purple_blist_add_new_buddy() or something, and have it call
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7056 * purple_blist_add_buddy() after it creates it. --Mark
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9236
diff changeset
7057 *
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9236
diff changeset
7058 * No that's not good. blist.c should only deal with adding nodes to the
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
7059 * local list. We need a new, non-gtk file that calls both
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7060 * purple_account_add_buddy and purple_blist_add_buddy().
11643
f04408721780 [gaim-migrate @ 13920]
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 11638
diff changeset
7061 * Or something. --Mark
7887
4b2925a88897 [gaim-migrate @ 8545]
Mark Doliner <markdoliner@pidgin.im>
parents: 7879
diff changeset
7062 */
4b2925a88897 [gaim-migrate @ 8545]
Mark Doliner <markdoliner@pidgin.im>
parents: 7879
diff changeset
7063
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7064 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, data->rq_data.account);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7065 if (c != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7066 icon = purple_conv_im_get_icon(PURPLE_CONV_IM(c));
13942
77bc33d555f8 [gaim-migrate @ 16358]
Mark Doliner <markdoliner@pidgin.im>
parents: 13834
diff changeset
7067 if (icon != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7068 purple_buddy_icon_update(icon);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7069 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7070 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7071
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7072 gtk_widget_destroy(data->rq_data.window);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7073 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7074
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7075 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7076 pidgin_blist_request_add_buddy(PurpleAccount *account, const char *username,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7077 const char *group, const char *alias)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7078 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7079 PidginAddBuddyData *data = g_new0(PidginAddBuddyData, 1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7080
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7081 if (account == NULL)
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7082 account = purple_connection_get_account(purple_connections_get_all()->data);
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7083
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7084 make_blist_request_dialog((PidginBlistRequestData *)data,
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7085 account,
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7086 _("Add Buddy"), "add_buddy",
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7087 _("Add a buddy.\n"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7088 G_CALLBACK(add_buddy_select_account_cb), NULL,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7089 G_CALLBACK(add_buddy_cb));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7090 gtk_dialog_add_buttons(GTK_DIALOG(data->rq_data.window),
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7091 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7092 GTK_STOCK_ADD, GTK_RESPONSE_OK,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7093 NULL);
27888
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
7094 gtk_dialog_set_default_response(GTK_DIALOG(data->rq_data.window),
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
7095 GTK_RESPONSE_OK);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7096
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7097 g_signal_connect(G_OBJECT(data->rq_data.window), "destroy",
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
7098 G_CALLBACK(destroy_add_buddy_dialog_cb), data);
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
7099
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7100 data->entry = gtk_entry_new();
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7101
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7102 pidgin_add_widget_to_vbox(data->rq_data.vbox, _("Buddy's _username:"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7103 data->rq_data.sg, data->entry, TRUE, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7104 gtk_widget_grab_focus(data->entry);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7105
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7106 if (username != NULL)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7107 gtk_entry_set_text(GTK_ENTRY(data->entry), username);
12337
1c9251d1f005 [gaim-migrate @ 14641]
Mark Doliner <markdoliner@pidgin.im>
parents: 12334
diff changeset
7108 else
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7109 gtk_dialog_set_response_sensitive(GTK_DIALOG(data->rq_data.window),
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
7110 GTK_RESPONSE_OK, FALSE);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7111
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7112 gtk_entry_set_activates_default (GTK_ENTRY(data->entry), TRUE);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7113
12337
1c9251d1f005 [gaim-migrate @ 14641]
Mark Doliner <markdoliner@pidgin.im>
parents: 12334
diff changeset
7114 g_signal_connect(G_OBJECT(data->entry), "changed",
22659
fab1d578a9be Change up the Add Budy dialog a little bit, this hopefully makes it a bit
Etan Reisner <deryni@pidgin.im>
parents: 22455
diff changeset
7115 G_CALLBACK(pidgin_set_sensitive_if_input),
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7116 data->rq_data.window);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7117
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7118 data->entry_for_alias = gtk_entry_new();
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7119 pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) A_lias:"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7120 data->rq_data.sg, data->entry_for_alias, TRUE,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7121 NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7122
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7123 if (alias != NULL)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7124 gtk_entry_set_text(GTK_ENTRY(data->entry_for_alias), alias);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7125
10734
4e49449724ec [gaim-migrate @ 12336]
Richard Laager <rlaager@pidgin.im>
parents: 10694
diff changeset
7126 if (username != NULL)
4e49449724ec [gaim-migrate @ 12336]
Richard Laager <rlaager@pidgin.im>
parents: 10694
diff changeset
7127 gtk_widget_grab_focus(GTK_WIDGET(data->entry_for_alias));
4e49449724ec [gaim-migrate @ 12336]
Richard Laager <rlaager@pidgin.im>
parents: 10694
diff changeset
7128
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7129 data->entry_for_invite = gtk_entry_new();
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7130 pidgin_add_widget_to_vbox(data->rq_data.vbox, _("(Optional) _Invite message:"),
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7131 data->rq_data.sg, data->entry_for_invite, TRUE,
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7132 NULL);
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7133
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
7134 data->combo = pidgin_text_combo_box_entry_new(group, groups_tree());
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7135 pidgin_add_widget_to_vbox(data->rq_data.vbox, _("Add buddy to _group:"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7136 data->rq_data.sg, data->combo, TRUE, NULL);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7137
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7138 gtk_widget_show_all(data->rq_data.window);
31600
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7139
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7140 /* Force update of invite message entry sensitivity */
2792671d12bc Show invite message entry in the Add Buddy dialog.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31565
diff changeset
7141 add_buddy_select_account_cb(NULL, account, data);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7142 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7143
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7144 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7145 add_chat_cb(GtkWidget *w, PidginAddChatData *data)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7146 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7147 GList *tmp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7148 PurpleChat *chat;
27673
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7149 GHashTable *components;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7150
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7151 components = g_hash_table_new_full(g_str_hash, g_str_equal,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7152 g_free, g_free);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7153
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7154 for (tmp = data->chat_data.entries; tmp; tmp = tmp->next)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7155 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7156 if (g_object_get_data(tmp->data, "is_spin"))
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7157 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7158 g_hash_table_replace(components,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7159 g_strdup(g_object_get_data(tmp->data, "identifier")),
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7160 g_strdup_printf("%d",
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7161 gtk_spin_button_get_value_as_int(tmp->data)));
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7162 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7163 else
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7164 {
27673
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7165 const char *value = gtk_entry_get_text(tmp->data);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7166
10475
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
7167 if (*value != '\0')
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
7168 g_hash_table_replace(components,
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
7169 g_strdup(g_object_get_data(tmp->data, "identifier")),
1b7fe16233f3 [gaim-migrate @ 11762]
Richard Laager <rlaager@pidgin.im>
parents: 10439
diff changeset
7170 g_strdup(value));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7171 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7172 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7173
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7174 chat = purple_chat_new(data->chat_data.rq_data.account,
27673
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7175 gtk_entry_get_text(GTK_ENTRY(data->alias_entry)),
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7176 components);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7177
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7178 if (chat != NULL) {
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7179 PurpleGroup *group;
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7180 const char *group_name;
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7181
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7182 group_name = pidgin_text_combo_box_entry_get_text(data->group_combo);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7183
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7184 group = NULL;
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7185 if ((group_name != NULL) && (*group_name != '\0') &&
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7186 ((group = purple_find_group(group_name)) == NULL))
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7187 {
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7188 group = purple_group_new(group_name);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7189 purple_blist_add_group(group, NULL);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7190 }
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7191
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7192 purple_blist_add_chat(chat, group, NULL);
27673
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7193
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7194 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->autojoin)))
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7195 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-autojoin", TRUE);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7196
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7197 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->persistent)))
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7198 purple_blist_node_set_bool((PurpleBlistNode*)chat, "gtk-persistent", TRUE);
f0bc9d8b2345 Close up scope on some variables and more correctly handle the
Etan Reisner <deryni@pidgin.im>
parents: 27669
diff changeset
7199 }
20339
352f79e0c384 Add checkboxes for 'auto-join' and 'persistent' in the add-chat dialog. Closes #2248.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20338
diff changeset
7200
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7201 gtk_widget_destroy(data->chat_data.rq_data.window);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7202 g_free(data->chat_data.default_chat_name);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7203 g_list_free(data->chat_data.entries);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7204 g_free(data);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7205 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7206
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7207 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7208 add_chat_resp_cb(GtkWidget *w, int resp, PidginAddChatData *data)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7209 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7210 if (resp == GTK_RESPONSE_OK)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7211 {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7212 add_chat_cb(NULL, data);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7213 }
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
7214 else if (resp == 1)
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
7215 {
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7216 pidgin_roomlist_dialog_show_with_account(data->chat_data.rq_data.account);
21788
2731d8d095dd Add 'Room List' buttons to Join Chat and Add Chat dialogs to ease access
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21775
diff changeset
7217 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7218 else
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7219 {
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7220 gtk_widget_destroy(data->chat_data.rq_data.window);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7221 g_free(data->chat_data.default_chat_name);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7222 g_list_free(data->chat_data.entries);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7223 g_free(data);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7224 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7225 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7226
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7227 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7228 pidgin_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group,
9754
3a17eee239b2 [gaim-migrate @ 10621]
Nathan Fredrickson <nathan@silverorange.com>
parents: 9753
diff changeset
7229 const char *alias, const char *name)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7230 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7231 PidginAddChatData *data;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
7232 GList *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7233 PurpleConnection *gc;
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7234 GtkBox *vbox;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7235
9812
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7236 if (account != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7237 gc = purple_account_get_connection(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7238
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7239 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat == NULL) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7240 purple_notify_error(gc, NULL, _("This protocol does not support chat rooms."), NULL);
9812
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7241 return;
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7242 }
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7243 } else {
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7244 /* Find an account with chat capabilities */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7245 for (l = purple_connections_get_all(); l != NULL; l = l->next) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7246 gc = (PurpleConnection *)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7247
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7248 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->join_chat != NULL) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7249 account = purple_connection_get_account(gc);
9812
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7250 break;
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7251 }
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7252 }
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7253
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7254 if (account == NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7255 purple_notify_error(NULL, NULL,
9812
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7256 _("You are not currently signed on with any "
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7257 "protocols that have the ability to chat."), NULL);
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7258 return;
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7259 }
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7260 }
26cf39e74774 [gaim-migrate @ 10683]
Mark Doliner <markdoliner@pidgin.im>
parents: 9811
diff changeset
7261
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7262 data = g_new0(PidginAddChatData, 1);
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7263 vbox = GTK_BOX(make_blist_request_dialog((PidginBlistRequestData *)data, account,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7264 _("Add Chat"), "add_chat",
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7265 _("Please enter an alias, and the appropriate information "
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7266 "about the chat you would like to add to your buddy list.\n"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7267 G_CALLBACK(chat_select_account_cb), chat_account_filter_func,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7268 G_CALLBACK(add_chat_resp_cb)));
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7269 gtk_dialog_add_buttons(GTK_DIALOG(data->chat_data.rq_data.window),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7270 _("Room List"), 1,
8975
729d25bd6c96 [gaim-migrate @ 9749]
Etan Reisner <deryni@pidgin.im>
parents: 8960
diff changeset
7271 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
729d25bd6c96 [gaim-migrate @ 9749]
Etan Reisner <deryni@pidgin.im>
parents: 8960
diff changeset
7272 GTK_STOCK_ADD, GTK_RESPONSE_OK,
729d25bd6c96 [gaim-migrate @ 9749]
Etan Reisner <deryni@pidgin.im>
parents: 8960
diff changeset
7273 NULL);
27888
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
7274 gtk_dialog_set_default_response(GTK_DIALOG(data->chat_data.rq_data.window),
cf7b08d09da6 Make OK default for Add Buddy, Add Chat, and Join Chat.
Paul Aurich <darkrain42@pidgin.im>
parents: 27830
diff changeset
7275 GTK_RESPONSE_OK);
8975
729d25bd6c96 [gaim-migrate @ 9749]
Etan Reisner <deryni@pidgin.im>
parents: 8960
diff changeset
7276
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7277 data->chat_data.default_chat_name = g_strdup(name);
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7278
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7279 rebuild_chat_entries((PidginChatData *)data, name);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7280
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7281 data->alias_entry = gtk_entry_new();
7859
b0f646df7125 [gaim-migrate @ 8513]
Mark Doliner <markdoliner@pidgin.im>
parents: 7856
diff changeset
7282 if (alias != NULL)
b0f646df7125 [gaim-migrate @ 8513]
Mark Doliner <markdoliner@pidgin.im>
parents: 7856
diff changeset
7283 gtk_entry_set_text(GTK_ENTRY(data->alias_entry), alias);
10311
2380cae46dbd [gaim-migrate @ 11505]
Andrew Hart <arhart@users.sourceforge.net>
parents: 10297
diff changeset
7284 gtk_entry_set_activates_default(GTK_ENTRY(data->alias_entry), TRUE);
22131
12b395dc8c59 Remove a lot of duplication from a lot of places. Closes #4558.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22123
diff changeset
7285
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7286 pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("A_lias:"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7287 data->chat_data.rq_data.sg, data->alias_entry,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7288 TRUE, NULL);
17400
f09b952bdbeb Closes #348 'Conversation -> Add (for Chats) should move focus to the alias field.'
Sean Egan <seanegan@pidgin.im>
parents: 17180
diff changeset
7289 if (name != NULL)
f09b952bdbeb Closes #348 'Conversation -> Add (for Chats) should move focus to the alias field.'
Sean Egan <seanegan@pidgin.im>
parents: 17180
diff changeset
7290 gtk_widget_grab_focus(data->alias_entry);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7291
20036
3bdbea94ad0c Part of #1332 to introduce pidgin_text_combo_box_new_entry and
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19859
diff changeset
7292 data->group_combo = pidgin_text_combo_box_entry_new(group ? group->name : NULL, groups_tree());
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7293 pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Group:"),
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7294 data->chat_data.rq_data.sg, data->group_combo,
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7295 TRUE, NULL);
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
7296
28061
91bc62188cb9 I think this is a little better.
Paul Aurich <darkrain42@pidgin.im>
parents: 27927
diff changeset
7297 data->autojoin = gtk_check_button_new_with_mnemonic(_("Auto_join when account connects."));
24573
0f50dfd6cb57 A little clearer description for an option.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24558
diff changeset
7298 data->persistent = gtk_check_button_new_with_mnemonic(_("_Remain in chat after window is closed."));
20339
352f79e0c384 Add checkboxes for 'auto-join' and 'persistent' in the add-chat dialog. Closes #2248.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20338
diff changeset
7299 gtk_box_pack_start(GTK_BOX(vbox), data->autojoin, FALSE, FALSE, 0);
352f79e0c384 Add checkboxes for 'auto-join' and 'persistent' in the add-chat dialog. Closes #2248.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20338
diff changeset
7300 gtk_box_pack_start(GTK_BOX(vbox), data->persistent, FALSE, FALSE, 0);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7301
27115
c9b55e795bf3 A patch from Gabriel Schulhof, updated to apply by Paul 'darkrain42' Aurich,
Gabriel Schulhof <nix@go-nix.ca>
parents: 26871
diff changeset
7302 gtk_widget_show_all(data->chat_data.rq_data.window);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7303 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7304
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7305 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7306 add_group_cb(PurpleConnection *gc, const char *group_name)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7307 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7308 PurpleGroup *group;
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9236
diff changeset
7309
12458
c1bb7ec2fb26 [gaim-migrate @ 14767]
Mark Doliner <markdoliner@pidgin.im>
parents: 12450
diff changeset
7310 if ((group_name == NULL) || (*group_name == '\0'))
c1bb7ec2fb26 [gaim-migrate @ 14767]
Mark Doliner <markdoliner@pidgin.im>
parents: 12450
diff changeset
7311 return;
c1bb7ec2fb26 [gaim-migrate @ 14767]
Mark Doliner <markdoliner@pidgin.im>
parents: 12450
diff changeset
7312
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7313 group = purple_group_new(group_name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7314 purple_blist_add_group(group, NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7315 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7316
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7317 static void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7318 pidgin_blist_request_add_group(void)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7319 {
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
7320 purple_request_input(NULL, _("Add Group"), NULL,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7321 _("Please enter the name of the group to be added."),
8697
c5e51aef2026 [gaim-migrate @ 9450]
Jon Oberheide
parents: 8592
diff changeset
7322 NULL, FALSE, FALSE, NULL,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7323 _("Add"), G_CALLBACK(add_group_cb),
16490
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16357
diff changeset
7324 _("Cancel"), NULL,
68c22924d66b Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents: 16357
diff changeset
7325 NULL, NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
7326 NULL);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7327 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7328
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7329 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7330 pidgin_blist_toggle_visibility()
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7331 {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7332 if (gtkblist && gtkblist->window) {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7333 if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
22996
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7334 /* make the buddy list visible if it is iconified or if it is
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7335 * obscured and not currently focused (the focus part ensures
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7336 * that we do something reasonable if the buddy list is obscured
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7337 * by a window set to always be on top), otherwise hide the
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7338 * buddy list
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7339 */
21113
09118de8bda6 Track the actual visibility for the buddy list (unobscured, partially and
Casey Harkins <charkins@pidgin.im>
parents: 21112
diff changeset
7340 purple_blist_set_visible(PIDGIN_WINDOW_ICONIFIED(gtkblist->window) ||
22996
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7341 ((gtk_blist_visibility != GDK_VISIBILITY_UNOBSCURED) &&
6b6ab005fa0f Make pidgin_blist_toggle_visibility() hide the buddy list when it is
Casey Harkins <charkins@pidgin.im>
parents: 22961
diff changeset
7342 !gtk_blist_focused));
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7343 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7344 purple_blist_set_visible(TRUE);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7345 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7346 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7347 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7348
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7349 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7350 pidgin_blist_visibility_manager_add()
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7351 {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7352 visibility_manager_count++;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7353 purple_debug_info("gtkblist", "added visibility manager: %d\n", visibility_manager_count);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7354 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7355
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7356 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7357 pidgin_blist_visibility_manager_remove()
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7358 {
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7359 if (visibility_manager_count)
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7360 visibility_manager_count--;
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7361 if (!visibility_manager_count)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7362 purple_blist_set_visible(TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7363 purple_debug_info("gtkblist", "removed visibility manager: %d\n", visibility_manager_count);
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7364 }
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7365
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7366 void pidgin_blist_add_alert(GtkWidget *widget)
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents: 15091
diff changeset
7367 {
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents: 15091
diff changeset
7368 gtk_container_add(GTK_CONTAINER(gtkblist->scrollbook), widget);
22429
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7369 set_urgent();
15094
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents: 15091
diff changeset
7370 }
7ebf5dd7d969 [gaim-migrate @ 17815]
Sean Egan <seanegan@pidgin.im>
parents: 15091
diff changeset
7371
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
7372 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7373 pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback,
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7374 gpointer user_data, GDestroyNotify destroy)
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7375 {
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7376 /* Destroy any existing headline first */
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7377 if (gtkblist->headline_destroy)
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7378 gtkblist->headline_destroy(gtkblist->headline_data);
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7379
15246
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
7380 gtk_label_set_markup(GTK_LABEL(gtkblist->headline_label), text);
9663c7183a75 [gaim-migrate @ 17973]
Sean Egan <seanegan@pidgin.im>
parents: 15243
diff changeset
7381 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkblist->headline_image), pixbuf);
15260
a9e3babd5686 [gaim-migrate @ 17988]
Daniel Atallah <datallah@pidgin.im>
parents: 15259
diff changeset
7382
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
7383 gtkblist->headline_callback = callback;
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
7384 gtkblist->headline_data = user_data;
15386
2cfff7893ed0 [gaim-migrate @ 18115]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15385
diff changeset
7385 gtkblist->headline_destroy = destroy;
20655
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
7386 if (text != NULL || pixbuf != NULL) {
22429
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7387 set_urgent();
20655
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
7388 gtk_widget_show_all(gtkblist->headline_hbox);
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
7389 } else {
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
7390 gtk_widget_hide(gtkblist->headline_hbox);
66f2dfd94949 Clear out the mail notifications for an account when we receive a notification of 0 emails.
Daniel Atallah <datallah@pidgin.im>
parents: 20615
diff changeset
7391 }
15243
87dafc34b920 [gaim-migrate @ 17968]
Sean Egan <seanegan@pidgin.im>
parents: 15209
diff changeset
7392 }
12016
0517ad5d0196 [gaim-migrate @ 14309]
Casey Harkins <charkins@pidgin.im>
parents: 11988
diff changeset
7393
22429
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7394
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7395 static void
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7396 set_urgent(void)
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7397 {
27830
0bafa85d427d Prevent a crash if a plugin set a mini-dialog during load. If that plugin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27752
diff changeset
7398 if (gtkblist->window && !GTK_WIDGET_HAS_FOCUS(gtkblist->window))
22429
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7399 pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE);
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7400 }
4cf69b06e373 Pull setting the urgent hint on the blist when it is unfocused into its own
Will Thompson <resiak@pidgin.im>
parents: 22428
diff changeset
7401
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7402 static PurpleBlistUiOps blist_ui_ops =
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7403 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7404 pidgin_blist_new_list,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7405 pidgin_blist_new_node,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7406 pidgin_blist_show,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7407 pidgin_blist_update,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7408 pidgin_blist_remove,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7409 pidgin_blist_destroy,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7410 pidgin_blist_set_visible,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7411 pidgin_blist_request_add_buddy,
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7412 pidgin_blist_request_add_chat,
16752
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16625
diff changeset
7413 pidgin_blist_request_add_group,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16625
diff changeset
7414 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16625
diff changeset
7415 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16625
diff changeset
7416 NULL,
e6bcb1628c57 Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents: 16625
diff changeset
7417 NULL
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7418 };
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7419
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7420
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7421 PurpleBlistUiOps *
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7422 pidgin_blist_get_ui_ops(void)
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7423 {
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7424 return &blist_ui_ops;
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7425 }
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7426
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7427 PidginBuddyList *pidgin_blist_get_default_gtk_blist()
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents: 10623
diff changeset
7428 {
15509
068826834dd2 re-indentation.
Nathan Walp <nwalp@pidgin.im>
parents: 15505
diff changeset
7429 return gtkblist;
10643
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents: 10623
diff changeset
7430 }
70f67d7c84c4 [gaim-migrate @ 12153]
Sean Egan <seanegan@pidgin.im>
parents: 10623
diff changeset
7431
30039
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7432 static gboolean autojoin_cb(PurpleConnection *gc, gpointer data)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7433 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7434 PurpleAccount *account = purple_connection_get_account(gc);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7435 PurpleBlistNode *gnode, *cnode;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7436 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7437 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7438 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7439 continue;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7440 for(cnode = gnode->child; cnode; cnode = cnode->next)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7441 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7442 PurpleChat *chat;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7443
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7444 if(!PURPLE_BLIST_NODE_IS_CHAT(cnode))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7445 continue;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7446
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7447 chat = (PurpleChat *)cnode;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7448
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7449 if(chat->account != account)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7450 continue;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7451
31469
675926579597 Stop trying to get "gtk-autojoin" as a string from chat rooms in the buddy
Mark Doliner <markdoliner@pidgin.im>
parents: 31304
diff changeset
7452 if (purple_blist_node_get_bool((PurpleBlistNode*)chat, "gtk-autojoin"))
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7453 serv_join_chat(gc, chat->components);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7454 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7455 }
30039
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7456
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7457 /* Stop processing; we handled the autojoins. */
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7458 return TRUE;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7459 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7460
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7461 void *
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7462 pidgin_blist_get_handle() {
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7463 static int handle;
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7464
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7465 return &handle;
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7466 }
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7467
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7468 static gboolean buddy_signonoff_timeout_cb(PurpleBuddy *buddy)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7469 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7470 struct _pidgin_blist_node *gtknode = ((PurpleBlistNode*)buddy)->ui_data;
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
7471
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
7472 gtknode->recent_signonoff = FALSE;
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
7473 gtknode->recent_signonoff_timer = 0;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7474
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7475 pidgin_blist_update(NULL, (PurpleBlistNode*)buddy);
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7476
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
7477 return FALSE;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7478 }
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7479
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7480 static void buddy_signonoff_cb(PurpleBuddy *buddy)
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7481 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7482 struct _pidgin_blist_node *gtknode;
11915
2803eadda83e [gaim-migrate @ 14206]
Nathan Walp <nwalp@pidgin.im>
parents: 11910
diff changeset
7483
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7484 if(!((PurpleBlistNode*)buddy)->ui_data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7485 pidgin_blist_new_node((PurpleBlistNode*)buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7486 }
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7487
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7488 gtknode = ((PurpleBlistNode*)buddy)->ui_data;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7489
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
7490 gtknode->recent_signonoff = TRUE;
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7491
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7492 if(gtknode->recent_signonoff_timer > 0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7493 purple_timeout_remove(gtknode->recent_signonoff_timer);
26753
a8dca8faae69 A patch from Arunan Balasubramaniam to use timeouts in seconds instead of
Arunan Balasubramaniam <foss@abala.me>
parents: 26750
diff changeset
7494 gtknode->recent_signonoff_timer = purple_timeout_add_seconds(10,
11910
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7495 (GSourceFunc)buddy_signonoff_timeout_cb, buddy);
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7496 }
4f8184cdcfff [gaim-migrate @ 14201]
Nathan Walp <nwalp@pidgin.im>
parents: 11906
diff changeset
7497
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
7498 void
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7499 pidgin_blist_set_theme(PidginBlistTheme *theme)
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7500 {
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7501 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
7502 PurpleBuddyList *list = purple_get_blist();
23661
6cfcb043b068 fixed segfault when changing blist themes, changed prefs to not rely on static iter, fixed a few leaks
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
7503
6cfcb043b068 fixed segfault when changing blist themes, changed prefs to not rely on static iter, fixed a few leaks
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
7504 if (theme != NULL)
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
7505 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme",
23657
41ba956129e0 flushed out blist themes a bit with lots of properties and get methods
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23656
diff changeset
7506 purple_theme_get_name(PURPLE_THEME(theme)));
25884
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
7507 else
c00e14c20165 * Alphabetize files in a few Makefile.am files
Mark Doliner <markdoliner@pidgin.im>
parents: 25883
diff changeset
7508 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
23661
6cfcb043b068 fixed segfault when changing blist themes, changed prefs to not rely on static iter, fixed a few leaks
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23660
diff changeset
7509
27196
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
7510 if (priv->current_theme)
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
7511 g_object_unref(priv->current_theme);
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
7512
e5e4a0f2eaa9 Buddy List needs to take a reference to the loaded theme. Fixes #8798.
Paul Aurich <darkrain42@pidgin.im>
parents: 27115
diff changeset
7513 priv->current_theme = theme ? g_object_ref(theme) : NULL;
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7514
23663
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
7515 pidgin_blist_build_layout(list);
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
7516
4ee0d825f3b3 Added layout capabilities to blist themes
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23662
diff changeset
7517 pidgin_blist_refresh(list);
23659
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7518 }
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7519
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7520
8251d0f67df5 restructured much of the loader and themes for the buddy list, along with a basic trial of group background
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23657
diff changeset
7521 PidginBlistTheme *
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7522 pidgin_blist_get_theme()
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7523 {
25888
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
7524 PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
d0fdd378a635 Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents: 25884
diff changeset
7525
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7526 return priv->current_theme;
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7527 }
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7528
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7529 void pidgin_blist_init(void)
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7530 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7531 void *gtk_blist_handle = pidgin_blist_get_handle();
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7532
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
7533 cached_emblems = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
7534
7731
7c3bb30a94c4 [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
7535 /* Initialize prefs */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7536 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/blist");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7537 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", TRUE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7538 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7539 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", TRUE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7540 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", FALSE);
19652
b0a14d85e2e5 Fixes #2146. Adds a Show Protocol Icon option and groups related Show menu items into a submenu. Patch from Justin Heiner
Sean Egan <seanegan@pidgin.im>
parents: 19543
diff changeset
7541 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", FALSE);
16162
5c3fb6457918 For a first time user, don't show the buddy list telling him to go to Accounts>Add/Edit, because Accounts->Add/Edit is already open with its own instructions. Show only one window with instructions and then present the Buddy List when you create your first account.
Sean Egan <seanegan@pidgin.im>
parents: 16160
diff changeset
7542 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE);
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7543 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7544 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/sort_type", "alphabetical");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7545 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/x", 0);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7546 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/y", 0);
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7547 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/width", 250); /* Golden ratio, baby */
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7548 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/height", 405); /* Golden ratio, baby */
24558
7d4379a9536e Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents: 24412
diff changeset
7549 #if !GTK_CHECK_VERSION(2,14,0)
7d4379a9536e Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents: 24412
diff changeset
7550 /* This pref is used in pidgintooltip.c. */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
7551 purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay", 500);
24558
7d4379a9536e Use GtkSetting to obtain the tooltip preferences instead of our own hidden
Richard Laager <rlaager@pidgin.im>
parents: 24412
diff changeset
7552 #endif
23656
d4acd51c1446 start of blist themes (themes have no effect on display)
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23536
diff changeset
7553 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
7731
7c3bb30a94c4 [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
7554
23660
8637cec033e1 Fixed gtkblist-loader_build to no longer assume xml file is correct, added set methods to gtkblist-theme
Justin Rodriguez <ffdragon@soc.pidgin.im>
parents: 23659
diff changeset
7555 purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_BLIST_THEME_LOADER, "type", "blist", NULL));
7731
7c3bb30a94c4 [gaim-migrate @ 8376]
Nathan Walp <nwalp@pidgin.im>
parents: 7723
diff changeset
7556
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7557 /* Register our signals */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7558 purple_signal_register(gtk_blist_handle, "gtkblist-hiding",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7559 purple_marshal_VOID__POINTER, NULL, 1,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7560 purple_value_new(PURPLE_TYPE_SUBTYPE,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7561 PURPLE_SUBTYPE_BLIST));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7562
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7563 purple_signal_register(gtk_blist_handle, "gtkblist-unhiding",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7564 purple_marshal_VOID__POINTER, NULL, 1,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7565 purple_value_new(PURPLE_TYPE_SUBTYPE,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7566 PURPLE_SUBTYPE_BLIST));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7567
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7568 purple_signal_register(gtk_blist_handle, "gtkblist-created",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7569 purple_marshal_VOID__POINTER, NULL, 1,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7570 purple_value_new(PURPLE_TYPE_SUBTYPE,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7571 PURPLE_SUBTYPE_BLIST));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7572
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7573 purple_signal_register(gtk_blist_handle, "drawing-tooltip",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7574 purple_marshal_VOID__POINTER_POINTER_UINT, NULL, 3,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7575 purple_value_new(PURPLE_TYPE_SUBTYPE,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7576 PURPLE_SUBTYPE_BLIST_NODE),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7577 purple_value_new_outgoing(PURPLE_TYPE_BOXED, "GString *"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7578 purple_value_new(PURPLE_TYPE_BOOLEAN));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7579
29919
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7580 purple_signal_register(gtk_blist_handle, "drawing-buddy",
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7581 purple_marshal_POINTER__POINTER,
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7582 purple_value_new(PURPLE_TYPE_STRING), 1,
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7583 purple_value_new(PURPLE_TYPE_SUBTYPE,
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7584 PURPLE_SUBTYPE_BLIST_BUDDY));
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7585
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7586 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on",
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7587 gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL);
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7588 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off",
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7589 gtk_blist_handle, PURPLE_CALLBACK(buddy_signonoff_cb), NULL);
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7590 purple_signal_connect(purple_blist_get_handle(), "buddy-privacy-changed",
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7591 gtk_blist_handle, PURPLE_CALLBACK(pidgin_blist_update_privacy_cb), NULL);
2e8615d80b0b Add a new signal, drawing-buddy, to allow plugins to handle markup in buddy
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29899
diff changeset
7592
30039
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7593 purple_signal_connect_priority(purple_connections_get_handle(), "autojoin",
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7594 gtk_blist_handle, PURPLE_CALLBACK(autojoin_cb),
9cd7672bae4f Add an autojoin connection signal
Richard Laager <rlaager@pidgin.im>
parents: 29935
diff changeset
7595 NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7596 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7597
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7598 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7599 pidgin_blist_uninit(void) {
21876
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
7600 g_hash_table_destroy(cached_emblems);
35db2a7af5f4 Add rudimentary caching for buddy list emblems. This avoids all the icons being duplicated in memory and constantly loaded. A more complete solution would be preferable, but I think this is better than nothing.
Daniel Atallah <datallah@pidgin.im>
parents: 21867
diff changeset
7601
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7602 purple_signals_unregister_by_instance(pidgin_blist_get_handle());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7603 purple_signals_disconnect_by_handle(pidgin_blist_get_handle());
8815
efd18a7c99dd [gaim-migrate @ 9577]
Gary Kramlich <grim@pidgin.im>
parents: 8710
diff changeset
7604 }
5228
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7605
83adaad2deb1 [gaim-migrate @ 5598]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7606 /*********************************************************************
9811
2cbca162a09f [gaim-migrate @ 10682]
Mark Doliner <markdoliner@pidgin.im>
parents: 9791
diff changeset
7607 * Buddy List sorting functions *
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7608 *********************************************************************/
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7609
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7610 GList *pidgin_blist_get_sort_methods()
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7611 {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7612 return pidgin_blist_sort_methods;
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7613 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7614
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7615 void pidgin_blist_sort_method_reg(const char *id, const char *name, pidgin_blist_sort_function func)
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7616 {
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7617 struct pidgin_blist_sort_method *method;
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7618
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7619 g_return_if_fail(id != NULL);
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7620 g_return_if_fail(name != NULL);
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7621 g_return_if_fail(func != NULL);
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7622
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7623 method = g_new0(struct pidgin_blist_sort_method, 1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7624 method->id = g_strdup(id);
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7625 method->name = g_strdup(name);
9775
e3a3555b0621 [gaim-migrate @ 10643]
Daniel Atallah <datallah@pidgin.im>
parents: 9774
diff changeset
7626 method->func = func;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7627 pidgin_blist_sort_methods = g_list_append(pidgin_blist_sort_methods, method);
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7628 pidgin_blist_update_sort_methods();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7629 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7630
22123
8d8d10cd6878 Fix an infinite loop. Fixes #4486.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22121
diff changeset
7631 void pidgin_blist_sort_method_unreg(const char *id)
8d8d10cd6878 Fix an infinite loop. Fixes #4486.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22121
diff changeset
7632 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7633 GList *l = pidgin_blist_sort_methods;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7634
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7635 g_return_if_fail(id != NULL);
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
7636
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7637 while(l) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7638 struct pidgin_blist_sort_method *method = l->data;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7639 if(!strcmp(method->id, id)) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7640 pidgin_blist_sort_methods = g_list_delete_link(pidgin_blist_sort_methods, l);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7641 g_free(method->id);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7642 g_free(method->name);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7643 g_free(method);
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7644 break;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7645 }
22123
8d8d10cd6878 Fix an infinite loop. Fixes #4486.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22121
diff changeset
7646 l = l->next;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7647 }
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7648 pidgin_blist_update_sort_methods();
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7649 }
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7650
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7651 void pidgin_blist_sort_method_set(const char *id){
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7652 GList *l = pidgin_blist_sort_methods;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7653
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7654 if(!id)
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7655 id = "none";
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7656
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7657 while (l && strcmp(((struct pidgin_blist_sort_method*)l->data)->id, id))
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7658 l = l->next;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7659
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7660 if (l) {
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7661 current_sort_method = l->data;
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7662 } else if (!current_sort_method) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7663 pidgin_blist_sort_method_set("none");
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7664 return;
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7665 }
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
7666 if (!strcmp(id, "none")) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7667 redo_buddy_list(purple_get_blist(), TRUE, FALSE);
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
7668 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7669 redo_buddy_list(purple_get_blist(), FALSE, FALSE);
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
7670 }
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7671 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7672
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7673 /******************************************
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7674 ** Sort Methods
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7675 ******************************************/
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7676
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7677 static void sort_method_none(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter parent_iter, GtkTreeIter *cur, GtkTreeIter *iter)
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7678 {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7679 PurpleBlistNode *sibling = node->prev;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7680 GtkTreeIter sibling_iter;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7681
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7682 if (cur != NULL) {
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7683 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7684 return;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7685 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7686
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7687 while (sibling && !get_iter_from_node(sibling, &sibling_iter)) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7688 sibling = sibling->prev;
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7689 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7690
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7691 gtk_tree_store_insert_after(gtkblist->treemodel, iter,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7692 node->parent ? &parent_iter : NULL,
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7693 sibling ? &sibling_iter : NULL);
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7694 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7695
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7696 static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7697 {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7698 GtkTreeIter more_z;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7699
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7700 const char *my_name;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7701
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7702 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7703 my_name = purple_contact_get_alias((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7704 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7705 my_name = purple_chat_get_name((PurpleChat*)node);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7706 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7707 sort_method_none(node, blist, groupiter, cur, iter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7708 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7709 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7710
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7711 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7712 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7713 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7714 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7715
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7716 do {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7717 PurpleBlistNode *n;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7718 const char *this_name;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7719 int cmp;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7720
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
7721 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &n, -1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7722
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7723 if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7724 this_name = purple_contact_get_alias((PurpleContact*)n);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7725 } else if(PURPLE_BLIST_NODE_IS_CHAT(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7726 this_name = purple_chat_get_name((PurpleChat*)n);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7727 } else {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7728 this_name = NULL;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7729 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7730
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7731 cmp = purple_utf8_strcasecmp(my_name, this_name);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7732
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7733 if(this_name && (cmp < 0 || (cmp == 0 && node < n))) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7734 if(cur) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7735 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7736 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7737 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7738 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7739 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7740 &groupiter, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7741 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7742 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7743 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7744 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7745
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7746 if(cur) {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7747 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7748 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7749 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7750 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7751 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7752 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7753 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7754 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7755
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7756 static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7757 {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7758 GtkTreeIter more_z;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7759
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7760 PurpleBuddy *my_buddy, *this_buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7761
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7762 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7763 my_buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7764 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7765 if (cur != NULL) {
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7766 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7767 return;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7768 }
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7769
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7770 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7771 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7772 } else {
31472
f01961dcfe05 Sort by status, then alphabetical. Sorting by status and then "none"
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31469
diff changeset
7773 sort_method_alphabetical(node, blist, groupiter, cur, iter);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7774 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7775 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7776
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7777
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7778 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7779 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7780 return;
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7781 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7782
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7783 do {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7784 PurpleBlistNode *n;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7785 gint name_cmp;
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7786 gint presence_cmp;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7787
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
7788 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &n, -1);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7789
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7790 if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7791 this_buddy = purple_contact_get_priority_buddy((PurpleContact*)n);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7792 } else {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7793 this_buddy = NULL;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7794 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7795
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7796 name_cmp = purple_utf8_strcasecmp(
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7797 purple_contact_get_alias(purple_buddy_get_contact(my_buddy)),
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7798 (this_buddy
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7799 ? purple_contact_get_alias(purple_buddy_get_contact(this_buddy))
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7800 : NULL));
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7801
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7802 presence_cmp = purple_presence_compare(
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7803 purple_buddy_get_presence(my_buddy),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7804 this_buddy ? purple_buddy_get_presence(this_buddy) : NULL);
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7805
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7806 if (this_buddy == NULL ||
10860
8f600347b9e4 [gaim-migrate @ 12543]
Palmer Cox <enix@users.sourceforge.net>
parents: 10850
diff changeset
7807 (presence_cmp < 0 ||
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7808 (presence_cmp == 0 &&
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7809 (name_cmp < 0 || (name_cmp == 0 && node < n)))))
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7810 {
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7811 if (cur != NULL)
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7812 {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7813 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7814 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7815 return;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7816 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7817 else
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7818 {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7819 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7820 &groupiter, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7821 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7822 }
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7823 }
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7824 }
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7825 while (gtk_tree_model_iter_next(GTK_TREE_MODEL(gtkblist->treemodel),
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9925
diff changeset
7826 &more_z));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7827
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7828 if (cur) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7829 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7830 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7831 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7832 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7833 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7834 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7835 }
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7836 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7837
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7838 static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter)
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7839 {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7840 GtkTreeIter more_z;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7841
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7842 int activity_score = 0, this_log_activity_score = 0;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7843 const char *buddy_name, *this_buddy_name;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7844
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7845 if(cur && (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(gtkblist->treemodel), &groupiter) == 1)) {
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7846 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7847 return;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7848 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7849
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7850 if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7851 PurpleBlistNode *n;
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7852 PurpleBuddy *buddy;
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7853 for (n = node->child; n; n = n->next) {
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7854 buddy = (PurpleBuddy*)n;
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7855 activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account);
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7856 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7857 buddy_name = purple_contact_get_alias((PurpleContact*)node);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7858 } else if(PURPLE_BLIST_NODE_IS_CHAT(node)) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7859 /* we don't have a reliable way of getting the log filename
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7860 * from the chat info in the blist, yet */
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7861 if (cur != NULL) {
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7862 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7863 return;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7864 }
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7865
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7866 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7867 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7868 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7869 sort_method_none(node, blist, groupiter, cur, iter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7870 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7871 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7872
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7873
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7874 if (!gtk_tree_model_iter_children(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, &groupiter)) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7875 gtk_tree_store_insert(gtkblist->treemodel, iter, &groupiter, 0);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7876 return;
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7877 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7878
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7879 do {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7880 PurpleBlistNode *n;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7881 PurpleBlistNode *n2;
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7882 PurpleBuddy *buddy;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7883 int cmp;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7884
31304
d71e83affd84 gtkblist: Fix a few memory leaks. Refs #13162.
Nader Morshed <morshed.nader@gmail.com>
parents: 31294
diff changeset
7885 gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &more_z, NODE_COLUMN, &n, -1);
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7886 this_log_activity_score = 0;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7887
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7888 if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7889 for (n2 = n->child; n2; n2 = n2->next) {
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7890 buddy = (PurpleBuddy*)n2;
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7891 this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account);
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7892 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7893 this_buddy_name = purple_contact_get_alias((PurpleContact*)n);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7894 } else {
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7895 this_buddy_name = NULL;
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7896 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7897
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7898 cmp = purple_utf8_strcasecmp(buddy_name, this_buddy_name);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7899
25883
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7900 if (!PURPLE_BLIST_NODE_IS_CONTACT(n) || activity_score > this_log_activity_score ||
059b74032730 A patch from Chris Connett to change the log size sorting method to weight
Richard Laager <rlaager@pidgin.im>
parents: 25876
diff changeset
7901 ((activity_score == this_log_activity_score) &&
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7902 (cmp < 0 || (cmp == 0 && node < n)))) {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7903 if (cur != NULL) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7904 gtk_tree_store_move_before(gtkblist->treemodel, cur, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7905 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7906 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7907 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7908 gtk_tree_store_insert_before(gtkblist->treemodel, iter,
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7909 &groupiter, &more_z);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7910 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7911 }
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7912 }
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7913 } while (gtk_tree_model_iter_next (GTK_TREE_MODEL(gtkblist->treemodel), &more_z));
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7914
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7915 if (cur != NULL) {
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7916 gtk_tree_store_move_before(gtkblist->treemodel, cur, NULL);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7917 *iter = *cur;
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7918 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7919 } else {
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7920 gtk_tree_store_append(gtkblist->treemodel, iter, &groupiter);
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
7921 return;
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7922 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7923 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7924
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7925 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7926 plugin_act(GtkObject *obj, PurplePluginAction *pam)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7927 {
13197
734f8ef469b8 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13196
diff changeset
7928 if (pam && pam->callback)
10352
802e7ab5b838 [gaim-migrate @ 11569]
Mark Doliner <markdoliner@pidgin.im>
parents: 10351
diff changeset
7929 pam->callback(pam);
5422
066c98fd4fa8 [gaim-migrate @ 5801]
Sean Egan <seanegan@pidgin.im>
parents: 5419
diff changeset
7930 }
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7931
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
7932 static void
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
7933 build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin,
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
7934 gpointer context)
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
7935 {
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7936 GtkWidget *menuitem;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7937 PurplePluginAction *action = NULL;
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7938 GList *actions, *l;
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7939
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
7940 actions = PURPLE_PLUGIN_ACTIONS(plugin, context);
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7941
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7942 for (l = actions; l != NULL; l = l->next)
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7943 {
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7944 if (l->data)
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7945 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7946 action = (PurplePluginAction *) l->data;
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7947 action->plugin = plugin;
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
7948 action->context = context;
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7949
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7950 menuitem = gtk_menu_item_new_with_label(action->label);
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7951 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7952
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7953 g_signal_connect(G_OBJECT(menuitem), "activate",
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7954 G_CALLBACK(plugin_act), action);
13197
734f8ef469b8 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13196
diff changeset
7955 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
734f8ef469b8 [gaim-migrate @ 15559]
Gary Kramlich <grim@reaperworld.com>
parents: 13196
diff changeset
7956 action,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7957 (GDestroyNotify)purple_plugin_action_free);
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7958 gtk_widget_show(menuitem);
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7959 }
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7960 else
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
7961 pidgin_separator(menu);
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7962 }
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 9013
diff changeset
7963
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
7964 g_list_free(actions);
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
7965 }
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
7966
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7967 static void
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7968 modify_account_cb(GtkWidget *widget, gpointer data)
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7969 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7970 pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, data);
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7971 }
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7972
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7973 static void
12330
ad4b7fa046c5 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
7974 enable_account_cb(GtkCheckMenuItem *widget, gpointer data)
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7975 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7976 PurpleAccount *account = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7977 const PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7978
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7979 saved_status = purple_savedstatus_get_current();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7980 purple_savedstatus_activate_for_account(saved_status, account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7981
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7982 purple_account_set_enabled(account, PIDGIN_UI, TRUE);
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7983 }
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7984
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7985 static void
12330
ad4b7fa046c5 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
7986 disable_account_cb(GtkCheckMenuItem *widget, gpointer data)
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7987 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7988 PurpleAccount *account = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7989
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
7990 purple_account_set_enabled(account, PIDGIN_UI, FALSE);
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7991 }
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
7992
29873
268962cb868f Added ability to set the mood on all mood-supporting accounts at once (the
Marcus Lundblad <malu@pidgin.im>
parents: 29816
diff changeset
7993
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
7994
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7995 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
7996 pidgin_blist_update_accounts_menu(void)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
7997 {
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
7998 GtkWidget *menuitem = NULL, *submenu = NULL;
15063
f049d0515fd8 [gaim-migrate @ 17781]
Richard Laager <rlaager@pidgin.im>
parents: 15058
diff changeset
7999 GtkAccelGroup *accel_group = NULL;
18122
9bf9970c1b6a disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents: 18121
diff changeset
8000 GList *l = NULL, *accounts = NULL;
12330
ad4b7fa046c5 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
8001 gboolean disabled_accounts = FALSE;
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8002 gboolean enabled_accounts = FALSE;
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8003
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8004 if (accountmenu == NULL)
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
8005 return;
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
8006
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8007 /* Clear the old Accounts menu */
18944
3d27499bb0d5 Fix memory leak by freeing the list returned by gtk_container_get_children.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18621
diff changeset
8008 for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) {
12348
847b6a8f2d07 [gaim-migrate @ 14652]
Etan Reisner <deryni@pidgin.im>
parents: 12341
diff changeset
8009 menuitem = l->data;
847b6a8f2d07 [gaim-migrate @ 14652]
Etan Reisner <deryni@pidgin.im>
parents: 12341
diff changeset
8010
23453
92539a16ec2a Bring back the unintentionally hidden 'Manage Accounts' dialog. Thanks to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23450
diff changeset
8011 if (menuitem != gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts/Manage Accounts")))
15050
f99d78ac44e9 [gaim-migrate @ 17767]
Daniel Atallah <datallah@pidgin.im>
parents: 14914
diff changeset
8012 gtk_widget_destroy(menuitem);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
8013 }
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
8014
24238
c7b89f7af693 disapproval of revision '376c2d213eb19f5b327affc2da40347a49f28906'
Kevin Stange <kstange@pidgin.im>
parents: 24234
diff changeset
8015 for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) {
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8016 char *buf = NULL;
23487
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8017 GtkWidget *image = NULL;
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8018 PurpleAccount *account = NULL;
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8019 GdkPixbuf *pixbuf = NULL;
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8020
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8021 account = accounts->data;
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8022
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8023 if(!purple_account_get_enabled(account, PIDGIN_UI)) {
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8024 if (!disabled_accounts) {
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8025 menuitem = gtk_menu_item_new_with_label(_("Enable Account"));
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8026 gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8027
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8028 submenu = gtk_menu_new();
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8029 gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8030 gtk_menu_set_accel_path(GTK_MENU(submenu), N_("<PurpleMain>/Accounts/Enable Account"));
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8031 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8032
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8033 disabled_accounts = TRUE;
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8034 }
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8035
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8036 buf = g_strconcat(purple_account_get_username(account), " (",
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8037 purple_account_get_protocol_name(account), ")", NULL);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8038 menuitem = gtk_image_menu_item_new_with_label(buf);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8039 g_free(buf);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8040 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8041 if (pixbuf != NULL)
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8042 {
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8043 if (!purple_account_is_connected(account))
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8044 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8045 image = gtk_image_new_from_pixbuf(pixbuf);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8046 g_object_unref(G_OBJECT(pixbuf));
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8047 gtk_widget_show(image);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8048 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8049 }
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8050 g_signal_connect(G_OBJECT(menuitem), "activate",
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8051 G_CALLBACK(enable_account_cb), account);
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8052 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8053 } else {
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8054 enabled_accounts = TRUE;
23487
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8055 }
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8056 }
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8057
27469
7f92b0889c49 Show the 'Enable Accounts' menu when all accounts are disabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27252
diff changeset
8058 if (!enabled_accounts) {
7f92b0889c49 Show the 'Enable Accounts' menu when all accounts are disabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27252
diff changeset
8059 gtk_widget_show_all(accountmenu);
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8060 return;
27469
7f92b0889c49 Show the 'Enable Accounts' menu when all accounts are disabled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27252
diff changeset
8061 }
23487
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8062
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8063 pidgin_separator(accountmenu);
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8064 accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu));
23487
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8065
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8066 for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) {
f9569c3c9b7b Moved "Enable Account" to the top with "Manage Accounts", and always put a
Ka-Hing Cheung <khc@pidgin.im>
parents: 23467
diff changeset
8067 char *buf = NULL;
15063
f049d0515fd8 [gaim-migrate @ 17781]
Richard Laager <rlaager@pidgin.im>
parents: 15058
diff changeset
8068 char *accel_path_buf = NULL;
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8069 GtkWidget *image = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8070 PurpleConnection *gc = NULL;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8071 PurpleAccount *account = NULL;
13091
b5ed878998dd [gaim-migrate @ 15452]
Mark Doliner <markdoliner@pidgin.im>
parents: 13049
diff changeset
8072 GdkPixbuf *pixbuf = NULL;
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
8073 PurplePlugin *plugin = NULL;
29404
f51e82b8b886 Made it compile again.
Marcus Lundblad <malu@pidgin.im>
parents: 29304
diff changeset
8074 PurplePluginProtocolInfo *prpl_info;
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8075
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8076 account = accounts->data;
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8077
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8078 if (!purple_account_get_enabled(account, PIDGIN_UI))
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8079 continue;
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8080
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8081 buf = g_strconcat(purple_account_get_username(account), " (",
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8082 purple_account_get_protocol_name(account), ")", NULL);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8083 menuitem = gtk_image_menu_item_new_with_label(buf);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8084 accel_path_buf = g_strconcat(N_("<PurpleMain>/Accounts/"), buf, NULL);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8085 g_free(buf);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8086 pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8087 if (pixbuf != NULL) {
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8088 if (!purple_account_is_connected(account))
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8089 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf,
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8090 0.0, FALSE);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8091 image = gtk_image_new_from_pixbuf(pixbuf);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8092 g_object_unref(G_OBJECT(pixbuf));
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8093 gtk_widget_show(image);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8094 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8095 }
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8096 gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8097
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8098 submenu = gtk_menu_new();
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8099 gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8100 gtk_menu_set_accel_path(GTK_MENU(submenu), accel_path_buf);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8101 g_free(accel_path_buf);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8102 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8103
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8104
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8105 menuitem = gtk_menu_item_new_with_mnemonic(_("_Edit Account"));
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8106 g_signal_connect(G_OBJECT(menuitem), "activate",
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8107 G_CALLBACK(modify_account_cb), account);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8108 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8109
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8110 pidgin_separator(submenu);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8111
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8112 gc = purple_account_get_connection(account);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8113 plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL;
29408
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8114 prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30733
diff changeset
8115
29408
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8116 if (prpl_info &&
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8117 (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) ||
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8118 PURPLE_PLUGIN_HAS_ACTIONS(plugin))) {
29803
278d6c622f5d Allow a PRPL to have get_moods return NULL to disable mood setting.
Marcus Lundblad <malu@pidgin.im>
parents: 29788
diff changeset
8119 if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) &&
29814
ad92005bcdcf Added PurpleConnection flags to determine support for moods and mood messages.
Marcus Lundblad <malu@pidgin.im>
parents: 29803
diff changeset
8120 gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) {
29923
7322b735ae61 Avoid needlessly iterating over a list, and add some notes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29922
diff changeset
8121
7322b735ae61 Avoid needlessly iterating over a list, and add some notes.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29922
diff changeset
8122 if (purple_account_get_status(account, "mood")) {
29408
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8123 menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood..."));
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8124 g_signal_connect(G_OBJECT(menuitem), "activate",
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8125 G_CALLBACK(set_mood_cb), account);
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8126 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8127 }
12330
ad4b7fa046c5 [gaim-migrate @ 14634]
Nathan Walp <nwalp@pidgin.im>
parents: 12328
diff changeset
8128 }
29408
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8129 if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
8130 build_plugin_actions(submenu, plugin, gc);
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8131 }
29408
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8132 } else {
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8133 menuitem = gtk_menu_item_new_with_label(_("No actions available"));
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8134 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
a1d7b09414fa Resurrect the PRPL actions to show up in the account submenu
Marcus Lundblad <malu@pidgin.im>
parents: 29404
diff changeset
8135 gtk_widget_set_sensitive(menuitem, FALSE);
12296
488cc1a84a50 [gaim-migrate @ 14600]
Etan Reisner <deryni@pidgin.im>
parents: 12279
diff changeset
8136 }
25320
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8137
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8138 pidgin_separator(submenu);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8139
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8140 menuitem = gtk_menu_item_new_with_mnemonic(_("_Disable"));
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8141 g_signal_connect(G_OBJECT(menuitem), "activate",
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8142 G_CALLBACK(disable_account_cb), account);
ef060ec45739 Do not show a separator after 'Account -> Enable Account' when not required.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 25300
diff changeset
8143 gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem);
25584
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 25457
diff changeset
8144 }
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 25457
diff changeset
8145 gtk_widget_show_all(accountmenu);
7620
18cf42f8955c [gaim-migrate @ 8244]
Sean Egan <seanegan@pidgin.im>
parents: 5516
diff changeset
8146 }
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8147
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8148 static GList *plugin_submenus = NULL;
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8149
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8150 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8151 pidgin_blist_update_plugin_actions(void)
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8152 {
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8153 GtkWidget *menuitem, *submenu;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8154 PurplePlugin *plugin = NULL;
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8155 GList *l;
12464
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8156 GtkAccelGroup *accel_group;
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8157
11742
ddba58b25836 [gaim-migrate @ 14033]
Sean Egan <seanegan@pidgin.im>
parents: 11740
diff changeset
8158 GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools"));
ddba58b25836 [gaim-migrate @ 14033]
Sean Egan <seanegan@pidgin.im>
parents: 11740
diff changeset
8159
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8160 g_return_if_fail(pluginmenu != NULL);
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8161
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8162 /* Remove old plugin action submenus from the Tools menu */
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8163 for (l = plugin_submenus; l; l = l->next)
15057
909e807e3070 [gaim-migrate @ 17774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 15051
diff changeset
8164 gtk_widget_destroy(GTK_WIDGET(l->data));
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8165 g_list_free(plugin_submenus);
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8166 plugin_submenus = NULL;
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8167
12464
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8168 accel_group = gtk_menu_get_accel_group(GTK_MENU(pluginmenu));
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8169
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8170 /* Add a submenu for each plugin with custom actions */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8171 for (l = purple_plugins_get_loaded(); l; l = l->next) {
12464
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8172 char *path;
11923
a492ccce1a12 [gaim-migrate @ 14214]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
8173
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8174 plugin = (PurplePlugin *) l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8175
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8176 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
11742
ddba58b25836 [gaim-migrate @ 14033]
Sean Egan <seanegan@pidgin.im>
parents: 11740
diff changeset
8177 continue;
ddba58b25836 [gaim-migrate @ 14033]
Sean Egan <seanegan@pidgin.im>
parents: 11740
diff changeset
8178
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
8179 if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
11742
ddba58b25836 [gaim-migrate @ 14033]
Sean Egan <seanegan@pidgin.im>
parents: 11740
diff changeset
8180 continue;
9019
b9a333b36763 [gaim-migrate @ 9795]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
8181
13337
1a425a37dcf7 [gaim-migrate @ 15706]
Richard Laager <rlaager@pidgin.im>
parents: 13316
diff changeset
8182 menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name));
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8183 gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem);
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8184
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8185 plugin_submenus = g_list_append(plugin_submenus, menuitem);
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8186
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8187 submenu = gtk_menu_new();
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8188 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
14097
0c340861ab79 [gaim-migrate @ 16638]
Mark Doliner <markdoliner@pidgin.im>
parents: 14030
diff changeset
8189
12464
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8190 gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group);
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8191 path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name);
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8192 gtk_menu_set_accel_path(GTK_MENU(submenu), path);
bfe63ab6ebcf [gaim-migrate @ 14774]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12461
diff changeset
8193 g_free(path);
12333
8e39e95c81b6 [gaim-migrate @ 14637]
Mark Doliner <markdoliner@pidgin.im>
parents: 12330
diff changeset
8194
16040
d213ae510895 sf patch #1689182, from Will Thompson
Mark Doliner <markdoliner@pidgin.im>
parents: 15982
diff changeset
8195 build_plugin_actions(submenu, plugin, NULL);
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8196 }
25584
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 25457
diff changeset
8197 gtk_widget_show_all(pluginmenu);
8986
30ba617356bb [gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents: 8975
diff changeset
8198 }
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8199
12246
7af1ef3b1cc4 [gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents: 12240
diff changeset
8200 static void
7af1ef3b1cc4 [gaim-migrate @ 14548]
Mark Doliner <markdoliner@pidgin.im>
parents: 12240
diff changeset
8201 sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id)
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8202 {
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8203 if (gtk_check_menu_item_get_active(checkmenuitem))
11923
a492ccce1a12 [gaim-migrate @ 14214]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
8204 {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8205 pidgin_set_cursor(gtkblist->window, GDK_WATCH);
14200
799dfae258cf [gaim-migrate @ 16780]
Aaron Sheldon <aaronsheldon@users.sourceforge.net>
parents: 14199
diff changeset
8206 /* This is redundant. I think. */
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8207 /* pidgin_blist_sort_method_set(id); */
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
8208 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", id);
12413
ce06aa90beee [gaim-migrate @ 14720]
Richard Laager <rlaager@pidgin.im>
parents: 12368
diff changeset
8209
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8210 pidgin_clear_cursor(gtkblist->window);
11923
a492ccce1a12 [gaim-migrate @ 14214]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
8211 }
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8212 }
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8213
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8214 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8215 pidgin_blist_update_sort_methods(void)
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8216 {
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8217 GtkWidget *menuitem = NULL, *activeitem = NULL;
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8218 PidginBlistSortMethod *method = NULL;
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8219 GList *l;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8220 GSList *sl = NULL;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8221 GtkWidget *sortmenu;
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 16071
diff changeset
8222 const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type");
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8223
15286
ecc4149f47fb [gaim-migrate @ 18014]
Mark Doliner <markdoliner@pidgin.im>
parents: 15284
diff changeset
8224 if ((gtkblist == NULL) || (gtkblist->ift == NULL))
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8225 return;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8226
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
8227 g_return_if_fail(m != NULL);
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
8228
11798
481b46227443 [gaim-migrate @ 14089]
Etan Reisner <deryni@pidgin.im>
parents: 11797
diff changeset
8229 sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies"));
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8230
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8231 if (sortmenu == NULL)
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8232 return;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8233
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8234 /* Clear the old menu */
18944
3d27499bb0d5 Fix memory leak by freeing the list returned by gtk_container_get_children.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 18621
diff changeset
8235 for (l = gtk_container_get_children(GTK_CONTAINER(sortmenu)); l; l = g_list_delete_link(l, l)) {
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8236 menuitem = l->data;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8237 gtk_widget_destroy(GTK_WIDGET(menuitem));
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8238 }
11923
a492ccce1a12 [gaim-migrate @ 14214]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
8239
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8240 for (l = pidgin_blist_sort_methods; l; l = l->next) {
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15561
diff changeset
8241 method = (PidginBlistSortMethod *) l->data;
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8242 menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name));
27908
7fdc071c61c7 Don't allow NULL sort method IDs and don't crash on them. Fixes #9658.
Paul Aurich <darkrain42@pidgin.im>
parents: 27888
diff changeset
8243 if (g_str_equal(m, method->id))
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8244 activeitem = menuitem;
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8245 sl = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem));
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8246 gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem);
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8247 g_signal_connect(G_OBJECT(menuitem), "toggled",
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8248 G_CALLBACK(sortmethod_act), method->id);
11923
a492ccce1a12 [gaim-migrate @ 14214]
Mark Doliner <markdoliner@pidgin.im>
parents: 11920
diff changeset
8249 gtk_widget_show(menuitem);
11796
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8250 }
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8251 if (activeitem)
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8252 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE);
bc7e0950806e [gaim-migrate @ 14087]
Sean Egan <seanegan@pidgin.im>
parents: 11768
diff changeset
8253 }

mercurial